summaryrefslogtreecommitdiffstats
path: root/feed
diff options
context:
space:
mode:
authorsiddharth ravikumar <s@ricketyspace.net>2022-11-26 09:23:32 -0500
committersiddharth ravikumar <s@ricketyspace.net>2022-11-26 09:23:32 -0500
commitcc1551a32862ea976f56faf59dbf8bf35f8ba809 (patch)
tree69d15662e7725153415cf7b643b649952b5e7329 /feed
parent6a37490876348c6a5834a727430dab860b3d68b5 (diff)
feed: update `Feed.ydl`
Add custom handling to set the output file name for media from buzzsprout.com.
Diffstat (limited to 'feed')
-rw-r--r--feed/feed.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/feed/feed.go b/feed/feed.go
index 5e997ea..abd4dc5 100644
--- a/feed/feed.go
+++ b/feed/feed.go
@@ -11,6 +11,7 @@ import (
"os"
"os/exec"
"path"
+ "strings"
"time"
"ricketyspace.net/fern/schema"
@@ -220,9 +221,15 @@ func (feed *Feed) ydl(url string) error {
return fmt.Errorf("URL invalid")
}
+ // Media file name.
+ mediaName := "%(title)s-%(id)s.%(ext)s"
+ if strings.Contains(url, "buzzsprout.com") {
+ mediaName = path.Base(url)
+ }
+
// Download url via youtube-dl
outputTemplate := fmt.Sprintf("-o%s",
- path.Join(feed.DumpDir, "%(title)s-%(id)s.%(ext)s"))
+ path.Join(feed.DumpDir, mediaName))
cmd := exec.Command(feed.YDLPath, "--no-progress", outputTemplate, url)
_, err := cmd.CombinedOutput()
if err != nil {