test
This commit is contained in:
parent
1e87ba205c
commit
e8b5843731
@ -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
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user