Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use indexer ID in get_episode(). Fixes #4857 #4933

Merged
merged 2 commits into from
Aug 21, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions medusa/tv/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,15 +738,26 @@ def get_episode(self, season=None, episode=None, filepath=None, no_create=False,
sql = None
sql_args = None
if self.is_anime and absolute_number:
sql = b'SELECT season, episode ' \
b'FROM tv_episodes ' \
b'WHERE showid = ? AND absolute_number = ? AND season != 0'
sql_args = [self.series_id, absolute_number]
sql = (
b'SELECT season, episode '
b'FROM tv_episodes '
b'WHERE indexer = ? '
b'AND showid = ? '
b'AND absolute_number = ? '
b'AND season != 0'
)
sql_args = [self.indexer, self.series_id, absolute_number]
log.debug(u'{id}: Season and episode lookup for {show} using absolute number {absolute}',
{'id': self.series_id, 'absolute': absolute_number, 'show': self.name})
elif air_date:
sql = b'SELECT season, episode FROM tv_episodes WHERE showid = ? AND airdate = ?'
sql_args = [self.series_id, air_date.toordinal()]
sql = (
b'SELECT season, episode '
b'FROM tv_episodes '
b'WHERE indexer = ? '
b'AND showid = ? '
b'AND airdate = ?'
)
sql_args = [self.indexer, self.series_id, air_date.toordinal()]
log.debug(u'{id}: Season and episode lookup for {show} using air date {air_date}',
{'id': self.series_id, 'air_date': air_date, 'show': self.name})

Expand Down