mirror of
https://github.com/mxpv/podsync.git
synced 2024-05-11 05:55:04 +00:00
Fix download links when using custom port #43
This commit is contained in:
@@ -37,7 +37,7 @@ In order to query YouTube or Vimeo API you have to obtain an API token first.
|
||||
[server]
|
||||
port = 8080
|
||||
data_dir = "/path/to/data/directory"
|
||||
hostname = "http://hostname"
|
||||
hostname = "hostname"
|
||||
|
||||
[tokens]
|
||||
youtube = "{YOUTUBE_API_TOKEN}"
|
||||
@@ -54,7 +54,7 @@ vimeo = "{VIMEO_API_TOKEN}"
|
||||
|
||||
Episodes files will be kept at: `/path/to/data/directory/ID1`
|
||||
|
||||
Feed will be accessible from: `http://hostname/ID1.xml`
|
||||
Feed will be accessible from: `http://hostname:8080/ID1.xml`
|
||||
|
||||
## How to run
|
||||
|
||||
|
||||
+13
-1
@@ -7,6 +7,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
itunes "github.com/mxpv/podcast"
|
||||
@@ -216,7 +217,18 @@ func (u *Updater) makeEnclosure(feed *model.Feed, episode *model.Episode, cfg *c
|
||||
contentType = itunes.MP3
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("%s/%s/%s.%s", u.config.Server.Hostname, cfg.ID, episode.ID, ext)
|
||||
// Make sure there is no http:// prefix
|
||||
hostname := strings.TrimPrefix(u.config.Server.Hostname, "http://")
|
||||
|
||||
url := fmt.Sprintf(
|
||||
"http://%s:%d/%s/%s.%s",
|
||||
hostname,
|
||||
u.config.Server.Port,
|
||||
cfg.ID,
|
||||
episode.ID,
|
||||
ext,
|
||||
)
|
||||
|
||||
return url, contentType, episode.Size
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user