Skip to content

Commit

Permalink
Try to use TVDB ID for BTN search even if a different indexer is used (
Browse files Browse the repository at this point in the history
…#11664)

* Try to use TVDB ID for BTN search even if a different indexer is used

* lint
  • Loading branch information
medariox authored Mar 20, 2024
1 parent 1e8c2b3 commit f53efa0
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions medusa/providers/torrent/json/btn.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
)
from medusa.common import cpu_presets
from medusa.helper.common import convert_size, episode_num
from medusa.indexers.config import INDEXER_TVDBV2
from medusa.logger.adapters.style import BraceAdapter
from medusa.providers.torrent.torrent_provider import TorrentProvider

Expand Down Expand Up @@ -236,16 +235,19 @@ def _search_params(self, ep_obj, mode, season_numbering=None):
}

# Search
if ep_obj.series.indexer == INDEXER_TVDBV2:
params['tvdb'] = self._get_tvdb_id()
tvdb_id = self._get_tvdb_id()
if tvdb_id is not None:
params['tvdb'] = tvdb_id
searches.append(params)
else:
# Search by name if we don't have tvdb id
params['series'] = ep_obj.series.name
searches.append(params.copy())
# Add scene name exceptions
name_exceptions = scene_exceptions.get_scene_exceptions(ep_obj.series)
name_exceptions.add(ep_obj.series.name)
for name in name_exceptions:
# Search by name if we don't have tvdb id
params['series'] = name
searches.append(params)
for exception in name_exceptions:
params['series'] = exception.title
searches.append(params.copy())

# extend air by date searches to include season numbering
if air_by_date and not season_numbering:
Expand Down

0 comments on commit f53efa0

Please sign in to comment.