File: checkflac_usage.patch

package info (click to toggle)
flactag 2.0.4-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,120 kB
  • sloc: sh: 10,797; cpp: 3,287; makefile: 59; sed: 7
file content (58 lines) | stat: -rw-r--r-- 1,875 bytes parent folder | download | duplicates (3)
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
Description: make script more resiliant
  checkflac: make script more resilient for filenames containing spaces or colon
Origin: https://github.com/adhawkins/flactag/commit/346d0ad569d7f6bf0a8232975712a42991a5650c
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=800802
Forwarded: not-needed
Applied-Upstream: See Origin.
Last-Update: 2020-05-04 <YYYY-MM-DD, last update of the meta-information, optional>
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/checkflac
+++ b/checkflac
@@ -11,24 +11,40 @@
 	FILENAME="$1"
 	
 	CDID=`discid $CDROM`
-	FLACID=`flactag --discid $FILENAME | cut -d':' -f 2| cut -d' ' -f 2`
+	if [ -z "${CDID}" ]
+	then
+		echo "Failed to get disc ID from ${CDROM}"
+		exit 1
+	fi
+
+	FLACID=`flactag --discid "${FILENAME}" | rev | cut -d' ' -f1 | rev`
+	if [ -z "${FLACID}" ]
+	then
+		echo "Failed to get disc ID from FLAC file ${FILENAME}"
+		exit 1
+	fi
 
 	if [ "$FLACID" != "$CDID" ]
 	then
 		echo "**********"
 		echo "**********"
 		echo "**********"
-		echo "********** Disc ID of FLAC doesn't match Disc ID of CD  **********"
-		echo "********** Please re-rip this CD and remove any invalid **********"
-		echo "********** disc IDs from the MusicBrainz service        **********"
+                echo "********** Disc ID of CD:   ${CDID}"
+                echo "********** Disc ID of FLAC: ${FLACID} * INVALID *"
+                echo "**********"
+		echo "********** Disc ID of FLAC doesn't match Disc ID of CD   ***********"
+		echo "********** Please re-rip this CD and remove any invalid  ***********"
+		echo "********** disc IDs from the MusicBrainz service         ***********"
 		echo "**********"
 		echo "**********"
 		echo "**********"
+		exit 2
 	else
-		echo "IDs match, disk is OK"
+		echo "IDs match, FLAC file is OK"
+		exit 0
 	fi
 else
 	echo "Usage: $0 flacfile"
+	exit 1
 fi
 
-