From 3322e94e034d00691ec69611fb8eeaa8556e2438 Mon Sep 17 00:00:00 2001 From: Uriziel Date: Fri, 2 Oct 2015 00:08:02 +0200 Subject: [PATCH] Actually executing filechanges for numeric keys --- syncplay/client.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/syncplay/client.py b/syncplay/client.py index 83f1dfb43..bcad241fc 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -411,7 +411,13 @@ def updateFile(self, filename, duration, path): self.userlist.currentUser.setFile(filename, duration, size, path) self.sendFile() - # TODO: execute changeToPlaylistIndex if file found in playlist + # TODO: Fix for GUIDS + try: + index = self._playlist.index(filename) + self.changeToPlaylistIndex(index) + except ValueError: + pass + def changeToPlaylistIndex(self, index, username = None): if self._playlistIndex == index: @@ -421,8 +427,7 @@ def changeToPlaylistIndex(self, index, username = None): self._protocol.setPlaylistIndex(index) elif username != self.getUsername(): # TODO: Display info about playlist file change - - if index in self._playlist: + try: filename = self._playlist[index] # TODO: Find Path path = 'https://www.youtube.com/watch?v=0iXX5h6Hxxs' @@ -431,6 +436,8 @@ def changeToPlaylistIndex(self, index, username = None): else: # TODO: Notify user about file not found pass + except IndexError: + pass def changePlaylist(self, files, username = None): self._playlist = files