From efe953d6a56412615c65875350f618ab22345912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A9tous?= Date: Sun, 7 Nov 2021 22:55:25 +0100 Subject: [PATCH] Don't try to play again the video in case of error When we detected a playback error due to a too small downloaded file the user had the choice to try again to play the video. On OSMC+raspi3 it was leading to a crash everytime the user was trying to play again the video. To avoid this now the user is only offered the option to pause or not the download: the user will have to manually play again the video. Depending on the user feedbacks and the test on other platforms (for instance if the code that was removed is actually working on other platforms), we may enable back this feature. --- .../language/resource.language.de_de/strings.po | 5 ++++- .../language/resource.language.en_gb/strings.po | 5 ++++- .../language/resource.language.fr_fr/strings.po | 10 ++++++++-- service.py | 17 +++++++---------- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/resources/language/resource.language.de_de/strings.po b/resources/language/resource.language.de_de/strings.po index a7ad67e..8199eb0 100644 --- a/resources/language/resource.language.de_de/strings.po +++ b/resources/language/resource.language.de_de/strings.po @@ -216,5 +216,8 @@ msgid "Playback error" msgstr "" msgctxt "#30424" -msgid "When the playback started, the portion of the video that was downloaded was probably not big enough. Do you want to try again to play the video?\n(If this error occurs often you should increase the initial wait time in the settings.)" +msgid "When the playback started, the portion of the video that was downloaded was probably not big enough.\n" +"The video is being downloaded in the backgroud: do you want to stop the download?\n" +"Answer \"no\" if you plan to try again to play the video (but you should wait a few seconds).\n" +"Otherwise answer \"yes\"." msgstr "" diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 338747d..fcdba6e 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -217,5 +217,8 @@ msgid "Playback error" msgstr "" msgctxt "#30424" -msgid "When the playback started, the portion of the video that was downloaded was probably not big enough. Do you want to try again to play the video?\n(If this error occurs often you should increase the initial wait time in the settings.)" +msgid "When the playback started, the portion of the video that was downloaded was probably not big enough.\n" +"The video is being downloaded in the backgroud: do you want to stop the download?\n" +"Answer \"no\" if you plan to try again to play the video (but you should wait a few seconds).\n" +"Otherwise answer \"yes\"." msgstr "" diff --git a/resources/language/resource.language.fr_fr/strings.po b/resources/language/resource.language.fr_fr/strings.po index d4ab11e..8a43947 100644 --- a/resources/language/resource.language.fr_fr/strings.po +++ b/resources/language/resource.language.fr_fr/strings.po @@ -224,5 +224,11 @@ msgid "Playback error" msgstr "Erreur de lecture" msgctxt "#30424" -msgid "When the playback started, the portion of the video that was downloaded was probably not big enough. Do you want to try again to play the video?\n(If this error occurs often you should increase the initial wait time in the settings.)" -msgstr "Quand la lecture a démarré, la portion de la vidéo qui avait été téléchargée était certainement trop petite. Voulez-vous essayer de lire la vidéo à nouveau ?\n(Si cette erreur survient souvent vous devriez augmenter le délai d'attente initial dans les paramètres.)" +msgid "When the playback started, the portion of the video that was downloaded was probably not big enough.\n" +"The video is being downloaded in the backgroud: do you want to stop the download?\n" +"Answer \"no\" if you plan to try again to play the video (but you should wait a few seconds).\n" +"Otherwise answer \"yes\"." +msgstr "Quand la lecture a démarré, la portion de la vidéo qui avait été téléchargée était certainement trop petite.\n" +"La vidéo est en train d'être téléchargée en arrière plan : voulez-vous arrêter le téléchargement ?\n" +"Utilisez \"non\" si vous allez essayer de lire la vidéo de nouveau (mais vous devriez attendre quelques secondes).\n" +"Utilisez \"oui\" sinon." diff --git a/service.py b/service.py index 05f149a..542976d 100644 --- a/service.py +++ b/service.py @@ -51,8 +51,8 @@ class PeertubePlayer(xbmc.Player): any error and it was stopped willingly by the user. In this case we pause the download of the torrent to avoid downloading in background a video which may never be played again. - But if no file was being played, we ask the user if we should try again - to play the file: it supports the use case when the playback started + But if no file was being played, we ask the user if the download should + be paused or not: it supports the use case when the playback started whereas the portion of the file that was downloaded was not big enough. """ # First check if the file that was being played belongs to this add-on @@ -60,9 +60,9 @@ class PeertubePlayer(xbmc.Player): if self.torrent_url is not None: # Then check if the playback actually started: if the playback # didn't start (probably because there was a too small portion of - # the file that was downloaded), do not pause the torrent (Kodi - # do not call onPlayBackError() in this case for some reason...) - # and ask the user what should be done. + # the file that was downloaded), ask the user if the download of + # the torrent should be paused (Kodi do not call onPlayBackError() + # in this case for some reason...). # Otherwise pause the torrent because we consider the user decided # to stop the playback. if self.playback_started: @@ -72,13 +72,10 @@ class PeertubePlayer(xbmc.Player): self.playback_started = False else: self.debug(message="Playback stopped but an error was" - " detected: asking the user what should be" - " done.") + " detected: asking the user if the" + " download must be stopped.") if kodi.open_yes_no_dialog(title=kodi.get_string(30423), message=kodi.get_string(30424)): - self.debug(message="Trying to play the video again...") - self.play(item=self.run_url) - else: self.debug(message="Pausing the download...") self.pause_torrent() self.torrent_url = None