New rules for extraction

This commit is contained in:
Ben Adrian Sarmiento
2024-06-20 04:21:57 +02:00
parent 3e9afe3278
commit 8921b33b6a
2 changed files with 36 additions and 11 deletions

View File

@@ -319,6 +319,9 @@ func (t *TorrentManager) mergeTorrents(existing, toMerge *Torrent) *Torrent {
brokenCount := 0
okCount := 0
mergedTorrent.SelectedFiles.IterCb(func(key string, file *File) {
if !utils.IsVideo(file.Path) && !t.IsPlayable(file.Path) {
return
}
if file.State.Is("broken_file") {
brokenCount++
} else if file.State.Is("ok_file") {
@@ -330,7 +333,7 @@ func (t *TorrentManager) mergeTorrents(existing, toMerge *Torrent) *Torrent {
mergedTorrent.State.Event(context.Background(), "mark_as_repaired")
}
t.log.Debugf("Merged torrent %s has %d broken files", t.GetKey(mergedTorrent), brokenCount)
t.log.Debugf("After merging, torrent %s has %d broken file(s)", t.GetKey(mergedTorrent), brokenCount)
return mergedTorrent
}
@@ -392,8 +395,8 @@ func (t *TorrentManager) assignDirectory(tor *Torrent, triggerHook bool) {
}
func (t *TorrentManager) IsPlayable(filePath string) bool {
filePath = strings.ToLower(filePath)
playableExts := t.Config.GetPlayableExtensions()
filePath = strings.ToLower(filePath)
for _, ext := range playableExts {
if strings.HasSuffix(filePath, fmt.Sprintf(".%s", ext)) {
return true