Fix PlexWatch and Plexivity import

This commit is contained in:
JonnyWong16 2016-08-26 17:43:10 -07:00
parent 8931fb4758
commit b55a563fce
2 changed files with 22 additions and 0 deletions

View file

@ -136,6 +136,14 @@ def extract_plexivity_xml(xml=None):
video_decision = helpers.get_xml_attr(e, 'videoDecision') video_decision = helpers.get_xml_attr(e, 'videoDecision')
transcode_width = helpers.get_xml_attr(e, 'width') transcode_width = helpers.get_xml_attr(e, 'width')
# Generate a combined transcode decision value
if video_decision == 'transcode' or audio_decision == 'transcode':
transcode_decision = 'transcode'
elif video_decision == 'copy' or audio_decision == 'copy':
transcode_decision = 'copy'
else:
transcode_decision = 'direct play'
user_id = None user_id = None
if a.getElementsByTagName('User'): if a.getElementsByTagName('User'):
@ -215,6 +223,7 @@ def extract_plexivity_xml(xml=None):
'transcode_video_codec': transcode_video_codec, 'transcode_video_codec': transcode_video_codec,
'video_decision': video_decision, 'video_decision': video_decision,
'transcode_width': transcode_width, 'transcode_width': transcode_width,
'transcode_decision': transcode_decision,
'user_id': user_id, 'user_id': user_id,
'writers': writers, 'writers': writers,
'actors': actors, 'actors': actors,
@ -339,6 +348,7 @@ def import_from_plexivity(database=None, table_name=None, import_ignore_interval
'title': row['title'], 'title': row['title'],
'parent_title': extracted_xml['parent_title'], 'parent_title': extracted_xml['parent_title'],
'grandparent_title': row['grandparent_title'], 'grandparent_title': row['grandparent_title'],
'full_title': row['full_title'],
'user_id': user_id, 'user_id': user_id,
'user': row['user'], 'user': row['user'],
'ip_address': row['ip_address'] if row['ip_address'] else extracted_xml['ip_address'], 'ip_address': row['ip_address'] if row['ip_address'] else extracted_xml['ip_address'],
@ -352,6 +362,7 @@ def import_from_plexivity(database=None, table_name=None, import_ignore_interval
'view_offset': extracted_xml['view_offset'], 'view_offset': extracted_xml['view_offset'],
'video_decision': extracted_xml['video_decision'], 'video_decision': extracted_xml['video_decision'],
'audio_decision': extracted_xml['audio_decision'], 'audio_decision': extracted_xml['audio_decision'],
'transcode_decision': extracted_xml['transcode_decision'],
'duration': extracted_xml['duration'], 'duration': extracted_xml['duration'],
'width': extracted_xml['width'], 'width': extracted_xml['width'],
'height': extracted_xml['height'], 'height': extracted_xml['height'],

View file

@ -130,6 +130,14 @@ def extract_plexwatch_xml(xml=None):
video_decision = helpers.get_xml_attr(e, 'videoDecision') video_decision = helpers.get_xml_attr(e, 'videoDecision')
transcode_width = helpers.get_xml_attr(e, 'width') transcode_width = helpers.get_xml_attr(e, 'width')
# Generate a combined transcode decision value
if video_decision == 'transcode' or audio_decision == 'transcode':
transcode_decision = 'transcode'
elif video_decision == 'copy' or audio_decision == 'copy':
transcode_decision = 'copy'
else:
transcode_decision = 'direct play'
user_id = None user_id = None
if a.getElementsByTagName('User'): if a.getElementsByTagName('User'):
@ -206,6 +214,7 @@ def extract_plexwatch_xml(xml=None):
'transcode_video_codec': transcode_video_codec, 'transcode_video_codec': transcode_video_codec,
'video_decision': video_decision, 'video_decision': video_decision,
'transcode_width': transcode_width, 'transcode_width': transcode_width,
'transcode_decision': transcode_decision,
'user_id': user_id, 'user_id': user_id,
'writers': writers, 'writers': writers,
'actors': actors, 'actors': actors,
@ -332,6 +341,7 @@ def import_from_plexwatch(database=None, table_name=None, import_ignore_interval
'title': row['title'], 'title': row['title'],
'parent_title': extracted_xml['parent_title'], 'parent_title': extracted_xml['parent_title'],
'grandparent_title': row['grandparent_title'], 'grandparent_title': row['grandparent_title'],
'full_title': row['full_title'],
'user_id': user_id, 'user_id': user_id,
'user': row['user'], 'user': row['user'],
'ip_address': row['ip_address'] if row['ip_address'] else extracted_xml['ip_address'], 'ip_address': row['ip_address'] if row['ip_address'] else extracted_xml['ip_address'],
@ -345,6 +355,7 @@ def import_from_plexwatch(database=None, table_name=None, import_ignore_interval
'view_offset': extracted_xml['view_offset'], 'view_offset': extracted_xml['view_offset'],
'video_decision': extracted_xml['video_decision'], 'video_decision': extracted_xml['video_decision'],
'audio_decision': extracted_xml['audio_decision'], 'audio_decision': extracted_xml['audio_decision'],
'transcode_decision': extracted_xml['transcode_decision'],
'duration': extracted_xml['duration'], 'duration': extracted_xml['duration'],
'width': extracted_xml['width'], 'width': extracted_xml['width'],
'height': extracted_xml['height'], 'height': extracted_xml['height'],