From d8e52d3317c5440d65786c3e40089037cb29e534 Mon Sep 17 00:00:00 2001 From: alxlaxv <35723598+alxlaxv@users.noreply.github.com> Date: Wed, 25 Apr 2018 22:34:23 +0200 Subject: [PATCH 1/9] Fixing getEpisodeTVDB --- default.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/default.py b/default.py index e05523a..1f70940 100644 --- a/default.py +++ b/default.py @@ -264,17 +264,25 @@ def getEpisodeTVDB(self, xbmc_id): rpccmd = {'jsonrpc': '2.0', 'method': 'VideoLibrary.GetEpisodeDetails', 'params': {"episodeid": int(xbmc_id), 'properties': ['season', 'episode', 'tvshowid', 'showtitle', 'uniqueid']}, 'id': 1} rpccmd = json.dumps(rpccmd) result = xbmc.executeJSONRPC(rpccmd) - result = json.loads(result) - log('result=%s' % result) - log('episode_id=%s' % result['result']['episodedetails']['uniqueid']['unknown']) - + result = json.loads(result) + log('result=%s' % result) + if 'unknown' in result['result']['episodedetails']['uniqueid']: + episode_id = result['result']['episodedetails']['uniqueid']['unknown'] + if 'imdb' in result['result']['episodedetails']['uniqueid']: + episode_id = result['result']['episodedetails']['uniqueid']['imdb'] + if 'tvdb' in result['result']['episodedetails']['uniqueid']: + episode_id = result['result']['episodedetails']['uniqueid']['tvdb'] + else: + return False + log('episode_id=%s' % episode_id) + try: item = {} item['season'] = result['result']['episodedetails']['season'] item['tvshowid'] = result['result']['episodedetails']['tvshowid'] item['episode'] = result['result']['episodedetails']['episode'] item['showtitle'] = result['result']['episodedetails']['showtitle'] - item['episode_id'] = result['result']['episodedetails']['uniqueid']['unknown'] + item['episode_id'] = episode_id return item except: return False @@ -367,4 +375,3 @@ def normalizeString(str): player._monitor = None log("sys.exit(0)") sys.exit(0) - From 6a079a0834263ce5223c6b02892cf609f4204f4d Mon Sep 17 00:00:00 2001 From: alxlaxv <35723598+alxlaxv@users.noreply.github.com> Date: Wed, 25 Apr 2018 22:36:59 +0200 Subject: [PATCH 2/9] Update french strings --- resources/language/French/strings.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/language/French/strings.po b/resources/language/French/strings.po index 812d687..6b9aa0b 100644 --- a/resources/language/French/strings.po +++ b/resources/language/French/strings.po @@ -91,7 +91,7 @@ msgstr "Bien" msgctxt "#35312" msgid "Funk" -msgstr "Fun" +msgstr "Drole" msgctxt "#35313" msgid "Wow" @@ -99,15 +99,15 @@ msgstr "Wow" msgctxt "#35314" msgid "Sad" -msgstr "triste" +msgstr "Triste" msgctxt "#35316" msgid "Soso" -msgstr "Mitigé" +msgstr "Bof" msgctxt "#35317" msgid "Bad" -msgstr "Mauvais" +msgstr "Nul" msgctxt "#32901" msgid "Please login" From 6e381b6adc7c7bcbe49685139cc96ceac6720246 Mon Sep 17 00:00:00 2001 From: alxlaxv <35723598+alxlaxv@users.noreply.github.com> Date: Wed, 25 Apr 2018 22:58:39 +0200 Subject: [PATCH 3/9] Update addon.xml Update to be able to identify it from the source --- addon.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addon.xml b/addon.xml index 9088bfb..dc616f5 100644 --- a/addon.xml +++ b/addon.xml @@ -1,8 +1,8 @@ + version="1.2.1" + provider-name="alxlaxv"> @@ -19,9 +19,9 @@ en fr it GNU GENERAL PUBLIC LICENSE. Version 2, June 1991 http://forum.kodi.tv/showthread.php?tid=199604 - https://github.com/cxii-dev/script.tvtime - https://github.com/cxii-dev/script.tvtime.git - cxii-dev[AT]users[DOT]noreply[DOT]github[DOT]com + https://github.com/alxlaxv/script.tvtime + https://github.com/alxlaxv/script.tvtime.git + alxlaxv[AT]users[DOT]noreply[DOT]github[DOT]com From 9f97a65db74aa038db4f2a56242a4c067eefaad8 Mon Sep 17 00:00:00 2001 From: alxlaxv <35723598+alxlaxv@users.noreply.github.com> Date: Wed, 23 May 2018 12:39:13 +0200 Subject: [PATCH 4/9] Update README.md --- README.md | 54 +++++++++++++----------------------------------------- 1 file changed, 13 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 82916dc..3a357f3 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,25 @@ -script.tvtime -================= +# script.tvtime Kodi plugin for [TV Time](http://www.tvtime.com) This plugin will set TV shows episodes you've seen as watched on TV Time. It will also add the new TV show to your account if it was not already there. -install -======= +This fork has been created to be able to apply some fixes on the initial repository (hibernating/dead) but it will never be submitted to the official Kodi repository. +Please follow Build or Download steps below to install this version. -This plugin has been submitted to the [official Kodi repository](http://addons.xbmc.org/show/script.tvtime/). -To install it, just follow this [HOW-TO](http://kodi.wiki/view/HOW-TO:Install_add-ons). -After that, launch the add-on to login. +## Build -build -===== +If you want to build it manually, please follow the steps below: -If you want to build it manually, here is a simple script to do so: -```sh -#!/bin/bash +1. Clone this repository `sudo git clone https://github.com/alxlaxv/script.tvtime.git` +2. Enter in script.tvtime `cd script.tvtime` +3. Make the compile script executable `sudo chmod +x compile.sh` +4. Launch the compile script `./compile.sh` -dest=script.tvtime -version=$(grep -E "^\s+version" addon.xml | cut -f2 -d'"') +It will create a zip file which can be installed directly within Kodi by following this [HOW-TO](https://kodi.wiki/view/Add-on_manager#How_to_install_from_a_ZIP_file). -if [ -d $dest ]; then - rm -r $dest -fi +## Download -mkdir $dest -cp addon.xml $dest/ -cp *.txt $dest/ -cp icon.png $dest/ -cp *.py $dest/ -cp -r resources $dest/ - -if [ -f $dest-$version.zip ]; then - rm $dest-$version.zip -fi - -zip -r $dest-$version.zip $dest -rm -r $dest -```` -It will create a zip file that you can install directly within Kodi. -Using the GUI of Kodi, choose to install your plugin as a zip file, find your zip file and it's done ! - -download -======== - -If you want to download the release package because you can't or don't want to build it, you can do it on this link: -http://addons.xbmc.org/show/script.tvtime/ -or -[download](here) the latests version. +You can down the [last release](https://github.com/alxlaxv/script.tvtime/releases/latest) directly. +It will download a zip file which can be installed directly within Kodi by following this [HOW-TO](https://kodi.wiki/view/Add-on_manager#How_to_install_from_a_ZIP_file). From 88521d026d85fe51b8d3658c4c09f4e4f8f37f7c Mon Sep 17 00:00:00 2001 From: kvanzuijlen Date: Mon, 16 Jul 2018 23:49:10 +0200 Subject: [PATCH 5/9] Fixed getEpisodeTVDB for tv episodes without an tvdb ID Because the code had 3 different if statements, the getEpisodeTVDB method always returned false for episodes without a tvdb unique ID. --- default.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/default.py b/default.py index 1f70940..6ad36e3 100644 --- a/default.py +++ b/default.py @@ -268,9 +268,9 @@ def getEpisodeTVDB(self, xbmc_id): log('result=%s' % result) if 'unknown' in result['result']['episodedetails']['uniqueid']: episode_id = result['result']['episodedetails']['uniqueid']['unknown'] - if 'imdb' in result['result']['episodedetails']['uniqueid']: + elif 'imdb' in result['result']['episodedetails']['uniqueid']: episode_id = result['result']['episodedetails']['uniqueid']['imdb'] - if 'tvdb' in result['result']['episodedetails']['uniqueid']: + elif 'tvdb' in result['result']['episodedetails']['uniqueid']: episode_id = result['result']['episodedetails']['uniqueid']['tvdb'] else: return False From 67ae0e78bc508a35f3ad926f82e8dce358db41fe Mon Sep 17 00:00:00 2001 From: alxlaxv <35723598+alxlaxv@users.noreply.github.com> Date: Tue, 30 Oct 2018 08:10:40 +0100 Subject: [PATCH 6/9] Update addon.xml --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index dc616f5..b0014ca 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ From 0c71ecda8b2d359c44bd4d73f790ec2348c413bc Mon Sep 17 00:00:00 2001 From: alxlaxv <35723598+alxlaxv@users.noreply.github.com> Date: Wed, 24 Apr 2019 18:59:55 +0200 Subject: [PATCH 7/9] Reverting IMDb feature --- default.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/default.py b/default.py index 6ad36e3..f0bd4b2 100644 --- a/default.py +++ b/default.py @@ -268,8 +268,6 @@ def getEpisodeTVDB(self, xbmc_id): log('result=%s' % result) if 'unknown' in result['result']['episodedetails']['uniqueid']: episode_id = result['result']['episodedetails']['uniqueid']['unknown'] - elif 'imdb' in result['result']['episodedetails']['uniqueid']: - episode_id = result['result']['episodedetails']['uniqueid']['imdb'] elif 'tvdb' in result['result']['episodedetails']['uniqueid']: episode_id = result['result']['episodedetails']['uniqueid']['tvdb'] else: From f8479974571c5716403185755a466785e547fb63 Mon Sep 17 00:00:00 2001 From: alxlaxv <35723598+alxlaxv@users.noreply.github.com> Date: Wed, 24 Apr 2019 19:00:16 +0200 Subject: [PATCH 8/9] Update addon.xml --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index b0014ca..a954aed 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ From faa1f85d495deaf0615b5604ddff829a6e35843c Mon Sep 17 00:00:00 2001 From: JosemyAB Date: Mon, 5 Aug 2019 17:29:45 +0200 Subject: [PATCH 9/9] Fix issues finding episode using Kodi 18.3 Using scrapper The movie database (TMDB) --- default.py | 66 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/default.py b/default.py index f0bd4b2..4ac283b 100644 --- a/default.py +++ b/default.py @@ -67,7 +67,7 @@ def _tearDown(self): def onSettingsChanged( self ): log('onSettingsChanged') self.action() - + def onNotification(self, sender, method, data): log('onNotification') log('method=%s' % method) @@ -90,7 +90,7 @@ def onNotification(self, sender, method, data): player.episode = FindEpisode(player.token, 0, player.filename) log('episode.is_found=%s' % player.episode.is_found) if player.episode.is_found: - if player.notifications == 'true': + if player.notifications == 'true': if player.notif_during_playback == 'false' and player.isPlaying() == 1: return if player.notif_scrobbling == 'false': @@ -103,22 +103,22 @@ def onNotification(self, sender, method, data): notif(__language__(32905), time=2500) else: player.http_playing = False - response = json.loads(data) + response = json.loads(data) log('%s' % response) if response.get('item').get('type') == 'episode': xbmc_id = response.get('item').get('id') - item = self.getEpisodeTVDB(xbmc_id) + item = self.getEpisodeTVDB(xbmc_id) log('showtitle=%s' % item['showtitle']) log('season=%s' % item['season']) log('episode=%s' % item['episode']) log('episode_id=%s' % item['episode_id']) - if len(item['showtitle']) > 0 and item['season'] > 0 and item['episode'] > 0 and item['episode_id'] > 0: + if len(item['showtitle']) > 0 and item['season'] > 0 and item['episode'] > 0 and item['episode_id'] > 0: player.filename = '%s.S%.2dE%.2d' % (formatName(item['showtitle']), float(item['season']), float(item['episode'])) log('tvshowtitle=%s' % player.filename) - player.episode = FindEpisode(player.token, item['episode_id']) + player.episode = FindEpisode(player.token, item['episode_id'], player.filename) log('episode.is_found=%s' % player.episode.is_found) if player.episode.is_found: - if player.notifications == 'true': + if player.notifications == 'true': if player.notif_during_playback == 'false' and player.isPlaying() == 1: return if player.notif_scrobbling == 'false': @@ -133,20 +133,20 @@ def onNotification(self, sender, method, data): if player.notifications == 'true': if player.notif_during_playback == 'false' and player.isPlaying() == 1: return - notif(__language__(32905), time=2500) - if (method == 'Player.OnStop'): + notif(__language__(32905), time=2500) + if (method == 'Player.OnStop'): self._tearDown() actual_percent = (self._last_pos/self._total_time)*100 - log('last_pos / total_time : %s / %s = %s %%' % (self._last_pos, self._total_time, actual_percent)) - log('Player.OnStop') + log('last_pos / total_time : %s / %s = %s %%' % (self._last_pos, self._total_time, actual_percent)) + log('Player.OnStop') if player.http == 'true' and player.http_playing == True : if player.progress == 'true': player.episode = FindEpisode(player.token, 0, player.filename) log('episode.is_found=%s' % player.episode.is_found) if player.episode.is_found: log('progress=%s' % self._last_pos) - self.progress = SaveProgress(player.token, player.episode.id, self._last_pos) - log('progress.is_set:=%s' % self.progress.is_set) + self.progress = SaveProgress(player.token, player.episode.id, self._last_pos) + log('progress.is_set:=%s' % self.progress.is_set) if actual_percent > 90: log('MarkAsWatched(*, %s, %s, %s)' % (player.filename, player.facebook, player.twitter)) checkin = MarkAsWatched(player.token, player.episode.id, player.facebook, player.twitter) @@ -173,33 +173,33 @@ def onNotification(self, sender, method, data): return if player.notif_scrobbling == 'false': return - notif('%s %s %sx%s' % (__language__(32906), player.episode.showname, player.episode.season_number, player.episode.number), time=2500) - else: - response = json.loads(data) + notif('%s %s %sx%s' % (__language__(32906), player.episode.showname, player.episode.season_number, player.episode.number), time=2500) + else: + response = json.loads(data) log('%s' % response) if player.progress == 'true': if response.get('item').get('type') == 'episode': xbmc_id = response.get('item').get('id') - item = self.getEpisodeTVDB(xbmc_id) + item = self.getEpisodeTVDB(xbmc_id) log('showtitle=%s' % item['showtitle']) log('season=%s' % item['season']) log('episode=%s' % item['episode']) log('episode_id=%s' % item['episode_id']) - if len(item['showtitle']) > 0 and item['season'] > 0 and item['episode'] > 0 and item['episode_id'] > 0: + if len(item['showtitle']) > 0 and item['season'] > 0 and item['episode'] > 0 and item['episode_id'] > 0: player.filename = '%s.S%.2dE%.2d' % (formatName(item['showtitle']), float(item['season']), float(item['episode'])) log('tvshowtitle=%s' % player.filename) log('progress=%s' % self._last_pos) - self.progress = SaveProgress(player.token, item['episode_id'], self._last_pos) - log('progress.is_set:=%s' % self.progress.is_set) + self.progress = SaveProgress(player.token, item['episode_id'], self._last_pos) + log('progress.is_set:=%s' % self.progress.is_set) if (method == 'VideoLibrary.OnUpdate'): log('VideoLibrary.OnUpdate') - response = json.loads(data) + response = json.loads(data) log('%s' % response) if response.get('item').get('type') == 'episode': xbmc_id = response.get('item').get('id') - playcount = response.get('playcount') + playcount = response.get('playcount') log('playcount=%s' % playcount) - item = self.getEpisodeTVDB(xbmc_id) + item = self.getEpisodeTVDB(xbmc_id) log('showtitle=%s' % item['showtitle']) log('season=%s' % item['season']) log('episode=%s' % item['episode']) @@ -208,12 +208,12 @@ def onNotification(self, sender, method, data): if len(item['showtitle']) > 0 and item['season'] > 0 and item['episode'] > 0 and item['episode_id'] > 0: self.filename = '%s.S%.2dE%.2d' % (formatName(item['showtitle']), float(item['season']), float(item['episode'])) log('tvshowtitle=%s' % self.filename) - self.episode = FindEpisode(player.token, item['episode_id']) + self.episode = FindEpisode(player.token, item['episode_id'], self.filename) log('episode.is_found=%s' % self.episode.is_found) if self.episode.is_found: if playcount is 1: log('MarkAsWatched(*, %s, %s, %s)' % (self.filename, player.facebook, player.twitter)) - checkin = MarkAsWatched(player.token, item['episode_id'], player.facebook, player.twitter) + checkin = MarkAsWatched(player.token, self.episode.id, player.facebook, player.twitter) log('checkin.is_marked:=%s' % checkin.is_marked) if checkin.is_marked: if player.emotion == 'true': @@ -231,7 +231,7 @@ def onNotification(self, sender, method, data): self.emotion = 6 elif self.emotion == 5: self.emotion = 7 - SetEmotion(player.token, item['episode_id'], self.emotion) + SetEmotion(player.token, self.episode.id, self.emotion) if player.notifications == 'true': if player.notif_during_playback == 'false' and player.isPlaying() == 1: return @@ -245,7 +245,7 @@ def onNotification(self, sender, method, data): notif(__language__(32907), time=2500) if playcount is 0: log('MarkAsUnWatched(*, %s)' % (self.filename)) - checkin = MarkAsUnWatched(player.token, item['episode_id']) + checkin = MarkAsUnWatched(player.token, self.episode.id) log('checkin.is_unmarked:=%s' % checkin.is_unmarked) if checkin.is_unmarked: if player.notifications == 'true': @@ -270,6 +270,8 @@ def getEpisodeTVDB(self, xbmc_id): episode_id = result['result']['episodedetails']['uniqueid']['unknown'] elif 'tvdb' in result['result']['episodedetails']['uniqueid']: episode_id = result['result']['episodedetails']['uniqueid']['tvdb'] + elif 'tmdb' in result['result']['episodedetails']['uniqueid']: + episode_id = result['result']['episodedetails']['uniqueid']['tmdb'] else: return False log('episode_id=%s' % episode_id) @@ -284,7 +286,7 @@ def getEpisodeTVDB(self, xbmc_id): return item except: return False - + def getAllEpisodes(self, xbmc_id): rpccmd = {'jsonrpc': '2.0', 'method': 'VideoLibrary.GetEpisodes', 'params': {"tvshowid": int(xbmc_id), 'properties': ['season', 'episode', 'showtitle', 'playcount']}, 'id': 1} rpccmd = json.dumps(rpccmd) @@ -319,10 +321,10 @@ def __init__ (self): return self._monitor = Monitor(action = self._reset) log('Player - monitor') - + def _reset(self): self.__init__() - + def _GetUser(self): log('_GetUser') user = GetUserInformations(self.token) @@ -341,12 +343,12 @@ def formatNumber(number): if len(number) < 2: number = '0%s' % number return number - + def formatName(filename): filename = filename.strip() filename = filename.replace(' ', '.') return normalizeString(filename) - + def notif(msg, time=5000): xbmcgui.Dialog().notification(encode(__scriptname__), encode(msg), time=time, icon=__icon__)