Fixes on merge behavior; remove downloads cap
This commit is contained in:
@@ -30,7 +30,6 @@ type ConfigInterface interface {
|
||||
GetRateLimitSleepSecs() int
|
||||
ShouldDeleteRarFiles() bool
|
||||
GetDownloadsEveryMins() int
|
||||
GetDownloadsLimit() int
|
||||
GetDumpTorrentsEveryMins() int
|
||||
GetPlayableExtensions() []string
|
||||
GetTorrentsCount() int
|
||||
@@ -117,35 +116,28 @@ func (z *ZurgConfig) GetNumOfWorkers() int {
|
||||
|
||||
func (z *ZurgConfig) GetRefreshEverySecs() int {
|
||||
if z.RefreshEverySecs == 0 {
|
||||
return 60
|
||||
return 15
|
||||
}
|
||||
return z.RefreshEverySecs
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetRepairEveryMins() int {
|
||||
if z.RepairEveryMins == 0 {
|
||||
return 60
|
||||
return 60 // 1 hour
|
||||
}
|
||||
return z.RepairEveryMins
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetDownloadsEveryMins() int {
|
||||
if z.DownloadsEveryMins == 0 {
|
||||
return 1440
|
||||
return 720 // 12 hours
|
||||
}
|
||||
return z.DownloadsEveryMins
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetDownloadsLimit() int {
|
||||
if z.DownloadsLimit == 0 {
|
||||
return 10000
|
||||
}
|
||||
return z.DownloadsLimit
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetDumpTorrentsEveryMins() int {
|
||||
if z.DumpTorrentsEveryMins == 0 {
|
||||
return 1440
|
||||
return 1440 // 1 day
|
||||
}
|
||||
return z.DumpTorrentsEveryMins
|
||||
}
|
||||
@@ -226,7 +218,7 @@ func (z *ZurgConfig) GetPlayableExtensions() []string {
|
||||
|
||||
func (z *ZurgConfig) GetTorrentsCount() int {
|
||||
if z.TorrentsCount == 0 {
|
||||
return 100
|
||||
return 250
|
||||
}
|
||||
return z.TorrentsCount
|
||||
}
|
||||
|
||||
@@ -222,10 +222,6 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
||||
<td>Refresh Download Mount Every...</td>
|
||||
<td>%d mins</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Get downloads limit</td>
|
||||
<td>%d items</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Dump Torrents Every...</td>
|
||||
<td>%d mins</td>
|
||||
@@ -336,7 +332,6 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
||||
response.Config.GetTorrentsCount(),
|
||||
response.Config.GetDownloadTimeoutSecs(),
|
||||
response.Config.GetDownloadsEveryMins(),
|
||||
response.Config.GetDownloadsLimit(),
|
||||
response.Config.GetDumpTorrentsEveryMins(),
|
||||
response.Config.GetRateLimitSleepSecs(),
|
||||
response.Config.GetRetriesUntilFailed(),
|
||||
|
||||
@@ -342,12 +342,10 @@ func (t *TorrentManager) mountNewDownloads() {
|
||||
downloads := t.api.GetDownloads()
|
||||
for i := range downloads {
|
||||
isRealDebrid := strings.HasPrefix(downloads[i].Link, "https://real-debrid.com/d/")
|
||||
if isRealDebrid && !t.UnrestrictMap.Has(downloads[i].Link[0:39]) {
|
||||
t.UnrestrictMap.Set(downloads[i].Link[0:39], &downloads[i])
|
||||
} else if !isRealDebrid {
|
||||
if !t.UnrestrictMap.Has(downloads[i].Link) {
|
||||
t.UnrestrictMap.Set(downloads[i].Link, &downloads[i])
|
||||
}
|
||||
if isRealDebrid {
|
||||
t.UnrestrictMap.SetIfAbsent(downloads[i].Link[0:39], &downloads[i])
|
||||
} else {
|
||||
t.UnrestrictMap.SetIfAbsent(downloads[i].Link, &downloads[i])
|
||||
filename := filepath.Base(downloads[i].Filename)
|
||||
t.DownloadMap.Set(filename, &downloads[i])
|
||||
}
|
||||
@@ -362,6 +360,7 @@ func (t *TorrentManager) StartDownloadsJob() {
|
||||
for {
|
||||
select {
|
||||
case <-remountTicker.C:
|
||||
t.DownloadMap.Clear()
|
||||
t.mountNewDownloads()
|
||||
case <-t.RemountTrigger:
|
||||
t.DownloadMap.Clear()
|
||||
|
||||
@@ -296,9 +296,7 @@ func (t *TorrentManager) mergeTorrents(existing, toMerge *Torrent) *Torrent {
|
||||
// selected files
|
||||
mergedTorrent.SelectedFiles = cmap.New[*File]()
|
||||
newer.SelectedFiles.IterCb(func(key string, file *File) {
|
||||
if f, ok := mergedTorrent.SelectedFiles.Get(key); !ok || !f.State.Is("ok_file") {
|
||||
mergedTorrent.SelectedFiles.Set(key, file)
|
||||
}
|
||||
mergedTorrent.SelectedFiles.SetIfAbsent(key, file)
|
||||
})
|
||||
older.SelectedFiles.IterCb(func(key string, file *File) {
|
||||
mediaInfo := file.MediaInfo
|
||||
|
||||
Reference in New Issue
Block a user