From 5de2cf85c380e09bb2614dbaf952dd61ff9f951c Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Thu, 9 May 2024 20:49:06 -0700 Subject: [PATCH 1/9] Workaround users remaining in friends list without shared libraries --- plexpy/users.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plexpy/users.py b/plexpy/users.py index 974d30cd..67293800 100644 --- a/plexpy/users.py +++ b/plexpy/users.py @@ -63,13 +63,15 @@ def refresh_users(): new_users = [] for item in result: - user_ids.append(helpers.cast_to_int(item['user_id'])) - if item.get('shared_libraries'): item['shared_libraries'] = ';'.join(item['shared_libraries']) + # Only add user if libraries are shared + user_ids.add(helpers.cast_to_int(item['user_id'])) elif item.get('server_token'): libs = libraries.Libraries().get_sections() item['shared_libraries'] = ';'.join([str(l['section_id']) for l in libs]) + # Only add user if libraries are shared + user_ids.add(helpers.cast_to_int(item['user_id'])) keys_dict = {"user_id": item.pop('user_id')} @@ -101,7 +103,7 @@ def refresh_users(): query = "UPDATE users SET is_active = 0 WHERE user_id NOT IN ({})".format(", ".join(["?"] * len(user_ids))) monitor_db.action(query=query, args=user_ids) - # Add new users to loger username filter + # Add new users to logger username filter logger.filter_usernames(new_users) logger.info("Tautulli Users :: Users list refreshed.") From 65905a6647de6a52a87a357c2f144d5ed567783f Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Thu, 9 May 2024 21:52:39 -0700 Subject: [PATCH 2/9] Fix escaping regex string --- plexpy/helpers.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plexpy/helpers.py b/plexpy/helpers.py index c2594412..b2be62e2 100644 --- a/plexpy/helpers.py +++ b/plexpy/helpers.py @@ -345,7 +345,7 @@ def bytes_to_mb(bytes): def mb_to_bytes(mb_str): - result = re.search('^(\d+(?:\.\d+)?)\s?(?:mb)?', mb_str, flags=re.I) + result = re.search(r'^(\d+(?:\.\d+)?)\s?(?:mb)?', mb_str, flags=re.I) if result: return int(float(result.group(1)) * 1048576) @@ -395,9 +395,9 @@ def replace_all(text, dic, normalize=False): def replace_illegal_chars(string, type="file"): if type == "file": - string = re.sub('[\?"*:|<>/]', '_', string) + string = re.sub(r'[\?"*:|<>/]', '_', string) if type == "folder": - string = re.sub('[:\?<>"|]', '_', string) + string = re.sub(r'[:\?<>"|]', '_', string) return string @@ -405,14 +405,14 @@ def replace_illegal_chars(string, type="file"): def cleanName(string): pass1 = latinToAscii(string).lower() - out_string = re.sub('[\.\-\/\!\@\#\$\%\^\&\*\(\)\+\-\"\'\,\;\:\[\]\{\}\<\>\=\_]', '', pass1).encode('utf-8') + out_string = re.sub(r'[\.\-\/\!\@\#\$\%\^\&\*\(\)\+\-\"\'\,\;\:\[\]\{\}\<\>\=\_]', '', pass1).encode('utf-8') return out_string def cleanTitle(title): - title = re.sub('[\.\-\/\_]', ' ', title).lower() + title = re.sub(r'[\.\-\/\_]', ' ', title).lower() # Strip out extra whitespace title = ' '.join(title.split()) From dcec1f6f5f661164ef39856cc01f9b91b1b9158a Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Thu, 9 May 2024 21:55:26 -0700 Subject: [PATCH 3/9] Update snapcraft git data folder --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 612b189d..6f76e8cc 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -38,7 +38,7 @@ parts: - python3-pkg-resources override-pull: | craftctl default - git config --global --add safe.directory /root/parts/tautulli/src + git config --global --add safe.directory /data/parts/tautulli/src TAG_FULL=$(git describe --tag) TAG=$(echo $TAG_FULL | grep -oP '(v\d+\.\d+\.\d+(?>-beta)?)') BRANCH=$(git rev-parse --abbrev-ref HEAD) From de3393d62b3bef3c83a1f368ab12bc77b0114a87 Mon Sep 17 00:00:00 2001 From: Tom Niget Date: Fri, 10 May 2024 07:18:08 +0200 Subject: [PATCH 4/9] Remove Python 2 handling code (#2098) * Remove Python 2 update modal * Remove Python 2 handling code * Remove backports dependencies * Remove uses of future and __future__ * Fix import * Remove requirements * Update lib folder * Clean up imports and blank lines --------- Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> --- Tautulli.py | 1 - data/interfaces/default/index.html | 34 - .../default/newsletter_preview.html | 2 +- lib/backports/__init__.py | 2 +- lib/backports/csv.py | 979 ------ lib/backports/functools_lru_cache.py | 243 -- lib/backports/tarfile/__init__.py | 2902 +++++++++++++++++ lib/backports/tarfile/__main__.py | 5 + .../tarfile}/compat/__init__.py | 0 lib/backports/tarfile/compat/py38.py | 24 + lib/future/__init__.py | 19 +- lib/future/backports/datetime.py | 2 +- .../backports/email/_header_value_parser.py | 2 +- lib/future/backports/email/parser.py | 4 +- lib/future/backports/http/cookiejar.py | 2 +- lib/future/backports/test/support.py | 32 - lib/future/backports/xmlrpc/client.py | 9 +- lib/future/builtins/__init__.py | 2 +- lib/future/moves/_dummy_thread.py | 11 +- lib/future/moves/multiprocessing.py | 7 + lib/future/moves/test/support.py | 9 + lib/future/standard_library/__init__.py | 14 +- lib/future/types/newint.py | 8 +- lib/future/types/newrange.py | 2 +- lib/inflect/__init__.py | 313 +- lib/inflect/compat/pydantic.py | 19 - lib/inflect/compat/pydantic1.py | 8 - lib/jaraco/classes/ancestry.py | 68 - lib/jaraco/classes/meta.py | 66 - lib/jaraco/classes/properties.py | 170 - lib/jaraco/collections/__init__.py | 56 +- lib/jaraco/context.py | 137 +- lib/jaraco/functools/__init__.pyi | 3 - lib/libfuturize/fixer_util.py | 12 +- lib/libfuturize/fixes/fix_metaclass.py | 4 +- lib/libpasteurize/fixes/fix_imports.py | 1 + lib/libpasteurize/fixes/fix_unpacking.py | 8 +- lib/past/__init__.py | 4 +- lib/past/builtins/misc.py | 9 +- lib/past/translation/__init__.py | 258 +- lib/typeguard/__init__.py | 48 + lib/typeguard/_checkers.py | 910 ++++++ lib/typeguard/_config.py | 108 + lib/typeguard/_decorators.py | 235 ++ lib/typeguard/_exceptions.py | 42 + lib/typeguard/_functions.py | 308 ++ lib/typeguard/_importhook.py | 213 ++ lib/typeguard/_memo.py | 48 + lib/typeguard/_pytest_plugin.py | 126 + lib/typeguard/_suppression.py | 86 + lib/typeguard/_transformer.py | 1229 +++++++ lib/typeguard/_union_transformer.py | 55 + lib/typeguard/_utils.py | 163 + lib/typeguard/py.typed | 0 lib/typing_extensions.py | 203 +- plexpy/__init__.py | 82 +- plexpy/activity_handler.py | 27 +- plexpy/activity_pinger.py | 34 +- plexpy/activity_processor.py | 24 +- plexpy/api2.py | 46 +- plexpy/classes.py | 75 - plexpy/common.py | 8 +- plexpy/config.py | 12 +- plexpy/database.py | 12 +- plexpy/datafactory.py | 34 +- plexpy/datatables.py | 14 +- plexpy/exceptions.py | 2 - plexpy/exporter.py | 25 +- plexpy/graphs.py | 27 +- plexpy/helpers.py | 34 +- plexpy/http_handler.py | 14 +- plexpy/libraries.py | 38 +- plexpy/lock.py | 10 +- plexpy/log_reader.py | 9 +- plexpy/logger.py | 12 +- plexpy/macos.py | 11 +- plexpy/mobile_app.py | 15 +- plexpy/newsletter_handler.py | 16 +- plexpy/newsletters.py | 38 +- plexpy/notification_handler.py | 61 +- plexpy/notifiers.py | 53 +- plexpy/plex.py | 9 - plexpy/plexivity_import.py | 24 +- plexpy/plextv.py | 33 +- plexpy/plexwatch_import.py | 21 +- plexpy/pmsconnect.py | 36 +- plexpy/request.py | 15 +- plexpy/session.py | 11 +- plexpy/users.py | 33 +- plexpy/version.py | 2 - plexpy/versioncheck.py | 26 +- plexpy/web_socket.py | 20 +- plexpy/webauth.py | 21 +- plexpy/webserve.py | 119 +- plexpy/webstart.py | 14 +- plexpy/windows.py | 12 +- requirements.txt | 6 +- 97 files changed, 7443 insertions(+), 2917 deletions(-) delete mode 100644 lib/backports/csv.py delete mode 100644 lib/backports/functools_lru_cache.py create mode 100644 lib/backports/tarfile/__init__.py create mode 100644 lib/backports/tarfile/__main__.py rename lib/{inflect => backports/tarfile}/compat/__init__.py (100%) create mode 100644 lib/backports/tarfile/compat/py38.py create mode 100644 lib/future/moves/multiprocessing.py delete mode 100644 lib/inflect/compat/pydantic.py delete mode 100644 lib/inflect/compat/pydantic1.py delete mode 100644 lib/jaraco/classes/ancestry.py delete mode 100644 lib/jaraco/classes/meta.py delete mode 100644 lib/jaraco/classes/properties.py create mode 100644 lib/typeguard/__init__.py create mode 100644 lib/typeguard/_checkers.py create mode 100644 lib/typeguard/_config.py create mode 100644 lib/typeguard/_decorators.py create mode 100644 lib/typeguard/_exceptions.py create mode 100644 lib/typeguard/_functions.py create mode 100644 lib/typeguard/_importhook.py create mode 100644 lib/typeguard/_memo.py create mode 100644 lib/typeguard/_pytest_plugin.py create mode 100644 lib/typeguard/_suppression.py create mode 100644 lib/typeguard/_transformer.py create mode 100644 lib/typeguard/_union_transformer.py create mode 100644 lib/typeguard/_utils.py create mode 100644 lib/typeguard/py.typed delete mode 100644 plexpy/classes.py diff --git a/Tautulli.py b/Tautulli.py index 04a6778e..8616df81 100755 --- a/Tautulli.py +++ b/Tautulli.py @@ -23,7 +23,6 @@ import sys # Ensure lib added to path, before any other imports sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib')) -from future.builtins import str import argparse import datetime diff --git a/data/interfaces/default/index.html b/data/interfaces/default/index.html index 4a74b2e4..6e4818c7 100644 --- a/data/interfaces/default/index.html +++ b/data/interfaces/default/index.html @@ -212,28 +212,6 @@ -<% from plexpy.helpers import anon_url %> - % endif