Miglioria nella selezione della numerazione alternativa di TMDB

This commit is contained in:
Alhaziel01
2021-03-06 18:55:10 +01:00
parent c9127de030
commit 5070e32d65
3 changed files with 42 additions and 50 deletions
+4 -6
View File
@@ -565,16 +565,14 @@ def select_group(groups, item):
selected = -1 selected = -1
url = 'https://api.themoviedb.org/3/tv/{}?api_key=a1ab8b8669da03637a4b98fa39c39228&language={}'.format(item.infoLabels['tmdb_id'], def_lang) url = 'https://api.themoviedb.org/3/tv/{}?api_key=a1ab8b8669da03637a4b98fa39c39228&language={}'.format(item.infoLabels['tmdb_id'], def_lang)
res = requests.get(url).json() res = requests.get(url).json()
selections = ['[B]Original[/B] Seasons: {} Episodes: {}'.format(res.get('number_of_seasons',0), res.get('number_of_episodes',0))] selections = [['Original',res.get('number_of_seasons',0), res.get('number_of_episodes',0), '', item.thumbnail]]
ids = ['original'] ids = ['original']
for group in groups: for group in groups:
name = '[B]{}[/B] Seasons: {} Episodes: {}'.format(group.get('name',''), group.get('group_count',0), group.get('episode_count',0)) # name = '{} Seasons: {} Episodes: {}'.format(group.get('name',''), group.get('group_count',0), group.get('episode_count',0))
description = group.get('description','') # description = group.get('description','')
if description:
name = '{}\n{}'.format(name, description)
ID = group.get('id','') ID = group.get('id','')
if ID: if ID:
selections.append(name) selections.append([group.get('name',''), group.get('group_count',0), group.get('episode_count',0), group.get('description',''), item.thumbnail])
ids.append(ID) ids.append(ID)
if selections and ids: if selections and ids:
selected = platformtools.dialog_select_group(config.get_localized_string(70831), selections) selected = platformtools.dialog_select_group(config.get_localized_string(70831), selections)
+7 -3
View File
@@ -239,9 +239,14 @@ def dialog_select_group(heading, _list, preselect=0):
def onInit(self): def onInit(self):
self.getControl(1).setText(self.heading) self.getControl(1).setText(self.heading)
itemlist = [] itemlist = []
for n, text in enumerate(self.list): for n, it in enumerate(self.list):
logger.debug(it)
item = xbmcgui.ListItem(str(n)) item = xbmcgui.ListItem(str(n))
item.setProperty('title', text) item.setProperty('title', it[0])
item.setProperty('seasons', str(it[1]))
item.setProperty('episodes', str(it[2]))
item.setProperty('description', '\n' + it[3])
item.setProperty('thumb', it[4])
itemlist.append(item) itemlist.append(item)
self.getControl(2).addItems(itemlist) self.getControl(2).addItems(itemlist)
@@ -496,7 +501,6 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
2. Adding options according to criteria 2. Adding options according to criteria
Options can be added to the context menu to items that meet certain conditions. Options can be added to the context menu to items that meet certain conditions.
3. Adding options to all items 3. Adding options to all items
Options can be added to the context menu for all items Options can be added to the context menu for all items
+31 -41
View File
@@ -12,9 +12,9 @@
<controls> <controls>
<control type="group"> <control type="group">
<description>Container</description> <description>Container</description>
<left>200</left> <left>40</left>
<top>60</top> <top>60</top>
<width>860</width> <width>1200</width>
<height>600</height> <height>600</height>
<control type="image"> <control type="image">
<description>Background</description> <description>Background</description>
@@ -22,49 +22,56 @@
<height>100%</height> <height>100%</height>
<texture colordiffuse="FF232323">white.png</texture> <texture colordiffuse="FF232323">white.png</texture>
</control> </control>
<control type="image">
<description>Poster</description>
<top>0</top>
<left>0</left>
<height>600</height>
<width>400</width>
<texture>$INFO[Container(2).ListItem.Property(thumb)]</texture>
</control>
<control type="textbox" id="1"> <control type="textbox" id="1">
<description>Heading</description> <description>Heading</description>
<top>0</top> <top>0</top>
<left>0</left> <left>460</left>
<height>60</height> <height>80</height>
<width>100%</width> <width>680</width>
<font>font13</font> <font>font13</font>
<textcolor>FFFFFFFF</textcolor> <textcolor>FFFFFFFF</textcolor>
<align>center</align> <align>left</align>
<aligny>center</aligny> <aligny>center</aligny>
<label></label> <label></label>
</control> </control>
<control type="group"> <control type="group">
<left>30</left> <left>440</left>
<top>70</top> <top>80</top>
<width>795</width> <width>720</width>
<height>530</height> <height>480</height>
<control type="list" id="2"> <control type="list" id="2">
<description>List</description> <description>List</description>
<left>0</left> <left>0</left>
<top>0</top> <top>0</top>
<width>795</width> <width>720</width>
<height>530</height> <height>530</height>
<onup>100</onup> <onup>100</onup>
<onright>4</onright> <onright>4</onright>
<orientation>vertical</orientation> <orientation>vertical</orientation>
<scrolltime>200</scrolltime> <scrolltime>200</scrolltime>
<pagecontrol>4</pagecontrol> <itemlayout height="60" width="720">
<itemlayout height="150" width="795">
<control type="textbox"> <control type="textbox">
<description>Selected Item</description> <description>Selected Item</description>
<left>20</left> <left>20</left>
<top>20</top> <top>0</top>
<width>765</width> <width>680</width>
<height>110</height> <height>60</height>
<font>font13</font> <font>font13</font>
<textcolor>FFFFFFFF</textcolor> <textcolor>FFFFFFFF</textcolor>
<label>$INFO[ListItem.Property(title)]</label> <label>[B]$INFO[ListItem.Property(title)][/B] $ADDON[plugin.video.kod 30140]: $INFO[ListItem.Property(seasons)] $ADDON[plugin.video.kod 70362]: $INFO[ListItem.Property(episodes)]</label>
<align>center</align> <align>left</align>
<aligny>center</aligny> <aligny>center</aligny>
</control> </control>
</itemlayout> </itemlayout>
<focusedlayout height="150" width="795"> <focusedlayout height="200" width="720">
<control type="image"> <control type="image">
<top>1</top> <top>1</top>
<width>100%</width> <width>100%</width>
@@ -75,39 +82,22 @@
<description>Selected Item</description> <description>Selected Item</description>
<left>20</left> <left>20</left>
<top>20</top> <top>20</top>
<width>765</width> <width>680</width>
<height>110</height> <height>160</height>
<font>font13</font> <font>font13</font>
<textcolor>FFFFFFFF</textcolor> <textcolor>FFFFFFFF</textcolor>
<label>$INFO[ListItem.Property(title)]</label> <label>[B]$INFO[ListItem.Property(title)][/B] $ADDON[plugin.video.kod 30140]: $INFO[ListItem.Property(seasons)] $ADDON[plugin.video.kod 70362]: $INFO[ListItem.Property(episodes)]$INFO[ListItem.Property(description)]</label>
<autoscroll time="3000" delay="3000" repeat="3000">True</autoscroll> <autoscroll time="3000" delay="3000" repeat="3000">True</autoscroll>
<align>center</align> <align>left</align>
<aligny>center</aligny> <aligny>center</aligny>
</control> </control>
</focusedlayout> </focusedlayout>
</control> </control>
<control type="scrollbar" id="4">
<description>Scrollbar</description>
<left>800</left>
<top>0</top>
<width>5</width>
<height>470</height>
<visible>true</visible>
<texturesliderbackground colordiffuse="FF232323">white.png</texturesliderbackground>
<texturesliderbar colordiffuse="FFFFFFFF">white.png</texturesliderbar>
<texturesliderbarfocus colordiffuse="FF0081C2">white.png</texturesliderbarfocus>
<textureslidernib colordiffuse="FFFFFFFF">white.png</textureslidernib>
<textureslidernibfocus colordiffuse="FFFFFFFF">white.png</textureslidernibfocus>
<orientation>vertical</orientation>
<showonepage>false</showonepage>
<onleft>2</onleft>
<onright>3</onright>
</control>
</control> </control>
<control type="button" id="100"> <control type="button" id="100">
<description>Close Button</description> <description>Close Button</description>
<right>20</right> <right>20</right>
<top>10</top> <top>20</top>
<width>40</width> <width>40</width>
<height>40</height> <height>40</height>
<texturefocus colordiffuse="FFFFFFFF">close.png</texturefocus> <texturefocus colordiffuse="FFFFFFFF">close.png</texturefocus>