-
Notifications
You must be signed in to change notification settings - Fork 0
/
movielist
executable file
·89 lines (71 loc) · 2.57 KB
/
movielist
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
###############################################################################
# Movie List Creator Script by Luis Alvarado
# Creates File with Movie Name, Resolution, File Type & Quality
# CONFIG Variables
# FOLDER Variable is where all your movies are. Must not end with a backslash.
# NOTE: The name of the movies is extracted from the movie's folder, if the
# folder is called "..Movies/The Rabbit" then the name of the movie in
# that folder would be "The Rabbit".
folder="/media/cyrex/xtreme/movies"
# FINAL Variable is the name of the file you wish to create with the Movie List.
final="final.txt"
vcd="vcdmovies.txt"
dvd="dvdmovies.txt"
# NOTE: Movie Name can not have a comma "," in the name since this is the
# separator used to check the quality of the movie.
###############################################################################
here=$(pwd)
percent=$(ls "$folder/"|wc -l| while read pipe; do echo "scale=3; 100/$pipe"; done|bc)
total=$(ls "$folder/"|wc -l)
movies=0
quality=1
clear
echo "Processing Movies..."
echo ""
rm tempmovies 2> /dev/null
for dir in "$folder"/*
do
(cd "$dir" && found=$(pwd) && echo ${found##/*/}|tr -s '\n' ', ' >> $here/tempmovies &&
exiftool -ext .mkv -ext .m4v -ext .mp4 -ext .avi -ext .mpg * -p '$ImageSize, $FileType' >> $here/tempmovies)
let movies++
base=$(echo "scale=3; $percent * $movies" | bc)
if (($movies == $total))
then
echo -ne " Total: 100% Done / $movies Movies Added!"\\r
else
echo -ne " Total: $base% Done / $movies Movies Added!"\\r
fi
done
echo " "
echo " Detecting Movie Quality..."
echo " "
rm "$final" 2> /dev/null
cat tempmovies | while read MovieName;
do
echo -ne " Summary: $quality Quality Checks Done!"\\r
echo "$MovieName" | cut -d ',' -f2 | cut -d 'x' -f2 | sort | uniq | while read MovieRes;
do
if (($MovieRes>=241 && $MovieRes<=370)) ; then echo "$MovieName, DVD"
elif (($MovieRes>=371 && $MovieRes<=524)) ; then echo "$MovieName, 480p SD"
elif (($MovieRes>=525 && $MovieRes<=779)) ; then echo "$MovieName, 720p HD"
elif (($MovieRes>=780)) ; then echo "$MovieName, 1080p HD"
else echo "$MovieName, VCD"
fi >> "$final"
done
let quality++
done
hd=$(cat "$final" |grep -e "1080p HD" -e "720p HD"|wc -l)
sd=$(cat "$final" |grep -ve "1080p HD" -ve "720p HD"|wc -l)
echo " "
echo "----------------"
cat "$final" | cut -d ',' -f4| sort | uniq -c
echo "----------------"
echo " "
echo "$hd HD Total Movies"
echo "$sd SD Total Movies"
echo " "
cat "$final" | grep -e "VCD" > "$vcd"
cat "$final" | grep -e "DVD" > "$dvd"
rm tempmovies 2> /dev/null
echo "File $final Created!"