2017-08-05 13:48:53 -07:00
|
|
|
package builders
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
itunes "github.com/mxpv/podcast"
|
2017-08-19 16:58:23 -07:00
|
|
|
"github.com/mxpv/podsync/pkg/api"
|
2017-11-03 16:04:33 -07:00
|
|
|
"github.com/mxpv/podsync/pkg/model"
|
2017-08-05 13:48:53 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
podsyncGenerator = "Podsync generator"
|
|
|
|
defaultCategory = "TV & Film"
|
|
|
|
)
|
|
|
|
|
2017-11-03 16:04:33 -07:00
|
|
|
func makeEnclosure(feed *model.Feed, id string, lengthInBytes int64) (string, itunes.EnclosureType, int64) {
|
2017-08-05 13:48:53 -07:00
|
|
|
ext := "mp4"
|
|
|
|
contentType := itunes.MP4
|
2017-11-03 15:04:33 -07:00
|
|
|
if feed.Format == api.FormatAudio {
|
2017-08-20 19:26:25 -07:00
|
|
|
ext = "m4a"
|
|
|
|
contentType = itunes.M4A
|
2017-08-05 13:48:53 -07:00
|
|
|
}
|
|
|
|
|
2017-11-03 16:04:33 -07:00
|
|
|
url := fmt.Sprintf("https://podsync.net/download/%s/%s.%s", feed.HashID, id, ext)
|
2017-08-05 13:48:53 -07:00
|
|
|
return url, contentType, lengthInBytes
|
|
|
|
}
|