Skip to content

Commit

Permalink
plex_dupe
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDoobPG authored and MrDoobPG committed Nov 20, 2019
1 parent 3f41100 commit f2b307e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 29 deletions.
7 changes: 3 additions & 4 deletions menu/plex_dupe/plex_dupe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ touch /var/plex_dupe/plex.pw
touch /var/plex_dupe/plex.user
touch /var/plex_dupe/plex.token
touch /var/plex_dupe/plex.authdel

variable /var/plex_dupe/plex.authdel false
echo -e "1" >/var/plex_dupe/plex.authdel

# FUNCTIONS START ##############################################################
variable() {
Expand Down Expand Up @@ -163,11 +162,11 @@ EOF

case $typed in
1)
echo "true" >/var/plex_dupe/plex.authdel
echo -e "true" >/var/plex_dupe/plex.authdel
question1
;;
2)
echo "false" >/var/plex_dupe/plex.authdel
echo -e "false" >/var/plex_dupe/plex.authdel
question1
;;
z)
Expand Down
22 changes: 2 additions & 20 deletions menu/plex_dupe/scripts/plex_pw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,26 +114,8 @@ EOF
question3() {
echo "$pw" >/var/plex_dupe/plex.pw
echo "$user" >/var/plex_dupe/plex.user
PLEX_LOGIN=$(cat /var/plex_dupe/plex.user)
PLEX_PASSWORD=$(cat /var/plex_dupe/plex.pw)

curl -qu "${PLEX_LOGIN}":"${PLEX_PASSWORD}" 'https://plex.tv/users/sign_in.xml' \
-X POST -H 'X-Plex-Device-Name: PlexMediaServer' \
-H 'X-Plex-Provides: server' \
-H 'X-Plex-Version: 0.9' \
-H 'X-Plex-Platform-Version: 0.9' \
-H 'X-Plex-Platform: xcid' \
-H 'X-Plex-Product: Plex Media Server'\
-H 'X-Plex-Device: Linux'\
-H 'X-Plex-Client-Identifier: XXXX' --compressed >/tmp/plex_sign_in
X_PLEX_TOKEN=$(sed -n 's/.*<authentication-token>\(.*\)<\/authentication-token>.*/\1/p' /tmp/plex_sign_in)
if [ -z "$X_PLEX_TOKEN" ]; then
cat /tmp/plex_sign_in
rm -f /tmp/plex_sign_in
>&2 echo 'Failed to retrieve the X-Plex-Token.'
exit 1
fi
echo $X_PLEX_TOKEN >/var/plex_dupe/plex.token

bash /opt/plexguide/menu/plex_dupe/scripts/plex_token.sh

token=$(cat /var/plex_dupe/plex.token)
if [ "$token" != "" ]; then
Expand Down
1 change: 1 addition & 0 deletions menu/plex_dupe/scripts/plex_token.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ if [ -z "$X_PLEX_TOKEN" ]; then
>&2 echo 'Failed to retrieve the X-Plex-Token.'
exit 1
fi
echo $X_PLEX_TOKEN >/var/plex_dupe/plex.token
20 changes: 15 additions & 5 deletions menu/roles/plex_dupefinder/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,25 @@
with_items:
- /opt/plex_dupefinder

- name: Clone plex_dupefinder
- name: Clone plex_dupefinder | HEAD
git:
repo: https://github.com/l3uddz/plex_dupefinder.git
dest: /opt/plex_dupefinder
clone: yes
version: HEAD
force: yes
ignore_errors: yes

- name: Clone plex_dupefinder repo | 'master'
git:
repo: https://github.com/l3uddz/plex_dupefinder.git
dest: /opt/plex_dupefinder
clone: yes
version: master
force: yes
become: yes
become_user: "1000"
when: plex_autoscan_clone_status is failed

- name: Install pip requirements
pip:
Expand All @@ -57,17 +67,17 @@
template:
src: config.json.j2
dest: /opt/plex_dupefinder/config.json
owner: "1000"
group: "1000"
owner: '1000'
group: '1000'
mode: 0775
force: no
when: not plex_dupefinder_config.stat.exists

- name: Set plexdupes.py as executable
file:
path: /opt/plex_dupefinder/plex_dupefinder.py
owner: "1000"
group: "1000"
owner: '1000'
group: '1000'
mode: a+x

- name: "Create /usr/local/bin symlink"
Expand Down

0 comments on commit f2b307e

Please sign in to comment.