diff --git a/client/settings.html b/client/settings.html index 48665a3..c727bbf 100644 --- a/client/settings.html +++ b/client/settings.html @@ -104,6 +104,10 @@ Base URL (if accessing Podgrab using a URL. Without trailing /. Leave empty if not using or unsure.) + @@ -181,6 +185,7 @@ var app = new Vue({ downloadEpisodeImages:self.downloadEpisodeImages, generateNFOFile:self.generateNFOFile, dontDownloadDeletedFromDisk:self.dontDownloadDeletedFromDisk, + maxDownloadConcurrency:self.maxDownloadConcurrency, baseUrl:self.baseUrl, }) .then(function(response){ @@ -225,6 +230,7 @@ var app = new Vue({ downloadEpisodeImages:{{.setting.DownloadEpisodeImages }}, generateNFOFile:{{ .setting.GenerateNFOFile }}, dontDownloadDeletedFromDisk:{{ .setting.DontDownloadDeletedFromDisk }}, + maxDownloadConcurrency:{{ .setting.maxDownloadConcurrency }}, baseUrl: {{ .setting.BaseUrl }}, }, diff --git a/controllers/pages.go b/controllers/pages.go index 2034e22..9b805d5 100644 --- a/controllers/pages.go +++ b/controllers/pages.go @@ -31,6 +31,7 @@ type SettingModel struct { GenerateNFOFile bool `form:"generateNFOFile" json:"generateNFOFile" query:"generateNFOFile"` DontDownloadDeletedFromDisk bool `form:"dontDownloadDeletedFromDisk" json:"dontDownloadDeletedFromDisk" query:"dontDownloadDeletedFromDisk"` BaseUrl string `form:"baseUrl" json:"baseUrl" query:"baseUrl"` + MaxDownloadConcurrency bool `form:"maxDownloadConcurrency" json:"maxDownloadConcurrency" query:"maxDownloadConcurrency"` } var searchOptions = map[string]string{ diff --git a/db/podcast.go b/db/podcast.go index 0962dd1..6614087 100644 --- a/db/podcast.go +++ b/db/podcast.go @@ -87,6 +87,7 @@ type Setting struct { GenerateNFOFile bool `gorm:"default:false"` DontDownloadDeletedFromDisk bool `gorm:"default:false"` BaseUrl string + MaxDownloadConcurrency int `gorm:"default:5"` } type Migration struct { Base diff --git a/service/podcastService.go b/service/podcastService.go index 345d2a2..5dbd3d3 100644 --- a/service/podcastService.go +++ b/service/podcastService.go @@ -537,7 +537,7 @@ func DownloadMissingEpisodes() error { SetPodcastItemAsDownloaded(item.ID, url) }(item, *setting) - if index%5 == 0 { + if index%setting.MaxDownloadConcurrency == 0 { wg.Wait() } } @@ -764,7 +764,7 @@ func GetSearchFromPodcastIndex(pod *podcastindex.Podcast) *model.CommonSearchRes func UpdateSettings(downloadOnAdd bool, initialDownloadCount int, autoDownload bool, appendDateToFileName bool, appendEpisodeNumberToFileName bool, darkMode bool, downloadEpisodeImages bool, - generateNFOFile bool, dontDownloadDeletedFromDisk bool, baseUrl string) error { + generateNFOFile bool, dontDownloadDeletedFromDisk bool, baseUrl string, maxDownloadConcurrency int) error { setting := db.GetOrCreateSetting() setting.AutoDownload = autoDownload @@ -777,6 +777,7 @@ func UpdateSettings(downloadOnAdd bool, initialDownloadCount int, autoDownload b setting.GenerateNFOFile = generateNFOFile setting.DontDownloadDeletedFromDisk = dontDownloadDeletedFromDisk setting.BaseUrl = baseUrl + setting.MaxDownloadConcurrency = maxDownloadConcurrency return db.UpdateSettings(setting) }