Skip to content

Commit

Permalink
Update empty.trash
Browse files Browse the repository at this point in the history
  • Loading branch information
madslundt authored Jan 24, 2018
1 parent 32c1f69 commit 4dd1d9c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion scripts/empty.trash
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ getSections() {
echo $sections
}

isRefreshing() {
refreshing=$(curl -s -G -L "${plex_url}/library/sections?X-Plex-Token=${plex_token}" | grep 'refreshing="1"')

echo $refreshing
}

emptyTrash() {
bash mountcheck

Expand All @@ -22,7 +28,15 @@ emptyTrash() {
if mountpoint -q "$cloud_dir" && mountpoint -q "$cloud_decrypt_dir" && mountpoint -q "${local_media_dir}" && [ "$(ls -A ${cloud_decrypt_dir})" ]; then
echo "Refreshing library"
curl -s -G -L "${plex_url}/library/sections/all/refresh?X-Plex-Token=${plex_token}"
sleep 60

echo "[ $(date ${date_format}) ] Library refreshing"
while true; do
sleep 10
if [[ -z $(isRefreshing) ]]; then
break
fi
done
echo "[ $(date ${date_format}) ] Library refresh completed"

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

0 comments on commit 4dd1d9c

Please sign in to comment.