Use svg for platform and library icons

This commit is contained in:
JonnyWong16 2017-12-13 20:48:04 -08:00
parent e28965f8b3
commit b209c29749
83 changed files with 699 additions and 137 deletions

View file

@ -19,6 +19,7 @@ Created on Aug 1, 2011
@author: Michael
'''
import platform
from collections import OrderedDict
import version
@ -46,6 +47,39 @@ PLATFORM_NAME_OVERRIDES = {'Konvergo': 'Plex Media Player',
PMS_PLATFORM_NAME_OVERRIDES = {'MacOSX': 'Mac'
}
PLATFORM_NAMES = {'android': 'android',
'apple tv': 'atv',
'chrome': 'chrome',
'chromecast': 'chromecast',
'dlna': 'dlna',
'firefox': 'firefox',
'internet explorer': 'ie',
'ios': 'ios',
'ipad': 'ios',
'iphone': 'ios',
'kodi': 'kodi',
'linux': 'linux',
'nexus': 'android',
'microsoft edge': 'msedge',
'opera': 'opera',
'playstation': 'playstation',
'plex home theater': 'plex',
'plex media player': 'plex',
'plexamp': 'plexamp',
'plextogether': 'plextogether',
'roku': 'roku',
'safari': 'safari',
'samsung': 'samsung',
'tvos': 'atv',
'vizio': 'opera',
'windows': 'windows',
'windows phone': 'wp',
'wiiu': 'wiiu',
'xbmc': 'xbmc',
'xbox': 'xbox'
}
PLATFORM_NAMES = OrderedDict(sorted(PLATFORM_NAMES.items(), key=lambda k: k[0], reverse=True))
MEDIA_FLAGS_AUDIO = {'ac.?3': 'dolby_digital',
'truehd': 'dolby_truehd',
'(dca|dta)': 'dts',

View file

@ -321,7 +321,7 @@ class DataFactory(object):
'labels': item['labels'].split(';') if item['labels'] else (),
'user': '',
'friendly_name': '',
'platform_type': '',
'platform': '',
'platform': '',
'row_id': item['id']
}
@ -371,7 +371,6 @@ class DataFactory(object):
'labels': item['labels'].split(';') if item['labels'] else (),
'user': '',
'friendly_name': '',
'platform_type': '',
'platform': '',
'row_id': item['id']
}
@ -420,7 +419,6 @@ class DataFactory(object):
'labels': item['labels'].split(';') if item['labels'] else (),
'user': '',
'friendly_name': '',
'platform_type': '',
'platform': '',
'row_id': item['id']
}
@ -470,7 +468,6 @@ class DataFactory(object):
'labels': item['labels'].split(';') if item['labels'] else (),
'user': '',
'friendly_name': '',
'platform_type': '',
'platform': '',
'row_id': item['id']
}
@ -519,7 +516,6 @@ class DataFactory(object):
'labels': item['labels'].split(';') if item['labels'] else (),
'user': '',
'friendly_name': '',
'platform_type': '',
'platform': '',
'row_id': item['id']
}
@ -569,7 +565,6 @@ class DataFactory(object):
'labels': item['labels'].split(';') if item['labels'] else (),
'user': '',
'friendly_name': '',
'platform_type': '',
'platform': '',
'row_id': item['id']
}
@ -624,7 +619,6 @@ class DataFactory(object):
'users_watched': '',
'rating_key': '',
'title': '',
'platform_type': '',
'platform': '',
'row_id': ''
}
@ -659,13 +653,15 @@ class DataFactory(object):
for item in result:
# Rename Mystery platform names
platform_type = common.PLATFORM_NAME_OVERRIDES.get(item['platform'], item['platform'])
platform = common.PLATFORM_NAME_OVERRIDES.get(item['platform'], item['platform'])
platform_name = next((v for k, v in common.PLATFORM_NAMES.iteritems() if k in platform.lower()), 'default')
row = {'platform': item['platform'],
'total_plays': item['total_plays'],
'total_duration': item['total_duration'],
'last_play': item['last_watch'],
'platform_type': platform_type,
'platform': platform,
'platform_name': platform_name,
'title': '',
'thumb': '',
'grandparent_thumb': '',

View file

@ -262,7 +262,7 @@ class Libraries(object):
row = {'section_id': item['section_id'],
'section_name': item['section_name'],
'section_type': item['section_type'].capitalize(),
'section_type': item['section_type'],
'count': item['count'],
'parent_count': item['parent_count'],
'child_count': item['child_count'],

View file

@ -1277,21 +1277,18 @@ class PmsConnect(object):
if a.getElementsByTagName('Track'):
session_data = a.getElementsByTagName('Track')
session_type = 'track'
for session_ in session_data:
session_output = self.get_session_each(session_type, session_)
session_output = self.get_session_each(session_)
session_list.append(session_output)
if a.getElementsByTagName('Video'):
session_data = a.getElementsByTagName('Video')
session_type = 'video'
for session_ in session_data:
session_output = self.get_session_each(session_type, session_)
session_output = self.get_session_each(session_)
session_list.append(session_output)
if a.getElementsByTagName('Photo'):
session_data = a.getElementsByTagName('Photo')
session_type = 'photo'
for session_ in session_data:
session_output = self.get_session_each(session_type, session_)
session_output = self.get_session_each(session_)
session_list.append(session_output)
session_list = sorted(session_list, key=lambda k: k['session_key'])
@ -1302,13 +1299,12 @@ class PmsConnect(object):
return output
def get_session_each(self, stream_type='', session=None):
def get_session_each(self, session=None):
"""
Return selected data from current sessions.
This function processes and validates session data
Parameters required: stream_type { track or video }
session { the session dictionary }
Parameters required: session { the session dictionary }
Output: dict
"""
@ -1328,10 +1324,13 @@ class PmsConnect(object):
if not platform and helpers.get_xml_attr(player_info, 'product') == 'DLNA':
platform = 'DLNA'
platform_name = next((v for k, v in common.PLATFORM_NAMES.iteritems() if k in platform.lower()), 'default')
player_details = {'ip_address': helpers.get_xml_attr(player_info, 'address').split('::ffff:')[-1],
'ip_address_public': helpers.get_xml_attr(player_info, 'remotePublicAddress').split('::ffff:')[-1],
'device': helpers.get_xml_attr(player_info, 'device'),
'platform': platform,
'platform_name': platform_name,
'platform_version': helpers.get_xml_attr(player_info, 'platformVersion'),
'product': helpers.get_xml_attr(player_info, 'product'),
'product_version': helpers.get_xml_attr(player_info, 'version'),

View file

@ -452,10 +452,12 @@ class Users(object):
for item in result:
# Rename Mystery platform names
platform_type = common.PLATFORM_NAME_OVERRIDES.get(item['platform'], item['platform'])
platform = common.PLATFORM_NAME_OVERRIDES.get(item['platform'], item['platform'])
platform_name = next((v for k, v in common.PLATFORM_NAMES.iteritems() if k in platform.lower()), 'default')
row = {'player_name': item['player'],
'platform_type': platform_type,
'platform': platform,
'platform_name': platform_name,
'total_plays': item['player_count'],
'result_id': result_id
}