]> git.rmz.io Git - dotfiles.git/blob - bin/flaccue2flac
lazyvim: absorb snacks dashboard
[dotfiles.git] / bin / flaccue2flac
1 #!/bin/bash
2
3 clear
4
5 # Introduction
6
7 echo
8 echo
9 echo "FLACCUE2FLAC"
10 echo
11 echo
12 echo
13 echo "This script will convert, split and tag FLAC files with an associated cue sheet"
14 echo
15 echo
16 echo "WARNING: THIS SCRIPT WILL AUTOMATICALLY INSTALL SOME NECESSARY PACKAGES IF NOT ALREADY INSTALLED"
17 echo
18 echo
19 echo
20 echo
21
22 # This will check if all packages needed are present in the system, and will install them if not.
23
24 FLAC=`which flac`
25 if [ -z $FLAC ]; then
26 echo "ERROR (Don't worry) ;-)"
27 echo "FLAC is not in your system, automatically installing..."
28 sudo aptitude update && sudo aptitude install flac -y
29 clear
30 echo "OK NOW, PROCEEDING..."
31 echo
32 fi
33
34 CUE=`which cuebreakpoints`
35 if [ -z $CUE ]; then
36 echo "ERROR (Wish every error were like this one...) ;-)"
37 echo
38 echo "cuetools not present, automatically installing..."
39 sudo aptitude update && sudo aptitude install cuetools -y
40 clear
41 echo "OK NOW, PROCEEDING..."
42 echo
43 fi
44
45 SHN=`which shntool`
46 if [ -z $SHN ]; then
47 echo "ERROR (Not the end of the world, anyway) ;-)"
48 echo
49 echo "shntool is not around here, let's get it..."
50 sudo aptitude update && sudo aptitude install shntool -y
51 clear
52 echo "OK, PROCEEDING..."
53 echo
54 fi
55
56 LL=`which lltag`
57 if [ -z $LL ]; then
58 echo "OH, MY GOD! ;-)"
59 echo
60 echo "lltag is not in your computer, installing..."
61 sudo aptitude update && sudo aptitude install lltag -y
62 clear
63 echo "AT LAST, PROCEEDING..."
64 echo
65 fi
66
67 # Now it will check if we have chosen a cue file
68
69 for i in $*; do
70 case $i in
71 *.[cU][uU][eE])
72 echo "Checking if file $i is a .cue file...";;
73 *)
74 echo "Warning: File $i is not a .cue file. Aborting."
75 continue
76 esac
77
78 # Processing files
79
80 FILENAME="$(basename $i)"
81 FILENAME="${FILENAME%.[cC][uU][eE]}"
82
83 echo "Splitting files..."
84 cuebreakpoints $FILENAME.cue
85 shnsplit -o flac -f $FILENAME.cue $FILENAME.flac
86
87 echo "Adding tags..."
88 cuetag $FILENAME.cue split-track*.flac
89
90 # This will rename files using the strucure "track-number title", the one I like, but it can be easyly changed using common parameters. Please read lltag manual for more information.
91
92 echo "Renaming files..."
93 lltag --yes --no-tagging --rename '%n %t' `ls split-track*.flac`
94 echo
95 echo
96 echo "Process ended."
97 done