add default sorting to settings

This commit is contained in:
faush01
2020-06-08 19:49:22 +10:00
parent 17ac755e36
commit ea3e7620d8
5 changed files with 75 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.embycon"
name="EmbyCon"
version="1.9.78"
version="1.9.80"
provider-name="Team B">
<requires>
<import addon="xbmc.python" version="2.25.0"/>

View File

@@ -993,3 +993,47 @@ msgstr ""
msgctxt "#30420"
msgid "Audio max channels"
msgstr ""
msgctxt "#30421"
msgid "Views"
msgstr ""
msgctxt "#30422"
msgid "Sorting"
msgstr ""
msgctxt "#30423"
msgid "NotSet"
msgstr ""
msgctxt "#30424"
msgid "Default"
msgstr ""
msgctxt "#30425"
msgid "Year"
msgstr ""
msgctxt "#30426"
msgid "Title"
msgstr ""
msgctxt "#30427"
msgid "Added"
msgstr ""
msgctxt "#30428"
msgid "Rating"
msgstr ""
msgctxt "#30429"
msgid "Genre"
msgstr ""
msgctxt "#30430"
msgid "Label"
msgstr ""
msgctxt "#30431"
msgid "Seasons"
msgstr ""

View File

@@ -191,6 +191,22 @@ def setSort(pluginhandle, viewType, default_sort):
if default_sort == "none":
xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_UNSORTED)
sorting_order_mapping = {
"1": xbmcplugin.SORT_METHOD_UNSORTED,
"2": xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE,
"3": xbmcplugin.SORT_METHOD_VIDEO_YEAR,
"4": xbmcplugin.SORT_METHOD_DATEADDED,
"5": xbmcplugin.SORT_METHOD_GENRE,
"6": xbmcplugin.SORT_METHOD_LABEL,
"7": xbmcplugin.SORT_METHOD_VIDEO_RATING
}
settings = xbmcaddon.Addon()
preset_sort_order = settings.getSetting("sort-" + viewType)
log.debug("SETTING_SORT preset_sort_order: {0}", preset_sort_order)
if preset_sort_order in sorting_order_mapping:
xbmcplugin.addSortMethod(pluginhandle, sorting_order_mapping[preset_sort_order])
if viewType == "BoxSets":
xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE)

View File

@@ -503,6 +503,8 @@ def add_gui_item(url, item_details, display_options, folder=True, default_sort=F
if item_type == 'episode':
info_labels["episode"] = item_details.episode_number
info_labels["season"] = item_details.season_number
info_labels["sortseason"] = item_details.season_number
info_labels["sortepisode"] = item_details.episode_number
info_labels["tvshowtitle"] = item_details.series_name
if item_details.season_number == 0:
item_properties["IsSpecial"] = "true"

View File

@@ -118,11 +118,22 @@
<setting id="suppressErrors" type="bool" label="30315" default="false" visible="true" enable="true" />
</category>
<category label="Default Views">
<category label="30421">
<setting id="view-movies" type="text" label="Movies view ID" default="" visible="true" enable="false" />
<setting id="view-tvshows" type="text" label="TV Shows view ID" default="" visible="true" enable="false" />
<setting id="view-seasons" type="text" label="Seasons view ID" default="" visible="true" enable="false" />
<setting id="view-episodes" type="text" label="Episodes view ID" default="" visible="true" enable="false" />
<setting id="view-sets" type="text" label="Collections view ID" default="" visible="true" enable="false" />
</category>
<category label="30422">
<setting id="sort-Movies" type="select" label="30231" lvalues="30423|30424|30426|30425|30427|30429|30430|30428" default="0" visible="true"/>
<setting id="sort-BoxSets" type="select" label="30260" lvalues="30423|30424|30426|30425|30427|30429|30430|30428" default="0" visible="true"/>
<setting id="sort-Series" type="select" label="30229" lvalues="30423|30424|30426|30425|30427|30429|30430|30428" default="0" visible="true"/>
<setting id="sort-Seasons" type="select" label="30431" lvalues="30423|30424|30426|30425|30427|30429|30430|30428" default="0" visible="true"/>
<setting id="sort-Episodes" type="select" label="30235" lvalues="30423|30424|30426|30425|30427|30429|30430|30428" default="0" visible="true"/>
</category>
</settings>