Fix some issues after testing

* Add a missing space in a string used in the settings
* Fix the slider of the setting `initial_wait_time`
* Fix a bug in service.py (was using a non-existing attribute)
* Omit the second argument of xbmcvfs.File().seek()
* Fix a bug in addon.py when calling seek() (argument must be int)
This commit is contained in:
Thomas Bétous 2021-11-06 17:31:50 +01:00
parent 506f74a9e2
commit 4256198cda
4 changed files with 11 additions and 17 deletions

View File

@ -122,7 +122,7 @@ msgid "Number of seconds in the video to download before starting playback."
" You should adapt this value depending on the power of your machine and the"
" speed of your internet connection."
msgstr "Nombre de secondes dans la vidéo à télécharger avant de lancer la"
"lecture. Vous devriez ajuster cette valeur en fonction de la puissance de"
" lecture. Vous devriez ajuster cette valeur en fonction de la puissance de"
" votre machine et de la vitesse de votre connexion internet."
# -----------------------------------

View File

@ -361,14 +361,12 @@ class PeerTubeAddon():
# before playing the video. It is based on the number of seconds
# configured by the user and the total duration of the video.
initial_chunk_proportion = (int(kodi.get_setting("initial_wait_time"))
* 100. / duration)
# TODO: Remove the dot in 100. in python 3? Or keep it to suport both
# python2 and python3
* 100 / duration)
# Download the file, waiting for "initial_chunk_proportion" % of the
# file to be downloaded (seek() takes only integers so the proportion
# is multiplied to have more granularity.)
if(torrent.seek(initial_chunk_proportion*100, 0) != -1):
if(torrent.seek(int(initial_chunk_proportion*100)) != -1):
# Build the path of the downloaded file
torrent_file = os.path.join(torrent_info["save_path"],
@ -444,4 +442,4 @@ class PeerTubeAddon():
else:
# Display the addon's main menu when the plugin is called from
# Kodi UI without any parameters
self._home_page()
self._home_page()

View File

@ -80,11 +80,9 @@
<level>0</level>
<default>10</default>
<constraints>
<options>
<minimum>0</minimum>
<step>1</step>
<maximum>30</maximum>
</options>
<minimum>0</minimum>
<step>1</step>
<maximum>30</maximum>
</constraints>
<control type="slider" format="integer">
<popup>false</popup>

View File

@ -41,7 +41,7 @@ class PeertubePlayer(xbmc.Player):
# conflict with other add-ons or players.
if self.torrent_url is not None:
self.playback_started = True
self.debug(message="Playback started for {}".format(self.file_name))
self.debug(message="Playback started for {}".format(self.torrent_url))
def onPlayBackStopped(self):
"""Callback called when the playback stops
@ -88,10 +88,8 @@ class PeertubePlayer(xbmc.Player):
"""Pause download of the torrent self.torrent_url"""
# Get the torrent handle
torrent = xbmcvfs.File(self.torrent_url)
# Call seek() with -1 to pause the torrent. 0 is used as second argument
# so that GetLength() is not called.
# TODO: ommit the second argument on Matrix
torrent.seek(-1, 0)
# Call seek() with -1 to pause the torrent.
torrent.seek(-1)
def update_torrent_info(self, data):
"""Save the information about the torrent being played currently
@ -155,4 +153,4 @@ if __name__ == "__main__":
service = PeertubeService()
# Start the service
service.run()
service.run()