Don't cast to unicode
This commit is contained in:
parent
0dfcebbee3
commit
60f7d0fce2
4 changed files with 12 additions and 14 deletions
|
@ -122,9 +122,9 @@ class FullSync(backgroundthread.KillableThread, common.libsync_mixin):
|
|||
queue_info = process_metadata.InitNewSection(
|
||||
self.context,
|
||||
utils.cast(int, iterator.get('totalSize', 0)),
|
||||
utils.cast(unicode, iterator.get('librarySectionTitle')),
|
||||
iterator.get('librarySectionTitle'),
|
||||
section['section_id'],
|
||||
utils.cast(unicode, section['plex_type']))
|
||||
section['plex_type'])
|
||||
self.queue.put(queue_info)
|
||||
for xml_item in iterator:
|
||||
if self.isCanceled():
|
||||
|
|
|
@ -103,8 +103,7 @@ class ProcessMetadata(backgroundthread.KillableThread, common.libsync_mixin):
|
|||
notify=True,
|
||||
cancel_sync=True)
|
||||
if self.current % 20 == 0:
|
||||
self.title = utils.cast(unicode,
|
||||
item['xml'][0].get('title'))
|
||||
self.title = item['xml'][0].get('title')
|
||||
self.update()
|
||||
self.current += 1
|
||||
self.queue.task_done()
|
||||
|
|
|
@ -48,8 +48,7 @@ def sync_from_pms():
|
|||
if (section.attrib['type'] in
|
||||
(v.PLEX_TYPE_MOVIE, v.PLEX_TYPE_SHOW, v.PLEX_TYPE_PHOTO,
|
||||
v.PLEX_TYPE_ARTIST)):
|
||||
sorted_sections.append(cast(unicode,
|
||||
section.attrib['title']))
|
||||
sorted_sections.append(section.attrib['title'])
|
||||
LOG.debug('Sorted sections: %s', sorted_sections)
|
||||
totalnodes = len(sorted_sections)
|
||||
|
||||
|
@ -81,14 +80,14 @@ def sync_from_pms():
|
|||
def _process_section(section_xml, kodi_db, plexdb, sorted_sections,
|
||||
old_sections, totalnodes):
|
||||
folder = section_xml.attrib
|
||||
plex_type = cast(unicode, folder['type'])
|
||||
plex_type = folder['type']
|
||||
# Only process supported formats
|
||||
if plex_type not in (v.PLEX_TYPE_MOVIE, v.PLEX_TYPE_SHOW,
|
||||
v.PLEX_TYPE_ARTIST, v.PLEX_TYPE_PHOTO):
|
||||
LOG.error('Unsupported Plex section type: %s', folder)
|
||||
return totalnodes
|
||||
section_id = cast(int, folder['key'])
|
||||
section_name = cast(unicode, folder['title'])
|
||||
section_name = folder['title']
|
||||
global PLAYLISTS, NODES
|
||||
# Prevent duplicate for nodes of the same type
|
||||
nodes = NODES[plex_type]
|
||||
|
|
|
@ -482,14 +482,14 @@ class API(object):
|
|||
"""
|
||||
Returns the title of the element as unicode or 'Missing Title Name'
|
||||
"""
|
||||
return cast(unicode, self.item.get('title', 'Missing Title Name'))
|
||||
return self.item.get('title', 'Missing Title Name')
|
||||
|
||||
def sorttitle(self):
|
||||
"""
|
||||
Returns an item's sorting name/title or the title itself if not found
|
||||
"Missing Title" if both are not present
|
||||
"""
|
||||
return cast(unicode, self.item.get('titleSort', self.item.get('title', 'Missing Title')))
|
||||
return self.item.get('titleSort', self.item.get('title', 'Missing Title'))
|
||||
|
||||
def artist_name(self):
|
||||
"""
|
||||
|
@ -502,7 +502,7 @@ class API(object):
|
|||
"""
|
||||
Returns the plot or None.
|
||||
"""
|
||||
return cast(unicode, self.item.get('summary'))
|
||||
return self.item.get('summary')
|
||||
|
||||
def shortplot(self):
|
||||
"""
|
||||
|
@ -520,7 +520,7 @@ class API(object):
|
|||
"""
|
||||
Returns a shorter tagline or None
|
||||
"""
|
||||
return cast(unicode, self.item.get('tagline'))
|
||||
return self.item.get('tagline')
|
||||
|
||||
def audience_rating(self):
|
||||
"""
|
||||
|
@ -617,7 +617,7 @@ class API(object):
|
|||
"""
|
||||
Returns the 'studio' or None
|
||||
"""
|
||||
return self.replace_studio(cast(unicode, self.item.get('studio')))
|
||||
return self.replace_studio(self.item.get('studio'))
|
||||
|
||||
def music_studio_list(self):
|
||||
"""
|
||||
|
@ -686,7 +686,7 @@ class API(object):
|
|||
"""
|
||||
return (cast(int, self.item.get('grandparentRatingKey')),
|
||||
cast(int, self.item.get('parentRatingKey')),
|
||||
cast(unicode, self.item.get('grandparentTitle')),
|
||||
self.item.get('grandparentTitle'),
|
||||
cast(int, self.item.get('parentIndex')),
|
||||
cast(int, self.item.get('index')))
|
||||
|
||||
|
|
Loading…
Reference in a new issue