Skip to content

Commit 4dd1d9c

Browse files
authored
Update empty.trash
1 parent 32c1f69 commit 4dd1d9c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

scripts/empty.trash

+15-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ getSections() {
1111
echo $sections
1212
}
1313

14+
isRefreshing() {
15+
refreshing=$(curl -s -G -L "${plex_url}/library/sections?X-Plex-Token=${plex_token}" | grep 'refreshing="1"')
16+
17+
echo $refreshing
18+
}
19+
1420
emptyTrash() {
1521
bash mountcheck
1622

@@ -22,7 +28,15 @@ emptyTrash() {
2228
if mountpoint -q "$cloud_dir" && mountpoint -q "$cloud_decrypt_dir" && mountpoint -q "${local_media_dir}" && [ "$(ls -A ${cloud_decrypt_dir})" ]; then
2329
echo "Refreshing library"
2430
curl -s -G -L "${plex_url}/library/sections/all/refresh?X-Plex-Token=${plex_token}"
25-
sleep 60
31+
32+
echo "[ $(date ${date_format}) ] Library refreshing"
33+
while true; do
34+
sleep 10
35+
if [[ -z $(isRefreshing) ]]; then
36+
break
37+
fi
38+
done
39+
echo "[ $(date ${date_format}) ] Library refresh completed"
2640

2741
sections=$(getSections)
2842
if [ -z "${sections}" ]; then

0 commit comments

Comments
 (0)