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:
parent
506f74a9e2
commit
4256198cda
|
@ -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"
|
" You should adapt this value depending on the power of your machine and the"
|
||||||
" speed of your internet connection."
|
" speed of your internet connection."
|
||||||
msgstr "Nombre de secondes dans la vidéo à télécharger avant de lancer la"
|
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."
|
" votre machine et de la vitesse de votre connexion internet."
|
||||||
|
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
|
|
|
@ -361,14 +361,12 @@ class PeerTubeAddon():
|
||||||
# before playing the video. It is based on the number of seconds
|
# before playing the video. It is based on the number of seconds
|
||||||
# configured by the user and the total duration of the video.
|
# configured by the user and the total duration of the video.
|
||||||
initial_chunk_proportion = (int(kodi.get_setting("initial_wait_time"))
|
initial_chunk_proportion = (int(kodi.get_setting("initial_wait_time"))
|
||||||
* 100. / duration)
|
* 100 / duration)
|
||||||
# TODO: Remove the dot in 100. in python 3? Or keep it to suport both
|
|
||||||
# python2 and python3
|
|
||||||
|
|
||||||
# Download the file, waiting for "initial_chunk_proportion" % of the
|
# Download the file, waiting for "initial_chunk_proportion" % of the
|
||||||
# file to be downloaded (seek() takes only integers so the proportion
|
# file to be downloaded (seek() takes only integers so the proportion
|
||||||
# is multiplied to have more granularity.)
|
# 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
|
# Build the path of the downloaded file
|
||||||
torrent_file = os.path.join(torrent_info["save_path"],
|
torrent_file = os.path.join(torrent_info["save_path"],
|
||||||
|
@ -444,4 +442,4 @@ class PeerTubeAddon():
|
||||||
else:
|
else:
|
||||||
# Display the addon's main menu when the plugin is called from
|
# Display the addon's main menu when the plugin is called from
|
||||||
# Kodi UI without any parameters
|
# Kodi UI without any parameters
|
||||||
self._home_page()
|
self._home_page()
|
||||||
|
|
|
@ -80,11 +80,9 @@
|
||||||
<level>0</level>
|
<level>0</level>
|
||||||
<default>10</default>
|
<default>10</default>
|
||||||
<constraints>
|
<constraints>
|
||||||
<options>
|
<minimum>0</minimum>
|
||||||
<minimum>0</minimum>
|
<step>1</step>
|
||||||
<step>1</step>
|
<maximum>30</maximum>
|
||||||
<maximum>30</maximum>
|
|
||||||
</options>
|
|
||||||
</constraints>
|
</constraints>
|
||||||
<control type="slider" format="integer">
|
<control type="slider" format="integer">
|
||||||
<popup>false</popup>
|
<popup>false</popup>
|
||||||
|
|
10
service.py
10
service.py
|
@ -41,7 +41,7 @@ class PeertubePlayer(xbmc.Player):
|
||||||
# conflict with other add-ons or players.
|
# conflict with other add-ons or players.
|
||||||
if self.torrent_url is not None:
|
if self.torrent_url is not None:
|
||||||
self.playback_started = True
|
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):
|
def onPlayBackStopped(self):
|
||||||
"""Callback called when the playback stops
|
"""Callback called when the playback stops
|
||||||
|
@ -88,10 +88,8 @@ class PeertubePlayer(xbmc.Player):
|
||||||
"""Pause download of the torrent self.torrent_url"""
|
"""Pause download of the torrent self.torrent_url"""
|
||||||
# Get the torrent handle
|
# Get the torrent handle
|
||||||
torrent = xbmcvfs.File(self.torrent_url)
|
torrent = xbmcvfs.File(self.torrent_url)
|
||||||
# Call seek() with -1 to pause the torrent. 0 is used as second argument
|
# Call seek() with -1 to pause the torrent.
|
||||||
# so that GetLength() is not called.
|
torrent.seek(-1)
|
||||||
# TODO: ommit the second argument on Matrix
|
|
||||||
torrent.seek(-1, 0)
|
|
||||||
|
|
||||||
def update_torrent_info(self, data):
|
def update_torrent_info(self, data):
|
||||||
"""Save the information about the torrent being played currently
|
"""Save the information about the torrent being played currently
|
||||||
|
@ -155,4 +153,4 @@ if __name__ == "__main__":
|
||||||
service = PeertubeService()
|
service = PeertubeService()
|
||||||
|
|
||||||
# Start the service
|
# Start the service
|
||||||
service.run()
|
service.run()
|
||||||
|
|
Loading…
Reference in New Issue