mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 15:56:07 -07:00
Fix handling of clips in activity pane.
Start standardising variable names in templates.
This commit is contained in:
parent
b4f1bddc02
commit
c770c90d76
7 changed files with 188 additions and 124 deletions
|
@ -15,8 +15,8 @@ data['sessions'] Returns an array containing session data
|
|||
data[sessions] :: Usable parameters
|
||||
|
||||
== Global keys ==
|
||||
sessionKey Returns a unique session id for the active stream
|
||||
ratingKey Returns the unique identifier for the media item.
|
||||
session_key Returns a unique session id for the active stream
|
||||
rating_key Returns the unique identifier for the media item.
|
||||
type Returns the type of session. Either 'track', 'episode' or 'movie'.
|
||||
thumb Returns the location of the item's thumbnail. Use with pms_image_proxy.
|
||||
art Returns the location of the item's artwork
|
||||
|
@ -26,15 +26,13 @@ friendly_name Returns the friendlly name of the user owning the sessio
|
|||
state Returns the state of the current session. Either 'playing', 'paused' or 'buffering'.
|
||||
title Returns the name of the episode, movie or music track.
|
||||
player Returns the name of the platform used to play the stream.
|
||||
audioDecision Returns the audio transcode decision. Either 'transcode', 'copy' or 'direct play'.
|
||||
audioCodec Returns the name of the audio codec.
|
||||
audioChannels Returns the number of audio channels.
|
||||
grandparentTitle Returns the title of the item's grandparent.
|
||||
parentTitle Returns the title of the item's parent.
|
||||
|
||||
== Only if 'type' is 'episode' or 'movie' ==
|
||||
videoDecision Returns the video transcode decision. Either 'transcode', 'copy' or 'direct play'.
|
||||
videoCodec Returns the name of the video codec.
|
||||
audio_decision Returns the audio transcode decision. Either 'transcode', 'copy' or 'direct play'.
|
||||
audio_codec Returns the name of the audio codec.
|
||||
audio_channels Returns the number of audio channels.
|
||||
grandparent_title Returns the title of the item's grandparent.
|
||||
parent_title Returns the title of the item's parent.
|
||||
video_decision Returns the video transcode decision. Either 'transcode', 'copy' or 'direct play'.
|
||||
video_codec Returns the name of the video codec.
|
||||
height Returns the value of the video height.
|
||||
width Returns the value of the video width.
|
||||
indexes Returns true if the media has media indexes and are enabled
|
||||
|
@ -45,7 +43,7 @@ DOCUMENTATION :: END
|
|||
% if data is not None:
|
||||
% if data['stream_count'] != '0':
|
||||
% for a in data['sessions']:
|
||||
<div class="instance" id="instance-${a['sessionKey']}">
|
||||
<div class="instance" id="instance-${a['session_key']}">
|
||||
<div class="poster">
|
||||
% if a['type'] == 'movie' and not a['indexes']:
|
||||
<div class="dashboard-activity-poster-face">
|
||||
|
@ -64,33 +62,35 @@ DOCUMENTATION :: END
|
|||
<div class='dashboard-activity-instance-overlay'>
|
||||
<div class='dashboard-activity-metadata-progress-minutes'>
|
||||
<div class='progress progress-warning'>
|
||||
<div class="bar" style="width: ${a['progressPercent']}%">${a['progressPercent']}%</div>
|
||||
<div class="bar" style="width: ${a['progress_percent']}%">${a['progress_percent']}%</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dashboard-activity-metadata-platform" id="platform-${a['sessionKey']}">
|
||||
<div class="dashboard-activity-metadata-platform" id="platform-${a['session_key']}">
|
||||
</div>
|
||||
<div class="dashboard-activity-metadata-user">
|
||||
<a href="user?user=${a['user']}">${a['friendly_name']}</a> is ${a['state']}
|
||||
</div>
|
||||
<div class="dashboard-activity-metadata-title">
|
||||
% if a['type'] == 'episode':
|
||||
<a href="info?rating_key=${a['ratingKey']}">${a['grandparentTitle']} - ${a['title']}</a>
|
||||
<a href="info?rating_key=${a['rating_key']}">${a['grandparent_title']} - ${a['title']}</a>
|
||||
% elif a['type'] == 'movie':
|
||||
<a href="info?rating_key=${a['ratingKey']}">${a['title']}</a>
|
||||
<a href="info?rating_key=${a['rating_key']}">${a['title']}</a>
|
||||
% elif a['type'] == 'clip':
|
||||
${a['title']}
|
||||
% elif a['type'] == 'track':
|
||||
${a['grandparentTitle']} - ${a['title']}
|
||||
${a['grandparent_title']} - ${a['title']}
|
||||
% else:
|
||||
${a['grandparentTitle']} - ${a['title']}
|
||||
${a['grandparent_title']} - ${a['title']}
|
||||
% endif
|
||||
</div>
|
||||
</div>
|
||||
<div id="stream-${a['sessionKey']}" class="collapse out">
|
||||
<div id="stream-${a['session_key']}" class="collapse out">
|
||||
<div class='dashboard-activity-info-details-overlay'>
|
||||
<div class='dashboard-activity-info-details-content'>
|
||||
% if a['type'] == 'track':
|
||||
Artist: <strong>${a['grandparentTitle']}</strong>
|
||||
Artist: <strong>${a['grandparent_title']}</strong>
|
||||
<br>
|
||||
Album: <strong>${a['parentTitle']}</strong>
|
||||
Album: <strong>${a['parent_title']}</strong>
|
||||
<br>
|
||||
% endif
|
||||
% if a['state'] == 'playing':
|
||||
|
@ -102,24 +102,24 @@ DOCUMENTATION :: END
|
|||
% endif
|
||||
<br>
|
||||
% if a['type'] == 'track':
|
||||
% if a['audioDecision'] == 'direct play':
|
||||
% if a['audio_decision'] == 'direct play':
|
||||
Stream: <strong>Direct Play</strong>
|
||||
% else:
|
||||
Stream: <strong>Transcoding</strong>
|
||||
% endif
|
||||
<br/>
|
||||
Audio: <strong>${a['audioCodec']} (${a['audioChannels']}ch)</strong>
|
||||
% elif a['type'] == 'episode' or a['type'] == 'movie':
|
||||
% if a['videoDecision'] == 'direct play':
|
||||
Audio: <strong>${a['audio_codec']} (${a['audio_channels']}ch)</strong>
|
||||
% elif a['type'] == 'episode' or a['type'] == 'movie' or a['type'] == 'clip':
|
||||
% if a['video_decision'] == 'direct play':
|
||||
Stream: <strong>Direct Play</strong>
|
||||
% else:
|
||||
Stream: <strong>Transcoding</strong>
|
||||
% endif
|
||||
<br/>
|
||||
Video: <strong>${a['videoDecision']} (${a['videoCodec']})
|
||||
Video: <strong>${a['video_decision']} (${a['video_codec']})
|
||||
(${a['width']}x${a['height']})</strong>
|
||||
<br/>
|
||||
Audio: <strong>${a['audioDecision']} (${a['audioCodec']}) (${a['audioChannels']}ch)</strong>
|
||||
Audio: <strong>${a['audio_decision']} (${a['audio_codec']}) (${a['audio_channels']}ch)</strong>
|
||||
% endif
|
||||
<br>
|
||||
</div>
|
||||
|
@ -128,13 +128,13 @@ DOCUMENTATION :: END
|
|||
</div>
|
||||
</div>
|
||||
<div class="dashboard-activity-button-info">
|
||||
<button type="button" class="btn btn-warning" data-toggle="collapse" data-target="#stream-${a['sessionKey']}">
|
||||
<button type="button" class="btn btn-warning" data-toggle="collapse" data-target="#stream-${a['session_key']}">
|
||||
<i class='icon-info-sign icon-white'></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$("#platform-${a['sessionKey']}").html("<img src='" + getPlatformImagePath('${a['player']}') + "'>");
|
||||
$("#platform-${a['session_key']}").html("<img src='" + getPlatformImagePath('${a['player']}') + "'>");
|
||||
|
||||
</script>
|
||||
% endfor
|
||||
|
|
|
@ -17,7 +17,7 @@ data[array_index]['rows'] :: Usable parameters
|
|||
== Only if 'stat_id' is 'top_tv' or 'popular_tv' ==
|
||||
grandparent_thumb Returns location of the item's thumbnail. Use with pms_image_proxy.
|
||||
rating_key Returns the unique identifier for the media item.
|
||||
orig_title Returns the title for the associated stat.
|
||||
title Returns the title for the associated stat.
|
||||
|
||||
== Only if 'stat_id' is 'top_tv' or 'top_user' or 'top_platform' ==
|
||||
total_plays Returns the count for the associated stat.
|
||||
|
@ -58,7 +58,7 @@ DOCUMENTATION :: END
|
|||
<div class="home-platforms-instance-name">
|
||||
<h4>Most Watched TV</h4>
|
||||
<a href="info?rating_key=${a['rows'][0]['rating_key']}">
|
||||
<h5>${a['rows'][0]['orig_title']}</h5>
|
||||
<h5>${a['rows'][0]['title']}</h5>
|
||||
</a>
|
||||
</div>
|
||||
<div class="user-platforms-instance-playcount">
|
||||
|
@ -85,7 +85,7 @@ DOCUMENTATION :: END
|
|||
<div class="home-platforms-instance-name">
|
||||
<h4>Most Popular TV</h4>
|
||||
<a href="info?rating_key=${a['rows'][0]['rating_key']}">
|
||||
<h5>${a['rows'][0]['orig_title']}</h5>
|
||||
<h5>${a['rows'][0]['title']}</h5>
|
||||
</a>
|
||||
</div>
|
||||
<div class="user-platforms-instance-playcount">
|
||||
|
|
|
@ -7,42 +7,28 @@ Filename: info.html
|
|||
Version: 0.1
|
||||
Variable names: data [list]
|
||||
|
||||
data :: Usable parameters
|
||||
data :: Usable parameters (if not applicable for media type, blank value will be returned)
|
||||
|
||||
== Global keys ==
|
||||
ratingKey Returns the unique identifier for the media item.
|
||||
rating_key Returns the unique identifier for the media item.
|
||||
type Returns the type of media. Either 'movie', 'episode' or 'show' or 'season'.
|
||||
art Returns the location of the item's artwork
|
||||
title Returns the name of the episode, show, season or movie.
|
||||
duration Returns the standard runtime of the media.
|
||||
contentRating Returns the age rating for the media.
|
||||
content_rating Returns the age rating for the media.
|
||||
summary Returns a brief description of the media plot.
|
||||
|
||||
== Only if 'type' is 'episode' ==
|
||||
grandparentTitle Returns the name of the TV show.
|
||||
parentIndex Returns the season number of the TV show.
|
||||
grandparent_title Returns the name of the TV show.
|
||||
parent_index Returns the season number of the TV show.
|
||||
index Returns the episode number.
|
||||
parentThumb Returns the location of the item's thumbnail. Use with pms_image_proxy.
|
||||
parent_thumb Returns the location of the item's thumbnail. Use with pms_image_proxy.
|
||||
writers Returns an array of writers.
|
||||
|
||||
== Only if 'type' is 'movie' or 'season' or 'show' ==
|
||||
thumb Returns the location of the item's thumbnail. Use with pms_image_proxy.
|
||||
|
||||
== Only if 'type' is 'season' ==
|
||||
parentTitle Returns the name of the TV show.
|
||||
|
||||
== Only if 'type' is 'movie' ==
|
||||
parent_title Returns the name of the TV show.
|
||||
rating Returns the 5 star rating value for the movie. Between 1 and 5.
|
||||
year Returns the release year of the movie.
|
||||
|
||||
== Only if 'type' is 'movie' or 'show' ==
|
||||
genres Returns an array of genres.
|
||||
actors Returns an array of actors.
|
||||
|
||||
== Only if 'type' is 'episode' or 'movie' ==
|
||||
directors Returns an array of directors.
|
||||
|
||||
== Only if 'type' is 'show' or 'season' ==
|
||||
studio Returns the name of the studio.
|
||||
|
||||
DOCUMENTATION :: END
|
||||
|
@ -72,7 +58,7 @@ from plexpy import helpers
|
|||
<div class="span9">
|
||||
<div class="summary-content-poster hidden-phone hidden-tablet">
|
||||
% if data['type'] == 'episode':
|
||||
<img src="pms_image_proxy?img=${data['parentThumb']}&width=256&height=352">
|
||||
<img src="pms_image_proxy?img=${data['parent_thumb']}&width=256&height=352">
|
||||
% else:
|
||||
<img src="pms_image_proxy?img=${data['thumb']}&width=256&height=352">
|
||||
% endif
|
||||
|
@ -82,9 +68,9 @@ from plexpy import helpers
|
|||
% if data['type'] == 'movie':
|
||||
<h1>${data['title']} (${data['year']})</h1>
|
||||
% elif data['type'] == 'season':
|
||||
<h1>${data['parentTitle']} (${data['title']})</h1>
|
||||
<h1>${data['parent_title']} (${data['title']})</h1>
|
||||
% elif data['type'] == 'episode':
|
||||
<h1>${data['grandparentTitle']} (Season ${data['parentIndex']}, Episode
|
||||
<h1>${data['grandparent_title']} (Season ${data['parent_index']}, Episode
|
||||
${data['index']}) "${data['title']}"</h1>
|
||||
% else:
|
||||
<h1>${data['title']}</h1>
|
||||
|
@ -110,7 +96,7 @@ from plexpy import helpers
|
|||
Runtime <strong> ${data['duration']} mins</strong>
|
||||
</div>
|
||||
<div class="summary-content-content-rating">
|
||||
Rated <strong> ${data['contentRating']} </strong>
|
||||
Rated <strong> ${data['content_rating']} </strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="summary-content-summary">
|
||||
|
@ -198,7 +184,7 @@ from plexpy import helpers
|
|||
<th class="desktop" align='left' id="stopped">Stopped</th>
|
||||
<th class="desktop" align='left' id="duration">Duration</th>
|
||||
<th class="desktop" align='left' id="percent_complete">Completed</th>
|
||||
<th class="never" align='left' id="rating_key">RatingKey</th>
|
||||
<th class="never" align='left' id="rating_key">rating_key</th>
|
||||
<th class="never" align='left' id="xml"></th>
|
||||
<th class="never" align='left' id="user"></th>
|
||||
</tr>
|
||||
|
@ -258,7 +244,7 @@ from plexpy import helpers
|
|||
history_table_options.ajax = {
|
||||
"url": "get_history",
|
||||
"data": function(d) {
|
||||
d.rating_key = ${data['ratingKey']};
|
||||
d.rating_key = ${data['rating_key']};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,7 +262,7 @@ from plexpy import helpers
|
|||
history_table_options.ajax = {
|
||||
"url": "get_history",
|
||||
"data": function(d) {
|
||||
d.grandparent_rating_key = ${data['ratingKey']};
|
||||
d.grandparent_rating_key = ${data['rating_key']};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -292,7 +278,7 @@ from plexpy import helpers
|
|||
url: 'get_children',
|
||||
type: "GET",
|
||||
async: true,
|
||||
data: { rating_key : ${data['ratingKey']} },
|
||||
data: { rating_key : ${data['rating_key']} },
|
||||
complete: function(xhr, status) {
|
||||
$("#episode-list").html(xhr.responseText);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ episode_list Returns an array of episodes.
|
|||
data['episode_list'] :: Usable paramaters
|
||||
|
||||
== Global keys ==
|
||||
ratingKey Returns the unique identifier for the media item.
|
||||
rating_key Returns the unique identifier for the media item.
|
||||
thumb Returns the location of the item's thumbnail. Use with pms_image_proxy.
|
||||
title Returns the name of the episode.
|
||||
index Returns the episode number.
|
||||
|
@ -32,7 +32,7 @@ DOCUMENTATION :: END
|
|||
<li>
|
||||
<div class="season-episodes-poster">
|
||||
<div class="season-episodes-poster-face">
|
||||
<a href="info?rating_key=${a['ratingKey']}">
|
||||
<a href="info?rating_key=${a['rating_key']}">
|
||||
<img src="pms_image_proxy?img=${a['thumb']}&width=205&height=115"
|
||||
class="season-episodes-poster-face">
|
||||
</a>
|
||||
|
@ -45,7 +45,7 @@ DOCUMENTATION :: END
|
|||
</div>
|
||||
<div class="season-episodes-instance-text-wrapper">
|
||||
<div class="season-episodes-title">
|
||||
<a href="info?rating_key=${a['ratingKey']}">
|
||||
<a href="info?rating_key=${a['rating_key']}">
|
||||
"${a['title']}"
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -347,8 +347,12 @@ def convert_xml_to_dict(xml):
|
|||
|
||||
|
||||
def get_percent(value1, value2):
|
||||
|
||||
if value1.isdigit() and value2.isdigit():
|
||||
value1 = cast_to_float(value1)
|
||||
value2 = cast_to_float(value2)
|
||||
else:
|
||||
return 0
|
||||
|
||||
if value1 != 0 and value2 != 0:
|
||||
percent = (value1 / value2) * 100
|
||||
|
|
|
@ -634,11 +634,17 @@ class PlexWatch(object):
|
|||
for a in xml_head:
|
||||
grandparent_thumb = self.get_xml_attr(a, 'grandparentThumb')
|
||||
|
||||
row = {'orig_title': item[0],
|
||||
row = {'title': item[0],
|
||||
'total_plays': item[1],
|
||||
'users_watched': '',
|
||||
'rating_key': item[2],
|
||||
'last_play': item[3],
|
||||
'grandparent_thumb': grandparent_thumb
|
||||
'grandparent_thumb': grandparent_thumb,
|
||||
'thumb': '',
|
||||
'user': '',
|
||||
'friendly_name': '',
|
||||
'platform_type': '',
|
||||
'platform': ''
|
||||
}
|
||||
top_tv.append(row)
|
||||
|
||||
|
@ -679,12 +685,17 @@ class PlexWatch(object):
|
|||
for a in xml_head:
|
||||
grandparent_thumb = self.get_xml_attr(a, 'grandparentThumb')
|
||||
|
||||
row = {'orig_title': item[0],
|
||||
row = {'title': item[0],
|
||||
'users_watched': item[1],
|
||||
'rating_key': item[2],
|
||||
'last_play': item[3],
|
||||
'total_plays': item[5],
|
||||
'grandparent_thumb': grandparent_thumb
|
||||
'grandparent_thumb': grandparent_thumb,
|
||||
'thumb': '',
|
||||
'user': '',
|
||||
'friendly_name': '',
|
||||
'platform_type': '',
|
||||
'platform': ''
|
||||
}
|
||||
popular_tv.append(row)
|
||||
|
||||
|
@ -720,7 +731,13 @@ class PlexWatch(object):
|
|||
'friendly_name': item[1],
|
||||
'total_plays': item[2],
|
||||
'last_play': item[3],
|
||||
'thumb': user_thumb
|
||||
'thumb': user_thumb,
|
||||
'grandparent_thumb': '',
|
||||
'users_watched': '',
|
||||
'rating_key': '',
|
||||
'title': '',
|
||||
'platform_type': '',
|
||||
'platform': ''
|
||||
}
|
||||
top_users.append(row)
|
||||
|
||||
|
@ -762,7 +779,14 @@ class PlexWatch(object):
|
|||
row = {'platform': item[0],
|
||||
'total_plays': item[1],
|
||||
'last_play': item[2],
|
||||
'platform_type': platform_type
|
||||
'platform_type': platform_type,
|
||||
'title': '',
|
||||
'thumb': '',
|
||||
'grandparent_thumb': '',
|
||||
'users_watched': '',
|
||||
'rating_key': '',
|
||||
'user': '',
|
||||
'friendly_name': ''
|
||||
}
|
||||
top_platform.append(row)
|
||||
|
||||
|
|
|
@ -409,17 +409,22 @@ class PmsConnect(object):
|
|||
|
||||
if metadata_type == 'show':
|
||||
metadata = {'type': metadata_type,
|
||||
'ratingKey': self.get_xml_attr(metadata_main, 'ratingKey'),
|
||||
'rating_key': self.get_xml_attr(metadata_main, 'ratingKey'),
|
||||
'grandparent_title': self.get_xml_attr(metadata_main, 'grandparentTitle'),
|
||||
'parent_index': self.get_xml_attr(metadata_main, 'parentIndex'),
|
||||
'parent_title': self.get_xml_attr(metadata_main, 'parentTitle'),
|
||||
'index': self.get_xml_attr(metadata_main, 'index'),
|
||||
'studio': self.get_xml_attr(metadata_main, 'studio'),
|
||||
'title': self.get_xml_attr(metadata_main, 'title'),
|
||||
'contentRating': self.get_xml_attr(metadata_main, 'contentRating'),
|
||||
'content_rating': self.get_xml_attr(metadata_main, 'contentRating'),
|
||||
'summary': self.get_xml_attr(metadata_main, 'summary'),
|
||||
'rating': self.get_xml_attr(metadata_main, 'rating'),
|
||||
'duration': helpers.convert_milliseconds_to_minutes(self.get_xml_attr(metadata_main, 'duration')),
|
||||
'year': self.get_xml_attr(metadata_main, 'year'),
|
||||
'thumb': self.get_xml_attr(metadata_main, 'thumb'),
|
||||
'parent_thumb': self.get_xml_attr(metadata_main, 'parentThumb'),
|
||||
'art': self.get_xml_attr(metadata_main, 'art'),
|
||||
'originallyAvailableAt': self.get_xml_attr(metadata_main, 'originallyAvailableAt'),
|
||||
'originally_available_at': self.get_xml_attr(metadata_main, 'originallyAvailableAt'),
|
||||
'writers': writers,
|
||||
'directors': directors,
|
||||
'genres': genres,
|
||||
|
@ -428,19 +433,22 @@ class PmsConnect(object):
|
|||
metadata_list = {'metadata': metadata}
|
||||
elif metadata_type == 'episode':
|
||||
metadata = {'type': metadata_type,
|
||||
'ratingKey': self.get_xml_attr(metadata_main, 'ratingKey'),
|
||||
'grandparentTitle': self.get_xml_attr(metadata_main, 'grandparentTitle'),
|
||||
'parentIndex': self.get_xml_attr(metadata_main, 'parentIndex'),
|
||||
'rating_key': self.get_xml_attr(metadata_main, 'ratingKey'),
|
||||
'grandparent_title': self.get_xml_attr(metadata_main, 'grandparentTitle'),
|
||||
'parent_index': self.get_xml_attr(metadata_main, 'parentIndex'),
|
||||
'parent_title': self.get_xml_attr(metadata_main, 'parentTitle'),
|
||||
'index': self.get_xml_attr(metadata_main, 'index'),
|
||||
'studio': self.get_xml_attr(metadata_main, 'studio'),
|
||||
'title': self.get_xml_attr(metadata_main, 'title'),
|
||||
'contentRating': self.get_xml_attr(metadata_main, 'contentRating'),
|
||||
'content_rating': self.get_xml_attr(metadata_main, 'contentRating'),
|
||||
'summary': self.get_xml_attr(metadata_main, 'summary'),
|
||||
'rating': self.get_xml_attr(metadata_main, 'rating'),
|
||||
'duration': helpers.convert_milliseconds_to_minutes(self.get_xml_attr(metadata_main, 'duration')),
|
||||
'year': self.get_xml_attr(metadata_main, 'year'),
|
||||
'thumb': self.get_xml_attr(metadata_main, 'thumb'),
|
||||
'parentThumb': self.get_xml_attr(metadata_main, 'parentThumb'),
|
||||
'parent_thumb': self.get_xml_attr(metadata_main, 'parentThumb'),
|
||||
'art': self.get_xml_attr(metadata_main, 'art'),
|
||||
'originallyAvailableAt': self.get_xml_attr(metadata_main, 'originallyAvailableAt'),
|
||||
'originally_available_at': self.get_xml_attr(metadata_main, 'originallyAvailableAt'),
|
||||
'writers': writers,
|
||||
'directors': directors,
|
||||
'genres': genres,
|
||||
|
@ -449,17 +457,22 @@ class PmsConnect(object):
|
|||
metadata_list = {'metadata': metadata}
|
||||
elif metadata_type == 'movie':
|
||||
metadata = {'type': metadata_type,
|
||||
'ratingKey': self.get_xml_attr(metadata_main, 'ratingKey'),
|
||||
'rating_key': self.get_xml_attr(metadata_main, 'ratingKey'),
|
||||
'grandparent_title': self.get_xml_attr(metadata_main, 'grandparentTitle'),
|
||||
'parent_index': self.get_xml_attr(metadata_main, 'parentIndex'),
|
||||
'parent_title': self.get_xml_attr(metadata_main, 'parentTitle'),
|
||||
'index': self.get_xml_attr(metadata_main, 'index'),
|
||||
'studio': self.get_xml_attr(metadata_main, 'studio'),
|
||||
'title': self.get_xml_attr(metadata_main, 'title'),
|
||||
'contentRating': self.get_xml_attr(metadata_main, 'contentRating'),
|
||||
'content_rating': self.get_xml_attr(metadata_main, 'contentRating'),
|
||||
'summary': self.get_xml_attr(metadata_main, 'summary'),
|
||||
'rating': self.get_xml_attr(metadata_main, 'rating'),
|
||||
'duration': helpers.convert_milliseconds_to_minutes(self.get_xml_attr(metadata_main, 'duration')),
|
||||
'year': self.get_xml_attr(metadata_main, 'year'),
|
||||
'thumb': self.get_xml_attr(metadata_main, 'thumb'),
|
||||
'parent_thumb': self.get_xml_attr(metadata_main, 'parentThumb'),
|
||||
'art': self.get_xml_attr(metadata_main, 'art'),
|
||||
'originallyAvailableAt': self.get_xml_attr(metadata_main, 'originallyAvailableAt'),
|
||||
'originally_available_at': self.get_xml_attr(metadata_main, 'originallyAvailableAt'),
|
||||
'genres': genres,
|
||||
'actors': actors,
|
||||
'writers': writers,
|
||||
|
@ -470,16 +483,26 @@ class PmsConnect(object):
|
|||
parent_rating_key = self.get_xml_attr(metadata_main, 'parentRatingKey')
|
||||
show_details = self.get_metadata_details(parent_rating_key)
|
||||
metadata = {'type': metadata_type,
|
||||
'ratingKey': self.get_xml_attr(metadata_main, 'ratingKey'),
|
||||
'parentTitle': self.get_xml_attr(metadata_main, 'parentTitle'),
|
||||
'rating_key': self.get_xml_attr(metadata_main, 'ratingKey'),
|
||||
'grandparent_title': self.get_xml_attr(metadata_main, 'grandparentTitle'),
|
||||
'parent_index': self.get_xml_attr(metadata_main, 'parentIndex'),
|
||||
'parent_title': self.get_xml_attr(metadata_main, 'parentTitle'),
|
||||
'index': self.get_xml_attr(metadata_main, 'index'),
|
||||
'studio': self.get_xml_attr(metadata_main, 'studio'),
|
||||
'title': self.get_xml_attr(metadata_main, 'title'),
|
||||
'thumb': self.get_xml_attr(metadata_main, 'thumb'),
|
||||
'art': self.get_xml_attr(metadata_main, 'art'),
|
||||
'content_rating': self.get_xml_attr(metadata_main, 'contentRating'),
|
||||
'summary': show_details['metadata']['summary'],
|
||||
'studio': show_details['metadata']['studio'],
|
||||
'rating': self.get_xml_attr(metadata_main, 'rating'),
|
||||
'duration': show_details['metadata']['duration'],
|
||||
'contentRating': show_details['metadata']['contentRating']
|
||||
'year': self.get_xml_attr(metadata_main, 'year'),
|
||||
'thumb': self.get_xml_attr(metadata_main, 'thumb'),
|
||||
'parent_thumb': self.get_xml_attr(metadata_main, 'parentThumb'),
|
||||
'art': self.get_xml_attr(metadata_main, 'art'),
|
||||
'originally_available_at': self.get_xml_attr(metadata_main, 'originallyAvailableAt'),
|
||||
'genres': genres,
|
||||
'actors': actors,
|
||||
'writers': writers,
|
||||
'directors': directors
|
||||
}
|
||||
metadata_list = {'metadata': metadata}
|
||||
else:
|
||||
|
@ -580,29 +603,29 @@ class PmsConnect(object):
|
|||
duration = self.get_xml_attr(media_info, 'duration')
|
||||
progress = self.get_xml_attr(session, 'viewOffset')
|
||||
|
||||
session_output = {'sessionKey': self.get_xml_attr(session, 'sessionKey'),
|
||||
session_output = {'session_key': self.get_xml_attr(session, 'sessionKey'),
|
||||
'art': self.get_xml_attr(session, 'art'),
|
||||
'parentThumb': self.get_xml_attr(session, 'parentThumb'),
|
||||
'parent_thumb': self.get_xml_attr(session, 'parentThumb'),
|
||||
'thumb': self.get_xml_attr(session, 'thumb'),
|
||||
'user': self.get_xml_attr(session.getElementsByTagName('User')[0], 'title'),
|
||||
'friendly_name': plex_watch.get_user_friendly_name(
|
||||
self.get_xml_attr(session.getElementsByTagName('User')[0], 'title')),
|
||||
'player': self.get_xml_attr(session.getElementsByTagName('Player')[0], 'platform'),
|
||||
'state': self.get_xml_attr(session.getElementsByTagName('Player')[0], 'state'),
|
||||
'grandparentTitle': self.get_xml_attr(session, 'grandparentTitle'),
|
||||
'parentTitle': self.get_xml_attr(session, 'parentTitle'),
|
||||
'grandparent_title': self.get_xml_attr(session, 'grandparentTitle'),
|
||||
'parent_title': self.get_xml_attr(session, 'parentTitle'),
|
||||
'title': self.get_xml_attr(session, 'title'),
|
||||
'ratingKey': self.get_xml_attr(session, 'ratingKey'),
|
||||
'audioDecision': audio_decision,
|
||||
'audioChannels': audio_channels,
|
||||
'audioCodec': audio_codec,
|
||||
'videoDecision': '',
|
||||
'videoCodec': '',
|
||||
'rating_key': self.get_xml_attr(session, 'ratingKey'),
|
||||
'audio_decision': audio_decision,
|
||||
'audio_channels': audio_channels,
|
||||
'audio_codec': audio_codec,
|
||||
'video_decision': '',
|
||||
'video_codec': '',
|
||||
'height': '',
|
||||
'width': '',
|
||||
'duration': duration,
|
||||
'progress': progress,
|
||||
'progressPercent': str(helpers.get_percent(progress, duration)),
|
||||
'progress_percent': str(helpers.get_percent(progress, duration)),
|
||||
'type': 'track',
|
||||
'indexes': 0
|
||||
}
|
||||
|
@ -650,59 +673,86 @@ class PmsConnect(object):
|
|||
use_indexes = 0
|
||||
|
||||
if self.get_xml_attr(session, 'type') == 'episode':
|
||||
session_output = {'sessionKey': self.get_xml_attr(session, 'sessionKey'),
|
||||
session_output = {'session_key': self.get_xml_attr(session, 'sessionKey'),
|
||||
'art': self.get_xml_attr(session, 'art'),
|
||||
'parentThumb': self.get_xml_attr(session, 'parentThumb'),
|
||||
'parent_thumb': self.get_xml_attr(session, 'parentThumb'),
|
||||
'thumb': thumb,
|
||||
'user': self.get_xml_attr(session.getElementsByTagName('User')[0], 'title'),
|
||||
'friendly_name': plex_watch.get_user_friendly_name(
|
||||
self.get_xml_attr(session.getElementsByTagName('User')[0], 'title')),
|
||||
'player': self.get_xml_attr(session.getElementsByTagName('Player')[0], 'platform'),
|
||||
'state': self.get_xml_attr(session.getElementsByTagName('Player')[0], 'state'),
|
||||
'grandparentTitle': self.get_xml_attr(session, 'grandparentTitle'),
|
||||
'parentTitle': self.get_xml_attr(session, 'parentTitle'),
|
||||
'grandparent_title': self.get_xml_attr(session, 'grandparentTitle'),
|
||||
'parent_title': self.get_xml_attr(session, 'parentTitle'),
|
||||
'title': self.get_xml_attr(session, 'title'),
|
||||
'ratingKey': self.get_xml_attr(session, 'ratingKey'),
|
||||
'audioDecision': audio_decision,
|
||||
'audioChannels': audio_channels,
|
||||
'audioCodec': audio_codec,
|
||||
'videoDecision': video_decision,
|
||||
'videoCodec': video_codec,
|
||||
'rating_key': self.get_xml_attr(session, 'ratingKey'),
|
||||
'audio_decision': audio_decision,
|
||||
'audio_channels': audio_channels,
|
||||
'audio_codec': audio_codec,
|
||||
'video_decision': video_decision,
|
||||
'video_codec': video_codec,
|
||||
'height': height,
|
||||
'width': width,
|
||||
'duration': duration,
|
||||
'progress': progress,
|
||||
'progressPercent': str(helpers.get_percent(progress, duration)),
|
||||
'progress_percent': str(helpers.get_percent(progress, duration)),
|
||||
'type': self.get_xml_attr(session, 'type'),
|
||||
'indexes': use_indexes
|
||||
}
|
||||
elif self.get_xml_attr(session, 'type') == 'movie':
|
||||
session_output = {'sessionKey': self.get_xml_attr(session, 'sessionKey'),
|
||||
session_output = {'session_key': self.get_xml_attr(session, 'sessionKey'),
|
||||
'art': self.get_xml_attr(session, 'art'),
|
||||
'thumb': thumb,
|
||||
'parentThumb': self.get_xml_attr(session, 'parentThumb'),
|
||||
'parent_thumb': self.get_xml_attr(session, 'parentThumb'),
|
||||
'user': self.get_xml_attr(session.getElementsByTagName('User')[0], 'title'),
|
||||
'friendly_name': plex_watch.get_user_friendly_name(
|
||||
self.get_xml_attr(session.getElementsByTagName('User')[0], 'title')),
|
||||
'player': self.get_xml_attr(session.getElementsByTagName('Player')[0], 'platform'),
|
||||
'state': self.get_xml_attr(session.getElementsByTagName('Player')[0], 'state'),
|
||||
'grandparentTitle': self.get_xml_attr(session, 'grandparentTitle'),
|
||||
'parentTitle': self.get_xml_attr(session, 'parentTitle'),
|
||||
'grandparent_title': self.get_xml_attr(session, 'grandparentTitle'),
|
||||
'parent_title': self.get_xml_attr(session, 'parentTitle'),
|
||||
'title': self.get_xml_attr(session, 'title'),
|
||||
'ratingKey': self.get_xml_attr(session, 'ratingKey'),
|
||||
'audioDecision': audio_decision,
|
||||
'audioChannels': audio_channels,
|
||||
'audioCodec': audio_codec,
|
||||
'videoDecision': video_decision,
|
||||
'videoCodec': video_codec,
|
||||
'rating_key': self.get_xml_attr(session, 'ratingKey'),
|
||||
'audio_decision': audio_decision,
|
||||
'audio_channels': audio_channels,
|
||||
'audio_codec': audio_codec,
|
||||
'video_decision': video_decision,
|
||||
'video_codec': video_codec,
|
||||
'height': height,
|
||||
'width': width,
|
||||
'duration': duration,
|
||||
'progress': progress,
|
||||
'progressPercent': str(helpers.get_percent(progress, duration)),
|
||||
'progress_percent': str(helpers.get_percent(progress, duration)),
|
||||
'type': self.get_xml_attr(session, 'type'),
|
||||
'indexes': use_indexes
|
||||
}
|
||||
elif self.get_xml_attr(session, 'type') == 'clip':
|
||||
session_output = {'session_key': self.get_xml_attr(session, 'sessionKey'),
|
||||
'art': self.get_xml_attr(session, 'art'),
|
||||
'thumb': thumb,
|
||||
'parent_thumb': self.get_xml_attr(session, 'parentThumb'),
|
||||
'user': self.get_xml_attr(session.getElementsByTagName('User')[0], 'title'),
|
||||
'friendly_name': plex_watch.get_user_friendly_name(
|
||||
self.get_xml_attr(session.getElementsByTagName('User')[0], 'title')),
|
||||
'player': self.get_xml_attr(session.getElementsByTagName('Player')[0], 'platform'),
|
||||
'state': self.get_xml_attr(session.getElementsByTagName('Player')[0], 'state'),
|
||||
'grandparent_title': self.get_xml_attr(session, 'grandparentTitle'),
|
||||
'parent_title': self.get_xml_attr(session, 'parentTitle'),
|
||||
'title': self.get_xml_attr(session, 'title'),
|
||||
'rating_key': self.get_xml_attr(session, 'ratingKey'),
|
||||
'audio_decision': audio_decision,
|
||||
'audio_channels': audio_channels,
|
||||
'audio_codec': audio_codec,
|
||||
'video_decision': video_decision,
|
||||
'video_codec': video_codec,
|
||||
'height': height,
|
||||
'width': width,
|
||||
'duration': duration,
|
||||
'progress': progress,
|
||||
'progress_percent': str(helpers.get_percent(progress, duration)),
|
||||
'type': self.get_xml_attr(session, 'type'),
|
||||
'indexes': 0
|
||||
}
|
||||
else:
|
||||
logger.warn(u"No known stream types found in session list.")
|
||||
|
||||
|
@ -743,7 +793,7 @@ class PmsConnect(object):
|
|||
if a.getElementsByTagName('Video'):
|
||||
result_data = a.getElementsByTagName('Video')
|
||||
for result in result_data:
|
||||
episode_output = {'ratingKey': self.get_xml_attr(result, 'ratingKey'),
|
||||
episode_output = {'rating_key': self.get_xml_attr(result, 'ratingKey'),
|
||||
'index': self.get_xml_attr(result, 'index'),
|
||||
'title': self.get_xml_attr(result, 'title'),
|
||||
'thumb': self.get_xml_attr(result, 'thumb')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue