From e8b5843731b9eea0f1d0e35a45993c346296744d Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Wed, 21 Feb 2024 10:23:11 -0500 Subject: [PATCH] test --- plex-token.sh | 18 +++++++++++++++--- remove_lonely_collections.py | 3 ++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/plex-token.sh b/plex-token.sh index 2f09566..956edf0 100644 --- a/plex-token.sh +++ b/plex-token.sh @@ -4,15 +4,27 @@ token_from_Pref_XML() { # ChuckPa already wrote a great function for getting host info source ./HostConfig.sh - echo "Getting Host Information" + if [[ "silent" == *"$2"* ]]; then + : + else + echo "Getting Host Information" + fi HostConfig PLEX_PREFERENCES_XML="$AppSuppDir/Plex Media Server/Preferences.xml" if [[ -f "$PLEX_PREFERENCES_XML" ]]; then + if [[ "silent" == *"$2"* ]]; then + : + else echo "Plex Preferences.xml found: $PLEX_PREFERENCES_XML" + fi # get token LOCAL_PLEX_TOKEN=`cat "${PLEX_PREFERENCES_XML}" | sed -e 's;^.* PlexOnlineToken=";;' | sed -e 's;".*$;;' | tail -1` - echo "Local Token found: $LOCAL_PLEX_TOKEN" + if [[ "silent" == *"$2"* ]]; then + echo "$LOCAL_PLEX_TOKEN" + else + echo "Local Token found: $LOCAL_PLEX_TOKEN" + fi else echo "Plex Preferences.xml not found" exit @@ -57,6 +69,6 @@ token_from_api() { case "$2" in api) token_from_api;; - ""|xml) token_from_Pref_XML;; + ""|xml|silent) token_from_Pref_XML;; *) echo "'$2' is not a valid plex-tools token command";; esac diff --git a/remove_lonely_collections.py b/remove_lonely_collections.py index e6db1ef..9811156 100644 --- a/remove_lonely_collections.py +++ b/remove_lonely_collections.py @@ -12,6 +12,7 @@ urllib3.disable_warnings() SCRIPT_DIR = pathlib.Path(os.path.dirname(os.path.abspath(__file__))) + class PLEX_INFO(): def __init__(self): @@ -32,7 +33,7 @@ class PLEX_INFO(): @property def token(self): token_script = pathlib.Path(SCRIPT_DIR).joinpath('plex-token.sh') - token_proc = subprocess.Popen(['/bin/bash', token_script, "xml"], stdout=subprocess.PIPE) + token_proc = subprocess.Popen(['/bin/bash', token_script, "silent"], stdout=subprocess.PIPE) token = token_proc.stdout.read().decode().strip("\n") token_proc.terminate() token_proc.communicate()