diff --git a/data/interfaces/default/current_activity_instance.html b/data/interfaces/default/current_activity_instance.html index fcc1b592..2e9b3e41 100644 --- a/data/interfaces/default/current_activity_instance.html +++ b/data/interfaces/default/current_activity_instance.html @@ -10,14 +10,15 @@ Variable names: data {dict} data :: Usable parameters == Global keys == -session_key Returns a unique session id for the active stream +session_key Returns a unique session id for the active stream. rating_key Returns the unique identifier for the media item. media_index Returns the index of the media item. parent_media_index Returns the index of the media item's parent. media_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. bif_thumb Returns the location of the item's bif thumbnail. Use with pms_image_proxy. -art Returns the location of the item's artwork +art Returns the location of the item's artwork. +originally_available_at Returns the air date of the item. progress_percent Returns the current progress of the item. 0 to 100. user Returns the name of the user owning the session. user_id Returns the Plex user id if available. @@ -62,7 +63,7 @@ DOCUMENTATION :: END % if session is not None: <% from collections import defaultdict - from plexpy.helpers import cast_to_int, get_percent, page, short_season + from plexpy.helpers import cast_to_int, get_percent, page, short_season, format_date_based_show from plexpy.common import VIDEO_RESOLUTION_OVERRIDES, AUDIO_CODEC_OVERRIDES, EXTRA_TYPES import plexpy %> @@ -76,6 +77,12 @@ DOCUMENTATION :: END user_href = page('user', data['user_id']) if data['user_id'] else '#' season = short_season(data['parent_title']) %> +% if not data['media_index']: +<% + data['originally_available_at'] = format_date_based_show(data['originally_available_at']) +%> +% endif +
@@ -502,8 +509,12 @@ DOCUMENTATION :: END % if data['media_type'] == 'movie': ${data['year']} % elif data['media_type'] == 'episode': - ${season} - · E${data['media_index']} + % if data['media_index']: + ${season} + · E${data['media_index']} + % else: + E${data['originally_available_at']} + % endif % elif data['media_type'] == 'track': ${data['parent_title']} % elif data['media_type'] == 'photo': diff --git a/data/interfaces/default/info.html b/data/interfaces/default/info.html index ead534a1..97771198 100644 --- a/data/interfaces/default/info.html +++ b/data/interfaces/default/info.html @@ -43,7 +43,7 @@ DOCUMENTATION :: END from plexpy import notifiers from plexpy.common import MEDIA_TYPE_HEADERS, MEDIA_FLAGS_AUDIO, MEDIA_FLAGS_VIDEO - from plexpy.helpers import page, get_percent, cast_to_int, short_season + from plexpy.helpers import page, get_percent, cast_to_int, short_season, format_date_based_show # Get audio codec file def af(codec): @@ -83,9 +83,14 @@ DOCUMENTATION :: END <% data = defaultdict(lambda: None, **metadata) media_info = defaultdict(lambda: None, **(data['media_info'][0] if data['media_info'] else {})) + episode = '' season = '' if data['media_type'] == 'episode': season = short_season(data['parent_title']) + if data['media_index']: + episode = data['media_index'] + else: + episode = format_date_based_show(data['originally_available_at']) elif data['media_type'] == 'season': season = short_season(data['title']) %> @@ -140,7 +145,7 @@ DOCUMENTATION :: END
  • ${data['parent_title']}
  • -
  • Episode ${data['media_index']} - ${data['title']}
  • +
  • Episode ${episode} - ${data['title']}
  • % elif data['media_type'] == 'artist':
  • ${data['library_name']}
  • @@ -251,9 +256,11 @@ DOCUMENTATION :: END % elif data['media_type'] == 'episode':

    ${data['grandparent_title']}

    ${data['title']}

    - % if data['media_index']: - - % endif + % if data['media_index']: + + % else: + + % endif % endif % elif data['media_type'] in ('movie', 'show', 'artist', 'collection', 'playlist', 'photo_album'):

     

    ${data['title']}

    @@ -263,7 +270,11 @@ DOCUMENTATION :: END % elif data['media_type'] == 'episode':

    ${data['grandparent_title']}

    ${data['title']}

    - + % if data['media_index']: + + % else: + + % endif % elif data['media_type'] == 'album':

    ${data['parent_title']}

    ${data['title']}

    @@ -766,9 +777,14 @@ DOCUMENTATION :: END % if metadata: <% data = defaultdict(None, **metadata) + episode = '' season = '' if data['media_type'] == 'episode': season = short_season(data['parent_title']) + if data['media_index']: + episode = data['media_index'] + else: + episode = format_date_based_show(data['originally_available_at']) elif data['media_type'] == 'season': season = short_season(data['title']) %> @@ -812,7 +828,7 @@ DOCUMENTATION :: END % elif data['media_type'] == 'season': ${data['parent_title']}
    ${data['title']} % elif data['media_type'] == 'episode': - ${data['grandparent_title']}
    ${data['title']}
    ${season} · E${data['media_index']} + ${data['grandparent_title']}
    ${data['title']}
    ${season} · E${episode} % elif data['media_type'] == 'artist': ${data['title']} % elif data['media_type'] == 'album': diff --git a/data/interfaces/default/info_children_list.html b/data/interfaces/default/info_children_list.html index d7998071..5fcbce89 100644 --- a/data/interfaces/default/info_children_list.html +++ b/data/interfaces/default/info_children_list.html @@ -19,6 +19,7 @@ data['children_list'] :: Usable paramaters == Global keys == rating_key Returns the unique identifier for the media item. media_index Returns the episode number. +originally_available_at Returns the air date of the item. title Returns the name of the episode. thumb Returns the location of the item's thumbnail. Use with pms_image_proxy. parent_thumb Returns the location of the item's parent thumbnail. Use with pms_image_proxy. @@ -28,7 +29,7 @@ DOCUMENTATION :: END % if data != None: <% - from plexpy.helpers import cast_to_int, page, short_season + from plexpy.helpers import cast_to_int, page, short_season, format_date_based_show %> % if data['children_count'] > 0:
    @@ -176,7 +177,7 @@ DOCUMENTATION :: END
    - Episode ${child['media_index'] or child['originally_available_at']} + Episode ${child['media_index'] or format_date_based_show(child['originally_available_at'])}
    diff --git a/data/interfaces/default/js/tables/history_table.js b/data/interfaces/default/js/tables/history_table.js index 7f9d578f..e369a124 100644 --- a/data/interfaces/default/js/tables/history_table.js +++ b/data/interfaces/default/js/tables/history_table.js @@ -1,5 +1,6 @@ var date_format = 'YYYY-MM-DD'; var time_format = 'hh:mm a'; +var date_based_tv_show_format = 'YYYY\u00b7MM\u00b7DD'; var history_to_delete = []; $.ajax({ @@ -8,6 +9,7 @@ $.ajax({ success: function(data) { date_format = data.date_format; time_format = data.time_format; + date_based_tv_show_format = data.date_based_tv_show_format; } }); @@ -179,9 +181,11 @@ history_table_options = { thumb_popover = '' + cellData + parent_info + ''; $(td).html(''); } else if (rowData['media_type'] === 'episode') { + rowData['originally_available_at'] = moment(rowData['originally_available_at']).format(date_based_tv_show_format); icon = (rowData['live']) ? 'fa-broadcast-tower' : 'fa-television'; icon_title = (rowData['live']) ? 'Live TV' : 'Episode'; if (!isNaN(parseInt(rowData['parent_media_index'])) && !isNaN(parseInt(rowData['media_index']))) { parent_info = ' (' + short_season(rowData['parent_title']) + ' · E' + rowData['media_index'] + ')'; } + else if (isNaN(parseInt(rowData['media_index'])) && rowData['originally_available_at']) { parent_info = ' (' + rowData['originally_available_at'] + ')'; } else if (rowData['live'] && rowData['originally_available_at']) { parent_info = ' (' + rowData['originally_available_at'] + ')'; } media_type = ''; thumb_popover = '' + cellData + parent_info + ''; diff --git a/data/interfaces/default/js/tables/history_table_modal.js b/data/interfaces/default/js/tables/history_table_modal.js index 87ac4715..8d3a91a6 100644 --- a/data/interfaces/default/js/tables/history_table_modal.js +++ b/data/interfaces/default/js/tables/history_table_modal.js @@ -1,5 +1,6 @@ var date_format = 'YYYY-MM-DD'; var time_format = 'hh:mm a'; +var date_based_tv_show_format = 'YYYY\u00b7MM\u00b7DD'; $.ajax({ url: 'get_date_formats', @@ -7,6 +8,7 @@ $.ajax({ success: function(data) { date_format = data.date_format; time_format = data.time_format; + date_based_tv_show_format = data.date_based_tv_show_format; } }); @@ -112,9 +114,11 @@ history_table_modal_options = { thumb_popover = '' + cellData + parent_info + ''; $(td).html(''); } else if (rowData['media_type'] === 'episode') { + rowData['originally_available_at'] = moment(rowData['originally_available_at']).format(date_based_tv_show_format); icon = (rowData['live']) ? 'fa-broadcast-tower' : 'fa-television'; icon_title = (rowData['live']) ? 'Live TV' : 'Episode'; if (!isNaN(parseInt(rowData['parent_media_index'])) && !isNaN(parseInt(rowData['media_index']))) { parent_info = ' (' + short_season(rowData['parent_title']) + ' · E' + rowData['media_index'] + ')'; } + else if (isNaN(parseInt(rowData['media_index'])) && rowData['originally_available_at']) { parent_info = ' (' + rowData['originally_available_at'] + ')'; } else if (rowData['live'] && rowData['originally_available_at']) { parent_info = ' (' + rowData['originally_available_at'] + ')'; } media_type = ''; thumb_popover = '' + cellData + parent_info + ''; diff --git a/data/interfaces/default/js/tables/media_info_table.js b/data/interfaces/default/js/tables/media_info_table.js index f4d80d53..8cc9812b 100644 --- a/data/interfaces/default/js/tables/media_info_table.js +++ b/data/interfaces/default/js/tables/media_info_table.js @@ -1,5 +1,6 @@ var date_format = 'YYYY-MM-DD'; var time_format = 'hh:mm a'; +var date_based_tv_show_format = 'YYYY\u00b7MM\u00b7DD'; $.ajax({ url: 'get_date_formats', @@ -7,6 +8,7 @@ $.ajax({ success: function (data) { date_format = data.date_format; time_format = data.time_format; + date_based_tv_show_format = data.date_based_tv_show_format; } }); @@ -94,7 +96,10 @@ media_info_table_options = { $(td).html(''); } else if (rowData['media_type'] === 'episode') { media_type = ''; - thumb_popover = 'E' + rowData['media_index'] + ' - ' + rowData['title'] + ''; + thumb_popover = (rowData['media_index']) ? + 'E' + rowData['media_index'] + ' - ' + rowData['title'] + '' + : 'E' + moment(rowData['originally_available_at']).format(date_based_tv_show_format) + + ' - ' + rowData['title'] + ''; $(td).html(''); } else if (rowData['media_type'] === 'artist') { media_type = ''; diff --git a/data/interfaces/default/js/tables/users.js b/data/interfaces/default/js/tables/users.js index 524ee09a..01c57da5 100644 --- a/data/interfaces/default/js/tables/users.js +++ b/data/interfaces/default/js/tables/users.js @@ -1,5 +1,14 @@ var users_to_delete = []; var users_to_purge = []; +var date_based_tv_show_format = 'YYYY\u00b7MM\u00b7DD'; + +$.ajax({ + url: 'get_date_formats', + type: 'GET', + success: function (data) { + date_based_tv_show_format = data.date_based_tv_show_format; + } +}); function toggleEditNames() { if ($('.edit-control').hasClass('hidden')) { @@ -211,7 +220,9 @@ users_list_table_options = { } else if (rowData['media_type'] === 'episode') { icon = (rowData['live']) ? 'fa-broadcast-tower' : 'fa-television'; icon_title = (rowData['live']) ? 'Live TV' : 'Episode'; + rowData['originally_available_at'] = moment(rowData['originally_available_at']).format(date_based_tv_show_format); if (!isNaN(parseInt(rowData['parent_media_index'])) && !isNaN(parseInt(rowData['media_index']))) { parent_info = ' (' + short_season(rowData['parent_title']) + ' · E' + rowData['media_index'] + ')'; } + else if (isNaN(parseInt(rowData['media_index'])) && rowData['originally_available_at']) { parent_info = ' (' + rowData['originally_available_at'] + ')'; } else if (rowData['live'] && rowData['originally_available_at']) { parent_info = ' (' + rowData['originally_available_at'] + ')'; } media_type = ''; thumb_popover = '' + cellData + parent_info + ''; diff --git a/data/interfaces/default/library_recently_added.html b/data/interfaces/default/library_recently_added.html index 4cf56d8e..89cf7011 100644 --- a/data/interfaces/default/library_recently_added.html +++ b/data/interfaces/default/library_recently_added.html @@ -19,6 +19,7 @@ parent_title Returns the name of the artist. grandparent_title Returns the name of the show. media_index Returns the index number of the episode. parent_media_index Returns the index number of the season. +originally_available_at Returns the air date of the media item. section_id Returns the library section number of the media item. library_name Returns the library section name of the media item. year Returns the release year of the movie, episode, or album. @@ -32,7 +33,7 @@ DOCUMENTATION :: END % if data: <% - from plexpy.helpers import page, short_season + from plexpy.helpers import page, short_season, format_date_based_show %>
    @@ -78,8 +79,12 @@ DOCUMENTATION :: END ${item['title']}

    + % if item['media_index']: ${short_season(item['parent_title'])} · E${item['media_index']} + % else: + E${format_date_based_show(item['originally_available_at'])} + % endif

    % elif item['media_type'] == 'movie':

    diff --git a/data/interfaces/default/recently_added.html b/data/interfaces/default/recently_added.html index 74d5e561..294b5d75 100644 --- a/data/interfaces/default/recently_added.html +++ b/data/interfaces/default/recently_added.html @@ -19,6 +19,7 @@ parent_title Returns the name of the artist. grandparent_title Returns the name of the show. media_index Returns the index number of the episode. parent_media_index Returns the index number of the season. +originally_available_at Returns the air date of the media item. section_id Returns the library section number of the media item. library_name Returns the library section name of the media item. year Returns the release year of the movie, episode, or album. @@ -32,7 +33,7 @@ DOCUMENTATION :: END % if data != None: <% - from plexpy.helpers import cast_to_int, page, short_season + from plexpy.helpers import cast_to_int, page, short_season, format_date_based_show %> % if data:
    @@ -146,9 +147,14 @@ DOCUMENTATION :: END ${item['title']}

    + % if item['media_index']: ${short_season(item['parent_title'])} · E${item['media_index']} + % else: + + E${format_date_based_show(item['originally_available_at'])} + % endif

    % elif item['media_type'] == 'album': diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index 562a53af..91bca58c 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -126,6 +126,15 @@

    Set your preferred time format. Click here to see the parameter list.

    +
    + +
    +
    + +
    +
    +

    Set your preferred display format for date based tv shows.

    +