diff --git a/data/interfaces/default/js/script.js b/data/interfaces/default/js/script.js index 0de7d8b0..2df5daeb 100644 --- a/data/interfaces/default/js/script.js +++ b/data/interfaces/default/js/script.js @@ -853,10 +853,6 @@ function short_season(title) { return title } -function format_date_based_show(date) { - return String(date).replaceAll('-', '\u00B7') -} - function loadAllBlurHash() { $('[data-blurhash]').each(function() { const elem = $(this); diff --git a/data/interfaces/default/js/tables/history_table.js b/data/interfaces/default/js/tables/history_table.js index 863eda90..7bfa4440 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,7 +181,7 @@ history_table_options = { thumb_popover = '' + cellData + parent_info + ''; $(td).html('
' + media_type + ' ' + thumb_popover + '
'); } else if (rowData['media_type'] === 'episode') { - rowData['originally_available_at'] = format_date_based_show(rowData['originally_available_at']); + 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'] + ')'; } diff --git a/data/interfaces/default/js/tables/history_table_modal.js b/data/interfaces/default/js/tables/history_table_modal.js index bdbcc525..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,7 +114,7 @@ history_table_modal_options = { thumb_popover = '' + cellData + parent_info + ''; $(td).html('
' + media_type + ' ' + thumb_popover + '
'); } else if (rowData['media_type'] === 'episode') { - rowData['originally_available_at'] = format_date_based_show(rowData['originally_available_at']); + 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'] + ')'; } diff --git a/data/interfaces/default/js/tables/media_info_table.js b/data/interfaces/default/js/tables/media_info_table.js index 8e26c9f8..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; } }); @@ -96,7 +98,8 @@ media_info_table_options = { media_type = ''; thumb_popover = (rowData['media_index']) ? 'E' + rowData['media_index'] + ' - ' + rowData['title'] + '' - : 'E' + format_date_based_show(rowData['originally_available_at']) + ' - ' + rowData['title'] + ''; + : 'E' + moment(rowData['originally_available_at']).format(date_based_tv_show_format) + + ' - ' + rowData['title'] + ''; $(td).html('
' + media_type + ' ' + thumb_popover + '
'); } 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 9c38dd0b..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,7 @@ 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'] = format_date_based_show(rowData['originally_available_at']); + 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'] + ')'; } diff --git a/plexpy/common.py b/plexpy/common.py index c264c1ac..33b4cc00 100644 --- a/plexpy/common.py +++ b/plexpy/common.py @@ -508,7 +508,6 @@ NOTIFICATION_PARAMETERS = [ {'name': 'Season Number', 'type': 'int', 'value': 'season_num', 'description': 'The season number.', 'example': 'e.g. 1, or 1-3'}, {'name': 'Season Number 00', 'type': 'int', 'value': 'season_num00', 'description': 'The two digit season number.', 'example': 'e.g. 01, or 01-03'}, {'name': 'Episode Number', 'type': 'int', 'value': 'episode_num', 'description': 'The episode number.', 'example': 'e.g. 6, or 6-10'}, - {'name': 'Episode Number', 'type': 'str', 'value': 'episode_date', 'description': 'The episode number of date based tv shows (in date format).'}, {'name': 'Episode Number 00', 'type': 'int', 'value': 'episode_num00', 'description': 'The two digit episode number.', 'example': 'e.g. 06, or 06-10'}, {'name': 'Disc Number', 'type': 'int', 'value': 'disc_num', 'description': 'The disc number.', 'example': 'e.g. 2'}, {'name': 'Disc Number 00', 'type': 'int', 'value': 'disc_num00', 'description': 'The two digit disc number.', 'example': 'e.g. 02'},