Merge pull request #809 from croneter/cleanup

Cleanup code, remove some obsolet methods and functions
This commit is contained in:
croneter 2019-03-30 17:50:11 +01:00 committed by GitHub
commit d5a7bab8db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1694,96 +1694,6 @@ class API(object):
pass pass
return listitem return listitem
def _create_folder_listitem(self, listitem=None):
"""
Use for video items only
Call on a child level of PMS xml response (e.g. in a for loop)
listitem : existing xbmcgui.ListItem to work with
otherwise, a new one is created
append_show_title : True to append TV show title to episode title
append_sxxexx : True to append SxxExx to episode title
Returns XBMC listitem for this PMS library item
"""
title = self.title()
typus = self.plex_type()
if listitem is None:
listitem = ListItem(title)
else:
listitem.setLabel(title)
# Necessary; Kodi won't start video otherwise!
listitem.setProperty('IsPlayable', 'true')
# Video items, e.g. movies and episodes or clips
people = self.people()
userdata = self.userdata()
metadata = {
'genre': self.genre_list(),
'country': self.country_list(),
'year': self.year(),
'rating': self.audience_rating(),
'playcount': userdata['PlayCount'],
'cast': people['Cast'],
'director': people['Director'],
'plot': self.plot(),
'sorttitle': self.sorttitle(),
'duration': userdata['Runtime'],
'studio': self.music_studio_list(),
'tagline': self.tagline(),
'writer': people.get('Writer'),
'premiered': self.premiere_date(),
'dateadded': self.date_created(),
'lastplayed': userdata['LastPlayedDate'],
'mpaa': self.content_rating(),
'aired': self.premiere_date(),
}
# Do NOT set resumetime - otherwise Kodi always resumes at that time
# even if the user chose to start element from the beginning
# listitem.setProperty('resumetime', str(userdata['Resume']))
listitem.setProperty('totaltime', str(userdata['Runtime']))
if typus == v.PLEX_TYPE_EPISODE:
metadata['mediatype'] = 'episode'
_, _, show, season, episode = self.episode_data()
season = -1 if season is None else int(season)
episode = -1 if episode is None else int(episode)
metadata['episode'] = episode
metadata['sortepisode'] = episode
metadata['season'] = season
metadata['sortseason'] = season
metadata['tvshowtitle'] = show
if season and episode:
if append_sxxexx is True:
title = "S%.2dE%.2d - %s" % (season, episode, title)
if append_show_title is True:
title = "%s - %s " % (show, title)
if append_show_title or append_sxxexx:
listitem.setLabel(title)
elif typus == v.PLEX_TYPE_MOVIE:
metadata['mediatype'] = 'movie'
else:
# E.g. clips, trailers, ...
pass
plex_id = self.plex_id()
listitem.setProperty('plexid', str(plex_id))
with PlexDB() as plexdb:
db_item = plexdb.item_by_id(plex_id, self.plex_type())
if db_item:
metadata['dbid'] = db_item['kodi_id']
metadata['title'] = title
# Expensive operation
listitem.setInfo('video', infoLabels=metadata)
try:
# Add context menu entry for information screen
listitem.addContextMenuItems([(utils.lang(30032),
'XBMC.Action(Info)',)])
except TypeError:
# Kodi fuck-up
pass
return listitem
def disc_number(self): def disc_number(self):
""" """
Returns the song's disc number as an int or None if not found Returns the song's disc number as an int or None if not found
@ -1928,13 +1838,3 @@ class API(object):
# Kodi cannot locate the file #s. Please verify your PKC settings. Stop # Kodi cannot locate the file #s. Please verify your PKC settings. Stop
# syncing? # syncing?
return utils.yesno_dialog(utils.lang(29999), utils.lang(39031) % url) return utils.yesno_dialog(utils.lang(29999), utils.lang(39031) % url)
@staticmethod
def _set_listitem_artprop(listitem, arttype, path):
if arttype in (
'thumb', 'fanart_image', 'small_poster', 'tiny_poster',
'medium_landscape', 'medium_poster', 'small_fanartimage',
'medium_fanartimage', 'fanart_noindicators'):
listitem.setProperty(arttype, path)
else:
listitem.setArt({arttype: path})