Skip to content

Commit

Permalink
Merge pull request #626 from AbdullahM0hamed/epselection
Browse files Browse the repository at this point in the history
Fix -e 0 throwing IndexError
  • Loading branch information
AbdullahM0hamed committed Feb 11, 2021
2 parents 4d20769 + 872fb8d commit 0229cd1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion anime_downloader/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,13 @@ def parse_ep_str(anime, grammar):
episodes.append(episode)
else:
from anime_downloader.sites.anime import AnimeEpisode
ep = [x for x in anime._episode_urls if x[0] == int(grammar)][0]

if grammar == '0':
ep = sorted(anime._episode_urls)[-1]
else:
ep = [x for x in anime._episode_urls if x[0]
== int(grammar)][0]

ep_cls = AnimeEpisode.subclasses[anime.sitename]

episodes.append(ep_cls(ep[1], parent=anime, ep_no=ep[0]))
Expand Down

0 comments on commit 0229cd1

Please sign in to comment.