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
This commit is contained in:
parent
50a886d8cd
commit
13186dc697
22
README.md
22
README.md
|
@ -24,15 +24,19 @@ If you want to contribute, please start with the
|
||||||
# User settings
|
# User settings
|
||||||
|
|
||||||
* Preferred PeerTube instance
|
* Preferred PeerTube instance
|
||||||
* Preferred video resolution
|
* Browsing/Searching:
|
||||||
* Number of items to display per page
|
* Number of items to show per page (max 100)
|
||||||
* Value used to sort items when listing/searching videos:
|
* Field used to sort items when listing/searching videos:
|
||||||
* `views`: sort by number of views (ascending only)
|
* `views`: sort by number of views (ascending only)
|
||||||
* `likes`: sort by number of likes (ascending only)
|
* `likes`: sort by number of likes (ascending only)
|
||||||
* Select the filter to use when browsing the videos on an instance:
|
* Select the filter to use when browsing and searching the videos on an instance:
|
||||||
* local will only display the videos which are local to the selected instance
|
* `local` will only display the videos which are local to the selected
|
||||||
* all-local will only display the videos which are local to the selected
|
instance
|
||||||
instance plus the private and unlisted videos **(requires admin privileges)**
|
* `all-local` will only display the videos which are local to the selected
|
||||||
|
instance **plus** the private and unlisted videos
|
||||||
|
**(requires admin privileges)**
|
||||||
|
* Video playback:
|
||||||
|
* Preferred video resolution
|
||||||
|
|
||||||
# API
|
# API
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,11 @@ msgid "Preferred instance"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#30001"
|
msgctxt "#30001"
|
||||||
msgid "Number of videos to show per page"
|
msgid "Number of items to show per page"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#30002"
|
msgctxt "#30002"
|
||||||
msgid "Sort method to be used when listing videos"
|
msgid "Sort videos by"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#30003"
|
msgctxt "#30003"
|
||||||
|
@ -37,5 +37,33 @@ msgstr ""
|
||||||
#msgstr ""
|
#msgstr ""
|
||||||
|
|
||||||
msgctxt "#30005"
|
msgctxt "#30005"
|
||||||
msgid "Filter local or all videos (for browsing only)"
|
msgid "List only videos with scope"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#30006"
|
||||||
|
msgid "General"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#30007"
|
||||||
|
msgid "Browsing/Searching"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#30008"
|
||||||
|
msgid "Video playback"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#30009"
|
||||||
|
msgid "local"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#30010"
|
||||||
|
msgid "all-local (admins only)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#30011"
|
||||||
|
msgid "likes"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#30012"
|
||||||
|
msgid "views"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
@ -6,7 +6,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Kodi Addons\n"
|
"Project-Id-Version: Kodi Addons\n"
|
||||||
"Report-Msgid-Bugs-To: https://framagit.org/StCyr/plugin.video.peertube\n"
|
"Report-Msgid-Bugs-To: https://framagit.org/StCyr/plugin.video.peertube\n"
|
||||||
"Last-Translator: DavidHenryThoreau\n"
|
"Last-Translator: Thomas B.\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
@ -21,12 +21,12 @@ msgid "Preferred instance"
|
||||||
msgstr "Instance préférée"
|
msgstr "Instance préférée"
|
||||||
|
|
||||||
msgctxt "#30001"
|
msgctxt "#30001"
|
||||||
msgid "Number of videos to show per page"
|
msgid "Number of items to show per page"
|
||||||
msgstr "Nombre de vidéos à afficher par page"
|
msgstr "Nombre d'éléments à afficher par page"
|
||||||
|
|
||||||
msgctxt "#30002"
|
msgctxt "#30002"
|
||||||
msgid "Sort method to be used when listing videos"
|
msgid "Sort videos by"
|
||||||
msgstr "Méthode de tri pour lister les vidéos"
|
msgstr "Trier les vidéos par"
|
||||||
|
|
||||||
msgctxt "#30003"
|
msgctxt "#30003"
|
||||||
msgid "Preferred video resolution"
|
msgid "Preferred video resolution"
|
||||||
|
@ -37,5 +37,33 @@ msgstr "Résolution vidéo préférée"
|
||||||
#msgstr "Supprimer les vidéos téléchargées à la fermeture de Kodi"
|
#msgstr "Supprimer les vidéos téléchargées à la fermeture de Kodi"
|
||||||
|
|
||||||
msgctxt "#30005"
|
msgctxt "#30005"
|
||||||
msgid "Filter local or all videos (for browsing only)"
|
msgid "List only videos with scope"
|
||||||
msgstr "Filtre local ou toutes les vidéos (pour la navigation seulement)"
|
msgstr "Afficher uniquement les vidéos de type"
|
||||||
|
|
||||||
|
msgctxt "#30006"
|
||||||
|
msgid "General"
|
||||||
|
msgstr "Général"
|
||||||
|
|
||||||
|
msgctxt "#30007"
|
||||||
|
msgid "Browsing/Searching"
|
||||||
|
msgstr "Navigation/Recherche"
|
||||||
|
|
||||||
|
msgctxt "#30008"
|
||||||
|
msgid "Video playback"
|
||||||
|
msgstr "Lecture"
|
||||||
|
|
||||||
|
msgctxt "#30009"
|
||||||
|
msgid "local"
|
||||||
|
msgstr "local"
|
||||||
|
|
||||||
|
msgctxt "#30010"
|
||||||
|
msgid "all-local (admins only)"
|
||||||
|
msgstr "all-local (admins seulement)"
|
||||||
|
|
||||||
|
msgctxt "#30011"
|
||||||
|
msgid "likes"
|
||||||
|
msgstr "nombre de j'aime"
|
||||||
|
|
||||||
|
msgctxt "#30012"
|
||||||
|
msgid "views"
|
||||||
|
msgstr "nombre de vues"
|
||||||
|
|
|
@ -49,9 +49,7 @@ class PeerTubeAddon():
|
||||||
# only by this object are directly retrieved from the settings
|
# only by this object are directly retrieved from the settings
|
||||||
self.peertube = PeerTube(
|
self.peertube = PeerTube(
|
||||||
instance=kodi.get_setting("preferred_instance"),
|
instance=kodi.get_setting("preferred_instance"),
|
||||||
count=self.items_per_page,
|
count=self.items_per_page)
|
||||||
sort=kodi.get_setting("video_sort_method"),
|
|
||||||
video_filter=kodi.get_setting("video_filter"))
|
|
||||||
|
|
||||||
def _browse_videos(self, start):
|
def _browse_videos(self, start):
|
||||||
"""Display the list of all the videos published on a PeerTube instance
|
"""Display the list of all the videos published on a PeerTube instance
|
||||||
|
|
|
@ -17,27 +17,23 @@ from resources.lib.kodi_utils import kodi
|
||||||
class PeerTube:
|
class PeerTube:
|
||||||
"""A class to interact easily with PeerTube instances using REST APIs"""
|
"""A class to interact easily with PeerTube instances using REST APIs"""
|
||||||
|
|
||||||
def __init__(self, instance, sort, count, video_filter):
|
def __init__(self, instance, count):
|
||||||
"""Constructor
|
"""Initialize the parameters that will be used in the requests
|
||||||
|
|
||||||
|
Some values are retrieved directly from the settings, others come as
|
||||||
|
arguments because they are used somewhere else in the add-on.
|
||||||
|
|
||||||
:param str instance: URL of the PeerTube instance
|
:param str instance: URL of the PeerTube instance
|
||||||
:param str sort: sort method to use when listing items
|
|
||||||
:param int count: number of items to display
|
:param int count: number of items to display
|
||||||
:param str video_filter: filter to apply when listing/searching videos
|
|
||||||
"""
|
"""
|
||||||
self.set_instance(instance)
|
self.set_instance(instance)
|
||||||
|
|
||||||
self.list_settings = {
|
self.list_settings = {
|
||||||
"sort": sort,
|
"sort": self._get_sort_method(),
|
||||||
"count": count
|
"count": count
|
||||||
}
|
}
|
||||||
|
|
||||||
# The value "video_filter" is directly retrieved from the settings so
|
self.filter = self._get_video_filter()
|
||||||
# it must be converted into one of the expected values by the REST APIs
|
|
||||||
if "all-local" in video_filter:
|
|
||||||
self.filter = "all-local"
|
|
||||||
else:
|
|
||||||
self.filter = "local"
|
|
||||||
|
|
||||||
def _request(self, method, url, params=None, data=None, instance=None):
|
def _request(self, method, url, params=None, data=None, instance=None):
|
||||||
"""Call a REST API on the instance
|
"""Call a REST API on the instance
|
||||||
|
@ -117,6 +113,32 @@ class PeerTube:
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
def _get_video_filter(self):
|
||||||
|
"""Get the video filter from the settings
|
||||||
|
|
||||||
|
The value of the associated setting is localized so a list is used to
|
||||||
|
get the value expected by the API based on the index of the value used.
|
||||||
|
|
||||||
|
:return: value of the video_filter setting
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
|
||||||
|
filters = ["local", "all-local"]
|
||||||
|
return filters[int(kodi.get_setting("video_filter"))]
|
||||||
|
|
||||||
|
def _get_sort_method(self):
|
||||||
|
"""Get the sort method from the settings
|
||||||
|
|
||||||
|
The value of the associated setting is localized so a list is used to
|
||||||
|
get the value expected by the API based on the index of the value used.
|
||||||
|
|
||||||
|
:return: value of the video_sort_method setting
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
|
||||||
|
sort_methods = ["likes", "views"]
|
||||||
|
return sort_methods[int(kodi.get_setting("video_sort_method"))]
|
||||||
|
|
||||||
def get_video_urls(self, video_id, instance=None):
|
def get_video_urls(self, video_id, instance=None):
|
||||||
"""Return the URLs of a video
|
"""Return the URLs of a video
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||||
<settings>
|
<settings>
|
||||||
<setting id="preferred_instance" type="text" default="framatube.org" label="30000"/>
|
<category label="30006">
|
||||||
<setting type="sep"/>
|
<setting id="preferred_instance" type="text" default="framatube.org" label="30000"/>
|
||||||
<setting id="items_per_page" type="select" values="10|20|50|100" default="20" label="30001"/>
|
<setting label="30007" type="lsep"/>
|
||||||
<setting id="video_sort_method" type="select" values="likes|views" default='views' label="30002"/>
|
<setting id="items_per_page" type="select" values="10|20|50|100" default="20" label="30001"/>
|
||||||
<setting id="preferred_resolution" type="select" values="1080|720|480|360|240" default='480' label="30003"/>
|
<setting id="video_sort_method" type="select" lvalues="30011|30012" default=1 label="30002"/>
|
||||||
<setting type="sep"/>
|
<setting id="video_filter" type="select" lvalues="30009|30010" default="0" label="30005"/>
|
||||||
<!--<setting id="delete_files" type="bool" default="true" label="30004"/>-->
|
<setting label="30008" type="lsep"/>
|
||||||
<setting id="video_filter" type="select" values="local|all-local (requires admin privileges)" default="local" label="30005"/>
|
<setting id="preferred_resolution" type="select" values="1080|720|480|360|240" default='480' label="30003"/>
|
||||||
|
<!--<setting id="delete_files" type="bool" default="true" label="30004"/>-->
|
||||||
|
</category>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
Loading…
Reference in New Issue