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.
This commit is contained in:
Thomas 2021-04-28 21:02:24 +00:00
parent d87f3038d9
commit cb1825c1f9
5 changed files with 16 additions and 1 deletions

View File

@ -23,7 +23,10 @@ If you want to contribute, please start with the
# User settings
* Preferred PeerTube instance
* Preferred PeerTube instance
* Display (or not) a notification when the service starts: the notification
lets the user know that the videos can be played which may be useful on slow
devices (when the service takes some time to start)
* Browsing/Searching:
* Number of items to show per page (max 100)
* Field used to sort items when listing/searching videos:

View File

@ -67,3 +67,7 @@ msgstr ""
msgctxt "#30012"
msgid "views"
msgstr ""
msgctxt "#30013"
msgid "Display a notification when the service starts"
msgstr ""

View File

@ -67,3 +67,7 @@ msgstr "nombre de j'aime"
msgctxt "#30012"
msgid "views"
msgstr "nombre de vues"
msgctxt "#30013"
msgid "Display a notification when the service starts"
msgstr "Afficher une notification au démarrage du service"

View File

@ -2,6 +2,7 @@
<settings>
<category label="30006">
<setting id="preferred_instance" type="text" default="framatube.org" label="30000"/>
<setting id="service_start_notif" label="30013" type="bool" default="true"/>
<setting label="30007" type="lsep"/>
<setting id="items_per_page" type="select" values="10|20|50|100" default="20" label="30001"/>
<setting id="video_sort_method" type="select" lvalues="30011|30012" default=1 label="30002"/>

View File

@ -128,6 +128,9 @@ class PeertubeService():
# Monitor Kodi's shutdown signal
self.debug("Service started, waiting for signals")
if kodi.get_setting("service_start_notif") == "true":
kodi.notif_info(title="PeerTube service started",
message="Torrents can now be downloaded.")
monitor = xbmc.Monitor()
while not monitor.abortRequested():
if monitor.waitForAbort(1):