X Tutup
Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit d4a89be

Browse files
committed
Plex: Fix transcode path if set to non-default /transcodes.
1 parent f8b2035 commit d4a89be

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

roles/plex/tasks/main.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
- "/opt/plex/Library/Application Support/Plex Media Server/Plug-ins"
2727
- "/opt/plex/Library/Logs"
2828
- "/opt/plex/Library/Logs/Plex Media Server"
29-
- "{{ plex.transcodes }}/1"
30-
- "{{ plex.transcodes }}/2"
29+
- "{{ plex.transcodes }}/plex"
3130

3231
- name: "Stop and remove any existing container"
3332
docker_container:
@@ -48,24 +47,39 @@
4847
path: "/opt/plex/Library/Application Support/Plex Media Server/Preferences.xml"
4948
register: preferences_xml
5049

51-
- name: Check 'Preferences.xml' for Plex Token
50+
- name: "'Preferences.xml' Tasks"
5251
block:
5352

5453
- name: Get 'Preferences.xml' XML data
5554
xml:
5655
path: "/opt/plex/Library/Application Support/Plex Media Server/Preferences.xml"
5756
xpath: /Preferences
5857
content: attribute
59-
attribute: PlexOnlineToken
6058
register: preferences_xml_resp
6159
ignore_errors: yes
6260

63-
- name: "Remove 'Preferences.xml' file when malformed"
61+
- name: "Remove 'Preferences.xml' if malformed"
6462
file:
6563
path: "/opt/plex/Library/Application Support/Plex Media Server/Preferences.xml"
6664
state: absent
6765
when: (preferences_xml_resp is failed)
6866

67+
- name: Set 'transcoder_path_fix' variable
68+
set_fact:
69+
transcoder_path_fix: "{{ (preferences_xml_resp is succeeded) and
70+
(preferences_xml_resp.matches[0].Preferences.TranscoderTempDirectory is defined) and
71+
(preferences_xml_resp.matches[0].Preferences.TranscoderTempDirectory | trim == '/transcodes') }}"
72+
73+
- name: "Fix 'TranscoderTempDirectory'"
74+
xml:
75+
path: "/opt/plex/Library/Application Support/Plex Media Server/Preferences.xml"
76+
xpath: /Preferences
77+
attribute: TranscoderTempDirectory
78+
value: "/transcode"
79+
state: present
80+
ignore_errors: yes
81+
when: (transcoder_path_fix)
82+
6983
- name: Set 'plex_server_claimed' variable
7084
set_fact:
7185
plex_server_claimed: "{{ (preferences_xml_resp is succeeded) and
@@ -137,12 +151,11 @@
137151
- "/etc/localtime:/etc/localtime:ro"
138152
- "/opt/plex:/config"
139153
- "/opt/scripts:/scripts"
140-
- "{{ plex.transcodes }}/1:/transcode"
141-
- "{{ plex.transcodes }}/2:/transcodes"
142154
- "/mnt/unionfs/Media:/data"
143155
- "/mnt:/mnt"
144156
- "/tmp:/tmp"
145157
- "/dev/shm:/dev/shm"
158+
- "{{ plex.transcodes }}/plex:/transcode"
146159
devices: "{{ '/dev/dri:/dev/dri' if (gpu.intel and dev_dri.stat.exists) | default(false) else omit }}"
147160
etc_hosts: "{{ (plex_default_hosts) | combine(plex_custom_hosts|default([])) }}"
148161
labels:

0 commit comments

Comments
 (0)
X Tutup