Skip to content

Commit d092710

Browse files
committed
Fix download links when using custom port mxpv#43
1 parent 18fd306 commit d092710

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ In order to query YouTube or Vimeo API you have to obtain an API token first.
3737
[server]
3838
port = 8080
3939
data_dir = "/path/to/data/directory"
40-
hostname = "http://hostname"
40+
hostname = "hostname"
4141

4242
[tokens]
4343
youtube = "{YOUTUBE_API_TOKEN}"
@@ -54,7 +54,7 @@ vimeo = "{VIMEO_API_TOKEN}"
5454

5555
Episodes files will be kept at: `/path/to/data/directory/ID1`
5656

57-
Feed will be accessible from: `http://hostname/ID1.xml`
57+
Feed will be accessible from: `http://hostname:8080/ID1.xml`
5858

5959
## How to run
6060

cmd/podsync/updater.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os"
88
"path/filepath"
99
"strconv"
10+
"strings"
1011
"time"
1112

1213
itunes "github.com/mxpv/podcast"
@@ -216,7 +217,18 @@ func (u *Updater) makeEnclosure(feed *model.Feed, episode *model.Episode, cfg *c
216217
contentType = itunes.MP3
217218
}
218219

219-
url := fmt.Sprintf("%s/%s/%s.%s", u.config.Server.Hostname, cfg.ID, episode.ID, ext)
220+
// Make sure there is no http:// prefix
221+
hostname := strings.TrimPrefix(u.config.Server.Hostname, "http://")
222+
223+
url := fmt.Sprintf(
224+
"http://%s:%d/%s/%s.%s",
225+
hostname,
226+
u.config.Server.Port,
227+
cfg.ID,
228+
episode.ID,
229+
ext,
230+
)
231+
220232
return url, contentType, episode.Size
221233
}
222234

0 commit comments

Comments
 (0)