forked from dericed/dvcapture
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqc.sh
executable file
·105 lines (90 loc) · 3 KB
/
qc.sh
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
# Interactively generates a quality control log.
# Takes a single file path as an input and outputs a report as a csv text file in the submission documentation folder.
# path to location of previously captured files
capture_dir=/media/storage/dvgrabs
usage ()
{
echo 'Usage : qc.sh -c <catalog number> -t <tape number (zero padded)> [--analyze-only]'
exit
}
if [ "$#" -eq 0 ]
then
echo "Enter the catalog number:"
read -r catnum
echo "Enter the tape number:"
read -r tapenum
fi
while [ "$1" != "" ]
do
case "$1" in
-c ) shift
catnum=$1
;;
-t ) shift
tapenum=$1
;;
--analyze-only ) shift
analyze_only=true
;;
esac
shift
done
package_path=$capture_dir/$catnum
# Check if file exists and if it is an 'mov' or an 'm2t'
if [ -f "$package_path/objects/$catnum/$catnum-02-$tapenum-src.mov" ]
then
container="mov"
elif [ -f "$package_path/objects/$catnum/$catnum-02-$tapenum-src.m2t" ]
then
container="m2t"
else
echo "No file for catalog number $catnum, tape $tapenum found."
exit 1
fi
# where all files from each set of tapes is stored
video_file=$package_path/objects/$catnum/$catnum-02-$tapenum-src.$container # path to file being QC-ed
documentation_path=$package_path/metadata/submissionDocumentation
capture_log_path=$documentation_path/$catnum-02-$tapenum-src
dvanalysis_path=$capture_log_path/$catnum-02-$tapenum-src_analysis
QC_log=$documentation_path/$catnum-qc.csv
# If the file is DV, check if dvanalyzer has been run and open the chart for QC
if [ "$container" = "m2t" ]
then
echo "This is an m2t file. No dvanalyzer graph was created."
else
if [ ! -d "$dvanalysis_path" ]
then
echo "dvanalyzer has not been run for $catnum-02-$tapenum-src.$container"
if [ ! -d "$capture_log_path" ]
then
mkdir -pv "$capture_log_path"
fi
./dvanalyze.sh "$video_file" "$capture_log_path"
echo "Opening dvanalyzer graph for $video_file ..."
xdg-open "$dvanalysis_path/$catnum-02-$tapenum-src_dvanalyzer.svg" 2>/dev/null
else
echo "Opening dvanalyzer graph for $video_file ..."
xdg-open "$dvanalysis_path/$catnum-02-$tapenum-src_dvanalyzer.svg" 2</dev/null
fi
fi
# if --analyze-only selected, then quit here without launching QC spreadsheet or video file
if [ "$analyze_only" == "true" ]
then
exit
fi
# Note significant errors that should be reviewed by a person (audible or visible issues)
# Examples: "Many audio errors found in first 10 minutes."
# Create QC log file. Log file will be one per package, not one per tape
if [ -f "$QC_log" ]
then
echo "Opening existing QC log."
else
echo "Catalog number,Tape number,DV Analyzer summary,A/V sync issues?,Notes" >> "$QC_log"
echo "Opening QC log."
fi
xdg-open "$QC_log"
# Open video file
echo "Press any key and hit Enter to open the video file."
read -r placeholder
vlc "$video_file" 2>/dev/null