mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-05-20 00:05:07 +00:00
content notification
This commit is contained in:
parent
969629ec37
commit
c63bfd1346
9 changed files with 79 additions and 21 deletions
|
@ -18,10 +18,10 @@ LOG = logging.getLogger("EMBY."+__name__)
|
|||
class API(object):
|
||||
|
||||
|
||||
def __init__(self, item, server):
|
||||
def __init__(self, item, server=None):
|
||||
|
||||
''' Get item information in special cases.
|
||||
server is the server address
|
||||
server is the server address, provide if your functions requires it.
|
||||
'''
|
||||
self.item = item
|
||||
self.server = server
|
||||
|
@ -33,6 +33,25 @@ class API(object):
|
|||
'''
|
||||
return (playcount or 1) if played else None
|
||||
|
||||
def get_naming(self):
|
||||
|
||||
if self.item['Type'] == 'Episode':
|
||||
|
||||
if 'SeriesName' in self.item:
|
||||
return "%s: %s" % (self.item['SeriesName'], self.item['Name'])
|
||||
|
||||
elif self.item['Type'] == 'MusicAlbum':
|
||||
|
||||
if 'AlbumArtist' in self.item:
|
||||
return "%s: %s" % (self.item['AlbumArtist'], self.item['Name'])
|
||||
|
||||
elif self.item['Type'] == 'Audio':
|
||||
|
||||
if self.item.get('Artists'):
|
||||
return "%s: %s" % (self.item['Artists'][0], self.item['Name'])
|
||||
|
||||
return self.item['Name']
|
||||
|
||||
def get_actors(self):
|
||||
cast = []
|
||||
|
||||
|
|
|
@ -406,8 +406,9 @@ def copy_file(path, dest):
|
|||
|
||||
def normalize_string(text):
|
||||
|
||||
''' For theme media, do not modify unless
|
||||
modified in TV Tunes.
|
||||
''' For theme media, do not modify unless modified in TV Tunes.
|
||||
Remove dots from the last character as windows can not have directories
|
||||
with dots at the end
|
||||
'''
|
||||
text = text.replace(":", "")
|
||||
text = text.replace("/", "-")
|
||||
|
@ -418,13 +419,14 @@ def normalize_string(text):
|
|||
text = text.replace("?", "")
|
||||
text = text.replace('|', "")
|
||||
text = text.strip()
|
||||
# Remove dots from the last character as windows can not have directories
|
||||
# with dots at the end
|
||||
|
||||
text = text.rstrip('.')
|
||||
text = unicodedata.normalize('NFKD', unicode(text, 'utf-8')).encode('ascii', 'ignore')
|
||||
|
||||
return text
|
||||
|
||||
def split_list(itemlist, size):
|
||||
# Split up list in pieces of size. Will generate a list of lists
|
||||
|
||||
''' Split up list in pieces of size. Will generate a list of lists
|
||||
'''
|
||||
return [itemlist[i:i+size] for i in range(0, len(itemlist), size)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue