Skip to content

Commit fc64030

Browse files
committed
Merge branch 'dev' of https://github.com/LumePart/Explo into dev
2 parents 244d74d + 9f02ea0 commit fc64030

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

docker/start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ chmod 600 /etc/crontabs/root
3535

3636
echo "[setup] Starting cron..."
3737

38-
if [ "$EXCECUTE_ON_START" = "true" ]; then
38+
if [ "$EXECUTE_ON_START" = "true" ]; then
3939
echo "[setup] Executing startup task..."
4040
apk add --upgrade yt-dlp && cd /opt/explo && ./explo $START_FLAGS
4141

src/config/flags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ func (cfg *Config) GetFlags() error {
2424
flag.StringVarP(&downloadMode, "download-mode", "d", "normal", "Download mode: 'normal' (download only when track is not found locally), 'skip' (skip downloading, only use tracks already found locally), 'force' (always download, don't check for local tracks)")
2525
flag.BoolVarP(&excludeLocal, "exclude-local", "e", false, "Exclude locally found tracks from the imported playlist")
2626
flag.BoolVar(&persist, "persist", true, "Keep playlists between generations")
27-
persistSet := flag.Lookup("persist").Changed
2827

2928
flag.Parse()
29+
persistSet := flag.Lookup("persist").Changed
3030

3131
// Validation for playlist
3232
if !contains(validPlaylists, playlist) {

src/downloader/downloader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func (c *DownloadClient) StartDownload(tracks *[]*models.Track) {
5959

6060
for _, d := range c.Downloaders {
6161
var g errgroup.Group
62-
g.SetLimit(2)
62+
g.SetLimit(1)
6363

6464
for _, track := range *tracks {
6565
if track.Present {

src/downloader/slskd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func (c Slskd) searchStatus(ID, trackDetails string, count int) (bool, error) {
209209
}
210210

211211
slog.Debug(fmt.Sprintf("[%s] (%d/%d) Searching for %s", "slskd", count, c.Cfg.Retry, trackDetails))
212-
time.Sleep(20 * time.Second)
212+
time.Sleep(15 * time.Second)
213213
return c.searchStatus(ID, trackDetails, count+1)
214214
}
215215

src/downloader/youtube.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,25 @@ type Youtube struct {
4747
DownloadDir string
4848
HttpClient *util.HttpClient
4949
Cfg cfg.Youtube
50+
gouTubeOpts goutubedl.Options
5051
}
5152

5253
func NewYoutube(cfg cfg.Youtube, discovery, downloadDir string, httpClient *util.HttpClient) *Youtube { // init downloader cfg for youtube
54+
// check for custom ytdlp options
55+
if cfg.YtdlpPath != "" {
56+
goutubedl.Path = cfg.YtdlpPath
57+
}
58+
59+
var opts goutubedl.Options
60+
if _, err := os.Stat(cfg.CookiesPath); err == nil {
61+
opts.Cookies = cfg.CookiesPath
62+
}
63+
5364
return &Youtube{
5465
DownloadDir: downloadDir,
5566
Cfg: cfg,
56-
HttpClient: httpClient}
67+
HttpClient: httpClient,
68+
gouTubeOpts: opts}
5769
}
5870

5971
func (c *Youtube) GetConf() (MonitorConfig, error) {
@@ -144,16 +156,8 @@ func getTopic(cfg cfg.Youtube, videos Videos, track models.Track) string { // ge
144156
}
145157

146158
func getVideo(ctx context.Context, c Youtube, videoID string) (*goutubedl.DownloadResult, error) { // gets video stream using yt-dlp
147-
if c.Cfg.YtdlpPath != "" {
148-
goutubedl.Path = c.Cfg.YtdlpPath
149-
}
150-
151-
var opts goutubedl.Options
152-
if _, err := os.Stat(c.Cfg.CookiesPath); err == nil {
153-
opts.Cookies = c.Cfg.CookiesPath
154-
}
155159

156-
result, err := goutubedl.New(ctx, videoID, opts)
160+
result, err := goutubedl.New(ctx, videoID, c.gouTubeOpts)
157161
if err != nil {
158162
return nil, fmt.Errorf("could not create URL for video download (ID: %s): %s", videoID, err.Error())
159163
}

0 commit comments

Comments
 (0)