6
6
from django .utils import dateparse , timezone
7
7
from transmissionrpc import Torrent
8
8
9
- from nefarious .models import WatchMovie , NefariousSettings , TorrentBlacklist , WatchTVEpisode , WatchTVSeason
9
+ from nefarious .models import WatchMovie , NefariousSettings , TorrentBlacklist , WatchTVEpisode , WatchTVSeason , QualityProfile
10
10
from nefarious .parsers .movie import MovieParser
11
11
from nefarious .parsers .tv import TVParser
12
12
from nefarious .quality import Profile
@@ -61,7 +61,7 @@ def fetch(self):
61
61
62
62
logger_background .info ('Valid Search Results: {}' .format (len (valid_search_results )))
63
63
64
- # find the torrent result with the highest weight (i.e seeds)
64
+ # find the torrent result with the highest weight (e.g. seeds)
65
65
best_result = self ._get_best_torrent_result (valid_search_results )
66
66
67
67
transmission_client = get_transmission_client (self .nefarious_settings )
@@ -99,7 +99,7 @@ def fetch(self):
99
99
continue
100
100
else :
101
101
logger_background .info ('No valid search results for {}' .format (self ._sanitize_title (str (self .watch_media ))))
102
- # try again without possessive apostrophes (ie . The Handmaids Tale vs The Handmaid's Tale)
102
+ # try again without possessive apostrophes (e.g . The Handmaids Tale vs The Handmaid's Tale)
103
103
if not self ._reprocess_without_possessive_apostrophes and self ._possessive_apostrophes_regex .search (str (self .watch_media )):
104
104
self ._reprocess_without_possessive_apostrophes = True
105
105
logger_background .warning ('Retrying without possessive apostrophes: "{}"' .format (self ._sanitize_title (str (self .watch_media ))))
@@ -117,7 +117,9 @@ def fetch(self):
117
117
def is_match (self , title : str ) -> bool :
118
118
parser = self ._get_parser (title )
119
119
quality_profile = self ._get_quality_profile ()
120
- profile = Profile .get_from_name (quality_profile )
120
+ profile = Profile .get_from_name (quality_profile .profile )
121
+
122
+ # TODO - test other profile attributes (min/max size, HDR, etc)
121
123
122
124
return (
123
125
self ._is_match (parser ) and
@@ -144,7 +146,7 @@ def _results_with_valid_urls(self, results: list):
144
146
def _get_best_torrent_result (self , results : list ):
145
147
return get_best_torrent_result (results )
146
148
147
- def _get_quality_profile (self ):
149
+ def _get_quality_profile (self ) -> QualityProfile :
148
150
raise NotImplementedError
149
151
150
152
def _get_watch_media (self , watch_media_id : int ):
@@ -179,7 +181,7 @@ def _get_search_results(self):
179
181
180
182
class WatchMovieProcessor (WatchProcessorBase ):
181
183
182
- def _get_quality_profile (self ):
184
+ def _get_quality_profile (self ) -> QualityProfile :
183
185
# try custom quality profile then fallback to global setting
184
186
return self .watch_media .quality_profile or self .nefarious_settings .quality_profile_movies
185
187
@@ -222,7 +224,7 @@ def _get_search_results(self):
222
224
223
225
class WatchTVProcessorBase (WatchProcessorBase ):
224
226
225
- def _get_quality_profile (self ):
227
+ def _get_quality_profile (self ) -> QualityProfile :
226
228
# try custom quality profile then fallback to global setting
227
229
watch_media = self .watch_media # type: WatchTVEpisode|WatchTVSeason
228
230
return watch_media .watch_tv_show .quality_profile or self .nefarious_settings .quality_profile_tv
0 commit comments