From b2310c62e49c6d6332fb60c23fea69feab9fb77c Mon Sep 17 00:00:00 2001 From: Ezra Buehler Date: Sun, 4 Jul 2021 19:00:37 +0200 Subject: [PATCH] epren.py: fix --- epren.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/epren.py b/epren.py index 8e2f52e..5dddd1c 100755 --- a/epren.py +++ b/epren.py @@ -43,13 +43,16 @@ def __init__(self, arg=None): if self._dry: print("*** Dry run requested ***") - self._tvdb = tvdb_api.Tvdb() + with open(os.path.expanduser("~/.tvdb_key")) as f: + apikey = f.read().strip() + + self._tvdb = tvdb_api.Tvdb(apikey=apikey) def run(self): results = self._tvdb.search(self._search_str) if len(results) == 0: self._exit("Could not find requested show") - show_name = results[0]['seriesname'] + show_name = results[0]['seriesName'] answ = 'n' if self._season_no is not None: answ = self._prompt("Rename '{0}' season {1:d} ?".format( @@ -58,13 +61,13 @@ def run(self): while answ != 'y': i = 0 for result in results: - name = result['seriesname'] + name = result['seriesName'] print("[{0:d}] {1}".format(i, name)) i += 1 print("[q] Never mind...") show_index = self._prompt_for_number("Select a show") choice = results[show_index] - show_name = choice['seriesname'] + show_name = choice['seriesName'] default_season = self._season_no if self._season_no else list( self._tvdb[show_name].keys())[-1] self._season_no = self._prompt_for_number( @@ -82,7 +85,7 @@ def _fetch_episode_names(self): for episode_no, episode in list(self._tvdb[ self._show_name][self._season_no].items()): number_str = "{0:d}{1:02d}".format(self._season_no, episode_no) - title = episode['episodename'] + title = episode['episodeName'] if not title: continue title = re.sub('/', '-', title)