From 11299291b0bc01daa2e15a39894cf30930f10334 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Tue, 3 Mar 2020 09:38:22 -0800 Subject: [PATCH 01/30] Remove ipaddr js XHR --- data/interfaces/default/base.html | 1 + data/interfaces/default/js/script.js | 46 +++++++++++++--------------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/data/interfaces/default/base.html b/data/interfaces/default/base.html index c32dcd08..1642af09 100644 --- a/data/interfaces/default/base.html +++ b/data/interfaces/default/base.html @@ -291,6 +291,7 @@ ${next.modalIncludes()} + % if _session['user_group'] == 'admin' and BROWSER_NOTIFIERS: diff --git a/data/interfaces/default/js/script.js b/data/interfaces/default/js/script.js index c4cd94dd..4954ebd6 100644 --- a/data/interfaces/default/js/script.js +++ b/data/interfaces/default/js/script.js @@ -258,33 +258,31 @@ $.cachedScript = function (url) { function isPrivateIP(ip_address) { var defer = $.Deferred(); - $.cachedScript('js/ipaddr.min.js').done(function () { - if (ipaddr.isValid(ip_address)) { - var addr = ipaddr.process(ip_address); + if (ipaddr.isValid(ip_address)) { + var addr = ipaddr.process(ip_address); - var rangeList = []; - if (addr.kind() === 'ipv4') { - rangeList = [ - ipaddr.parseCIDR('127.0.0.0/8'), - ipaddr.parseCIDR('10.0.0.0/8'), - ipaddr.parseCIDR('172.16.0.0/12'), - ipaddr.parseCIDR('192.168.0.0/16') - ]; - } else { - rangeList = [ - ipaddr.parseCIDR('fd00::/8') - ]; - } - - if (ipaddr.subnetMatch(addr, rangeList, -1) >= 0) { - defer.resolve(); - } else { - defer.reject(); - } + var rangeList = []; + if (addr.kind() === 'ipv4') { + rangeList = [ + ipaddr.parseCIDR('127.0.0.0/8'), + ipaddr.parseCIDR('10.0.0.0/8'), + ipaddr.parseCIDR('172.16.0.0/12'), + ipaddr.parseCIDR('192.168.0.0/16') + ]; } else { - defer.resolve('n/a'); + rangeList = [ + ipaddr.parseCIDR('fd00::/8') + ]; } - }); + + if (ipaddr.subnetMatch(addr, rangeList, -1) >= 0) { + defer.resolve(); + } else { + defer.reject(); + } + } else { + defer.resolve('n/a'); + } return defer.promise(); } From 257ea14c59a29aea79329a9497af321f1ddb8c6c Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Tue, 3 Mar 2020 10:51:27 -0800 Subject: [PATCH 02/30] Add Plex background art to notification parameters --- plexpy/common.py | 1 + plexpy/notification_handler.py | 1 + 2 files changed, 2 insertions(+) diff --git a/plexpy/common.py b/plexpy/common.py index f00976b9..bf148a0a 100644 --- a/plexpy/common.py +++ b/plexpy/common.py @@ -531,6 +531,7 @@ NOTIFICATION_PARAMETERS = [ {'name': 'Rating Key', 'type': 'int', 'value': 'rating_key', 'description': 'The unique identifier for the movie, episode, or track.'}, {'name': 'Parent Rating Key', 'type': 'int', 'value': 'parent_rating_key', 'description': 'The unique identifier for the season or album.'}, {'name': 'Grandparent Rating Key', 'type': 'int', 'value': 'grandparent_rating_key', 'description': 'The unique identifier for the TV show or artist.'}, + {'name': 'Art', 'type': 'str', 'value': 'art', 'description': 'The Plex background art for the media.'}, {'name': 'Thumb', 'type': 'str', 'value': 'thumb', 'description': 'The Plex thumbnail for the movie or episode.'}, {'name': 'Parent Thumb', 'type': 'str', 'value': 'parent_thumb', 'description': 'The Plex thumbnail for the season or album.'}, {'name': 'Grandparent Thumb', 'type': 'str', 'value': 'grandparent_thumb', 'description': 'The Plex thumbnail for the TV show or artist.'}, diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index 8b8d8d0c..caede51f 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -995,6 +995,7 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m 'rating_key': notify_params['rating_key'], 'parent_rating_key': notify_params['parent_rating_key'], 'grandparent_rating_key': notify_params['grandparent_rating_key'], + 'art': notify_params['art'], 'thumb': notify_params['thumb'], 'parent_thumb': notify_params['parent_thumb'], 'grandparent_thumb': notify_params['grandparent_thumb'], From cbab7c4cbf593646cf1988910e612b7a31e7a8e3 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Tue, 3 Mar 2020 10:58:50 -0800 Subject: [PATCH 03/30] Add clip to notification posters --- plexpy/notification_handler.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index caede51f..29728605 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -690,6 +690,13 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m poster_key = notify_params['parent_rating_key'] poster_title = '%s - %s' % (notify_params['grandparent_title'], notify_params['parent_title']) + elif notify_params['media_type'] == 'clip': + if notify_params['extra_type']: + poster_thumb = notify_params['art'].replace('/art', '/thumb') or notify_params['thumb'] + else: + poster_thumb = notify_params['parent_thumb'] or notify_params['thumb'] + poster_key = notify_params['rating_key'] + poster_title = notify_params['title'] else: poster_thumb = '' poster_key = '' From ecee50a5e445e9707505445d6327a8f7c4dd1c6f Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Tue, 3 Mar 2020 12:24:05 -0800 Subject: [PATCH 04/30] Add option to change library background art --- API.md | 1 + data/interfaces/default/edit_library.html | 15 +++- data/interfaces/default/home_stats.html | 70 ------------------ data/interfaces/default/index.html | 84 ++++++++++++++++++++++ data/interfaces/default/library.html | 4 +- data/interfaces/default/library_stats.html | 12 +++- plexpy/__init__.py | 12 +++- plexpy/datafactory.py | 10 ++- plexpy/libraries.py | 14 +++- plexpy/webserve.py | 3 + 10 files changed, 143 insertions(+), 82 deletions(-) diff --git a/API.md b/API.md index 09e471e0..0b113bd2 100644 --- a/API.md +++ b/API.md @@ -327,6 +327,7 @@ Required parameters: Optional parameters: custom_thumb (str): The URL for the custom library thumbnail + custom_art (str): The URL for the custom library background art keep_history (int): 0 or 1 Returns: diff --git a/data/interfaces/default/edit_library.html b/data/interfaces/default/edit_library.html index f8c3863a..8b36a332 100644 --- a/data/interfaces/default/edit_library.html +++ b/data/interfaces/default/edit_library.html @@ -40,13 +40,22 @@ DOCUMENTATION :: END