File: checkflac

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 (50 lines) | stat: -rwxr-xr-x 1,045 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
#!/bin/sh
set -e

if [ -z "$CDROM" ];
then
  CDROM=/dev/cdrom
fi

if [ $# = "1" ]
then
	FILENAME="$1"
	
	CDID=`discid $CDROM`
	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 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, FLAC file is OK"
		exit 0
	fi
else
	echo "Usage: $0 flacfile"
	exit 1
fi