Skip to content

Commit

Permalink
Passing full show dict to prompt signals
Browse files Browse the repository at this point in the history
  • Loading branch information
z411 committed May 9, 2019
1 parent acbf2bf commit 8c871bb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
7 changes: 3 additions & 4 deletions trackma/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ def _tracker_playing(self, showid, playing, episode):
show = self.get_show_info(showid)
self._emit_signal('playing', show, playing, episode)

def _tracker_update(self, showid, episode):
show = self.get_show_info(showid)
def _tracker_update(self, show, episode):
if self.config['tracker_update_prompt']:
self._emit_signal('prompt_for_update', show, episode)
else:
Expand All @@ -149,9 +148,9 @@ def _tracker_update(self, showid, episode):
except utils.TrackmaError as e:
self.msg.warn(self.name, "Can't update episode: {}".format(e))

def _tracker_unrecognised(self, show_title, episode):
def _tracker_unrecognised(self, show, episode):
if self.config['tracker_not_found_prompt']:
self._emit_signal('prompt_for_add', show_title, episode)
self._emit_signal('prompt_for_add', show, episode)

def _tracker_state(self, status):
self._emit_signal('tracker_state', status)
Expand Down
4 changes: 2 additions & 2 deletions trackma/tracker/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ def _update_show(self, state, show_tuple):
self.last_updated = True
action = None
if state == utils.TRACKER_PLAYING:
action = lambda: self._emit_signal('update', show['id'], episode)
action = lambda: self._emit_signal('update', show, episode)
elif state == utils.TRACKER_NOT_FOUND:
action = lambda: self._emit_signal('unrecognised', show['title'], episode)
action = lambda: self._emit_signal('unrecognised', show, episode)

if self.config['tracker_update_close']:
self.msg.info(self.name, 'Waiting for the player to close.')
Expand Down
6 changes: 3 additions & 3 deletions trackma/ui/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ def _ask_update(self, show, episode):
if do.lower() == 'y':
self.engine.set_episode(show['id'], episode)

def _ask_add(self, show_title, episode):
do = input("Should I search for the show {}? [y/N] ".format(show_title))
def _ask_add(self, show, episode):
do = input("Should I search for the show {}? [y/N] ".format(show['title']))
if do.lower() == 'y':
self.do_add([show_title])
self.do_add([show['title']])

def start(self):
"""
Expand Down
4 changes: 2 additions & 2 deletions trackma/ui/qt/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1292,11 +1292,11 @@ def ws_prompt_update(self, show, episode):
if reply == QMessageBox.Yes:
self.worker_call('set_episode', self.r_generic, show['id'], episode)

def ws_prompt_add(self, show_title, episode):
def ws_prompt_add(self, show, episode):
page = self.notebook.currentIndex()
current_status = self.mediainfo['statuses'][page]

addwindow = AddDialog(None, self.worker, current_status, default=show_title)
addwindow = AddDialog(None, self.worker, current_status, default=show['title'])
addwindow.setModal(True)
if addwindow.exec_():
self.worker_call('set_episode', self.r_generic, addwindow.selected_show['id'], episode)
Expand Down
6 changes: 3 additions & 3 deletions trackma/ui/qt/workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class EngineWorker(QtCore.QThread):
tracker_state = QtCore.pyqtSignal(dict)
playing_show = QtCore.pyqtSignal(dict, bool, int)
prompt_for_update = QtCore.pyqtSignal(dict, int)
prompt_for_add = QtCore.pyqtSignal(str, int)
prompt_for_add = QtCore.pyqtSignal(dict, int)

def __init__(self):
super(EngineWorker, self).__init__()
Expand Down Expand Up @@ -137,8 +137,8 @@ def _playing_show(self, show, is_playing, episode):
def _prompt_for_update(self, show, episode):
self.prompt_for_update.emit(show, episode)

def _prompt_for_add(self, show_title, episode):
self.prompt_for_add.emit(show_title, episode)
def _prompt_for_add(self, show, episode):
self.prompt_for_add.emit(show, episode)

# Callable functions
def _start(self, account):
Expand Down

0 comments on commit 8c871bb

Please sign in to comment.