Commit Graph

8 Commits

Author SHA1 Message Date
Thomas Bétous 89675dfb30 Support better initial download of big videos
In this commit, the new version of vfs.libtorrent is used which
replaces `write()` entirely with `seek()`. Now the size of the
initial chunk that will be downloaded before playback starts is
not defined anymore in vfs.libtorrent, but passed as argument
to `seek()`.
It is quite hard to define how much of a video must be downloaded
before starting the playback because most of the time the chosen
value works great for short videos but not for long videos. It
was decided to define this size based on the duration rather
than on the size of the file. Consequently the user can now
configure in the settings of the add-on of many "seconds" of the
video must be downloaded before the playback starts.

As the configured values is likely to not work properly on all
machines (espcially slow ones), a strategy was implemented to
detect when the playback fails to start because the amount of
the video that was downloaded is not big enough. When it occurs
the user has the choice to try again to play the video or not.
This use case is detected with a combination of the callbacks
`onPlayBackStopped()` and `onAVStarted()` (using
`onPlayBackError()` would have been easier but for some
reason it is not called in this case).

Other changes:
* refactor the play_video action
* clean-up strings and variables that were not used
2021-11-01 15:15:22 +01:00
Thomas Bétous 1ebb06d271 Pause download when playback stops
Use the add-on's service to monitor when the playback is stopped.
When it occurs, the download of the torrent is paused to have a
behavior similar to streaming.

To be able to pause the torrent, the service needs to use the
torrent handle. The torrent handle is recreated on the service-side
using the URL that was sent to vfs.libtorrent. This URL is sent to
the service before the playback starts using the AddonSignals.
Calling `xbmcvfs.File()` on existing torrent is fast enough for this
solution to be used even on slow devices.
2021-10-10 22:10:43 +02:00
Thomas Bétous 5eb7a46f34 Use the new JSON string returned by read()
* Adapt the code for the new information returned by read()
* Display a warning if there are more than 1 file in the torrent
  because the add-on will play only the first file
* Manage the error use case when calling write()
* Remove the "start downloading" notification since an equivalent
  message is now displayed by vfs.libtorrent
2021-09-27 17:32:14 +02:00
Thomas 7297f8cef0 Various small updates before releasing v1.1
* Remove empty tags in addon.xml and add a disclaimer
* Update the description of the add-on in addon.xml
* Move icon.png into the "resources" folder to match Kodi guidelines (a
  solid white background is added automatically by Kodi so the icon was
  modified with a white background to avoid unexpected display and to
  match Kodi guidelines)
* Improve the translation guidelines
* Add a missing dot in a localized string
2021-04-30 16:35:20 +00:00
Thomas 134d2ea974 Localize and translate into French the add-on
* Localize all the strings so that the whole add-on can be translated
  (menus, notifications, etc.)
* Translate all the strings into French
* Add advice for future translators in the contribution guidelines
* List the supported languages in the README and a link to the
  translation guidelines
* Rearrange the parts of the README to have the most used information at
  the top
2021-04-29 20:38:14 +00:00
Thomas cb1825c1f9 Notify the user when the service started
Display a notification when the PeerTube service started so that the
user is aware that the add-on can be used.
This notification will be useful especially on slow devices.

The notification can be disabled in the settings.
2021-04-28 21:02:24 +00:00
Thomas 13186dc697 Improve the settings layout and translation
* Turn the name of the main category of the settings into a localized
  string
* Add separators to group settings per theme
* Make some settings name more explicit
* Translate the possible values of the settings video_filter and
  video_sort_method

See merge request StCyr/plugin.video.peertube!20 for more information
2021-04-27 20:24:24 +00:00
DavidHenryThoreau ed39c453e9 Add French translation 2021-04-22 21:02:40 +00:00