-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck
executable file
·37 lines (24 loc) · 1.15 KB
/
check
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /bin/sh
### Edit your Sonarr and Radarr details here ####
sonarrurl="https://sonarrurl"
sonarrapi="sonarapi"
radarrurl="https://radarurl"
radarrapi="radarrapi"
### Do not edit below here
echo What directory would you like to check?
read dir
ln -s $dir ~/tmp
echo "How long far back do you want to go (in days)"
read days
echo Starting now. If there have been many files added, this may take a long time!
cd tmp
find . -ctime -$days -type f -iname "*.mkv" ! -iname "*.mp4" ! -iname "*.mov" -exec ~/file-check/checkfile.py \{\} \; > /var/log/file-check.log
curl -d '{name: "RefreshSeries"}' -H "Content-Type: application/json" -X POST $sonarrurl/api/command?apikey=$sonarrapi
sleep 5
curl -d '{name: "missingEpisodeSearch"}' -H "Content-Type: application/json" -X POST $sonarrurl/api/command?apikey=$sonarrapi
sleep 5
curl -d '{name: "RescanMovie"}' -H "Content-Type: application/json" -X POST $radarrurl/api/command?apikey=$radarrapi
sleep 5
curl -d '{name: "missingMovieSearch"}' -H "Content-Type: application/json" -X POST $radarrurl/api/command?apikey=$radarrapi
rm -R tmp
echo $dir have finished. View the log at /var/log/plex-file-check/file-check.log