Skip to content

Commit

Permalink
Fix not checking for RARed torrents in history because is not media f…
Browse files Browse the repository at this point in the history
…ile (#3515)
  • Loading branch information
fernandog authored and p0psicles committed Dec 22, 2017
1 parent 0d3526c commit 5ab6b2c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions medusa/clients/torrent/deluge_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
from medusa import app
from medusa.clients.torrent.generic import GenericClient
from medusa.helpers import (
get_extension,
is_already_processed_media,
is_info_hash_in_history,
is_info_hash_processed,
is_media_file,
)
from medusa.logger.adapters.style import BraceAdapter

from requests.exceptions import RequestException

log = BraceAdapter(logging.getLogger(__name__))
Expand All @@ -36,10 +38,11 @@ def read_torrent_status(torrent_data):

to_remove = False
for i in details['files']:
# Need to check only the media file or the .rar file to avoid checking all .r0* files in history
if not (is_media_file(i['path']) or get_extension(i['path']) == 'rar'):
continue
# Check if media was processed
# OR check hash in case of RARed torrents
if not is_media_file(i['path']):
continue
if is_already_processed_media(i['path']) or is_info_hash_processed(info_hash):
to_remove = True

Expand Down
6 changes: 4 additions & 2 deletions medusa/clients/torrent/transmission_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from medusa import app
from medusa.clients.torrent.generic import GenericClient
from medusa.helpers import (
get_extension,
is_already_processed_media,
is_info_hash_in_history,
is_info_hash_processed,
Expand Down Expand Up @@ -290,10 +291,11 @@ def remove_ratio_reached(self):

to_remove = False
for i in torrent['files']:
# Need to check only the media file or the .rar file to avoid checking all .r0* files in history
if not (is_media_file(i['name']) or get_extension(i['name']) == 'rar'):
continue
# Check if media was processed
# OR check hash in case of RARed torrents
if not is_media_file(i['name']):
continue
if is_already_processed_media(i['name']) or is_info_hash_processed(str(torrent['hashString'])):
to_remove = True

Expand Down

0 comments on commit 5ab6b2c

Please sign in to comment.