Browse Source

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.
vfs-libtorrent-plus-matrix
Thomas Bétous 1 year ago
parent
commit
efe953d6a5
  1. 5
      resources/language/resource.language.de_de/strings.po
  2. 5
      resources/language/resource.language.en_gb/strings.po
  3. 10
      resources/language/resource.language.fr_fr/strings.po
  4. 17
      service.py

5
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 ""

5
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 ""

10
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."

17
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

Loading…
Cancel
Save