Set max width on media title in history tables

Add watch history to show media info page
This commit is contained in:
Tim 2015-06-23 14:10:37 +02:00
parent 01601605e1
commit a4a44ec34f
6 changed files with 30 additions and 6 deletions

View file

@ -65,9 +65,9 @@ A python based web front-end for plexWatch.
- top 10 viewed tv shows
- top 10 viewed tv episodes
* content information pages **PARTIALLY IMPLEMENTED**
* content information pages
- movies (includes watching history)
- tv shows (includes top 10 watched episodes)
- tv shows (includes watching history)
- tv seasons
- tv episodes (includes watching history)

View file

@ -8149,4 +8149,10 @@ ol.test >li {
background-color: #282828;
margin-right: 20px;
margin-bottom: 20px;
}
.history-table-title {
text-overflow: ellipsis;
overflow: hidden;
max-width: 350px;
}

View file

@ -136,7 +136,7 @@
<div class='row-fluid'>
<div class='span12'>
<div class='wellbg'>
% if metadata['type'] == 'movie' or metadata['type'] == 'episode':
% if metadata['type'] == 'movie' or metadata['type'] == 'episode' or metadata['type'] == 'show':
<div class="wellheader">
<div class="dashboard-wellheader">
<h3>Watch history for <strong>${metadata['title']}</strong></h3>
@ -221,7 +221,21 @@
history_table.column(5).visible(false);
});
</script>
%endif
% elif metadata['type'] == 'show':
<script src="interfaces/default/js/tables/history_table.js"></script>
<script>
$(document).ready(function () {
history_table_options.ajax = {
"url": "get_history",
"data": function(d) {
d.grandparent_rating_key = ${metadata['ratingKey']};
}
}
history_table = $('#history_table').DataTable(history_table_options);
});
</script>
% endif
% if metadata['type'] == 'season':
<script>
$.ajax({

View file

@ -82,7 +82,7 @@ history_table_options = {
"name":"title",
"createdCell": function (td, cellData, rowData, row, col) {
if (cellData !== '') {
$(td).html('<a href="info?rating_key=' + rowData['rating_key'] + '">' + cellData + '</a>');
$(td).html('<div class="history-table-title"><a href="info?rating_key=' + rowData['rating_key'] + '">' + cellData + '</a></div>');
}
}
},

View file

@ -224,7 +224,8 @@ class PlexWatch(object):
'xml',
'round((julianday(datetime(stopped, "unixepoch", "localtime")) - \
julianday(datetime(time, "unixepoch", "localtime"))) * 86400) - \
(case when paused_counter is null then 0 else paused_counter end) as duration'
(case when paused_counter is null then 0 else paused_counter end) as duration,'
'grandparentRatingKey as grandparent_rating_key'
]
try:
query = data_tables.ssp_query(table_name=self.get_history_table_name(),

View file

@ -362,6 +362,9 @@ class WebInterface(object):
if 'rating_key' in kwargs:
rating_key = kwargs.get('rating_key', "")
custom_where = 'rating_key = %s' % rating_key
if 'grandparent_rating_key' in kwargs:
rating_key = kwargs.get('grandparent_rating_key', "")
custom_where = 'grandparent_rating_key = %s' % rating_key
plex_watch = plexwatch.PlexWatch()
history = plex_watch.get_history(start, length, kwargs, custom_where)