Pilim FLAC
On one well-known tracker, people often began to share their copies of disks in flac / ape / wavepack (wv) format with a cue file.
In fact, everything is smooth. Indeed, there are players supporting this whole thing, and indeed it all works. BUT.
My hobbies are related to electronic club music, so for the sake of one or two tracks I don’t want to cut the whole discs before the party (it’s better to make my own competent collections), plus I also wanted to bring all the files to one format, namely FLAC - because new progressive programs (Ableton Live) and players (ipod (with special firmware, or a touch with software / cowon) support it.
So, again, the task - there are diskname.flac + diskname.cue, from them you need to get a lot of tracks with tags and distinct file names (Artist name, track number, track name) + playlist.
For an example, I took the debian lenny distribution (5.0). Apparently, for * buntu users and other debian-based distributions, the commands will also be true.
What we need:
sudo aptitude install build-essential - gcc and the necessary stuff to build support for ape format.
sudo aptitude install cuetools - for working with a cue-file.
sudo aptitude install shntool - a set of utilities for cutting audio files and more.
sudo aptitude install wavpack - encoder and decoder for the wavpack format
sudo aptitude install flac - encoder and decoder for flac
Download the mac source (for working with ape)
wget supermmx.org/resources/linux/mac/mac-3.99-u4-b5.tar.gz
Unpack and go to the build directory:
tar xvzf mac-3.99-u4-b5 .tar.gz
cd mac-3.99-u4-b5
make
if everything went smoothly - sudo make install.
So, you're done!
And now you need to write your own script to automate the whole process. But wait, I already sketched something;)
So, we will have three scripts.
A script for cutting the original into separate tracks and their subsequent tagging.
cuesplit
Script to rename received tracks:
cuerename
Explanation about the cycle. I needed the tracks to be called 01, 02, 03, for proper sorting, and not 1, 2, 3. There were 66 tracks on one of the disks (Mexicans are my favorites) :) A
script that executes the first and second script in turn; )
cuemagic
According to statistics, most people are normal windows users, respectively, there are spaces in the files.
Unfortunately, I am a bad programmer (I’m a mining engineer by training). Therefore, for the sake of order and for my scripts to work in general, I wrote another small primitive script to replace spaces in the file name with underscores. I hope in the comments they will tell me a more elegant way.
A script for mass renaming of files with spaces in the name.
mrnm
And now an example of work!
If you have any questions, please ask. Especially welcome suggestions and thoughts regarding the elegant solution to the problem with spaces and other special characters :)
ps When I finished the article, I noticed that such tags were already indicated by someone, I looked at these tags, it turned out that way - the person already wrote about this, but he had slightly different goals. In any case, this example can be a good example of how not to program or how amateurs program;)
In fact, everything is smooth. Indeed, there are players supporting this whole thing, and indeed it all works. BUT.
My hobbies are related to electronic club music, so for the sake of one or two tracks I don’t want to cut the whole discs before the party (it’s better to make my own competent collections), plus I also wanted to bring all the files to one format, namely FLAC - because new progressive programs (Ableton Live) and players (ipod (with special firmware, or a touch with software / cowon) support it.
So, again, the task - there are diskname.flac + diskname.cue, from them you need to get a lot of tracks with tags and distinct file names (Artist name, track number, track name) + playlist.
For an example, I took the debian lenny distribution (5.0). Apparently, for * buntu users and other debian-based distributions, the commands will also be true.
What we need:
sudo aptitude install build-essential - gcc and the necessary stuff to build support for ape format.
sudo aptitude install cuetools - for working with a cue-file.
sudo aptitude install shntool - a set of utilities for cutting audio files and more.
sudo aptitude install wavpack - encoder and decoder for the wavpack format
sudo aptitude install flac - encoder and decoder for flac
Download the mac source (for working with ape)
wget supermmx.org/resources/linux/mac/mac-3.99-u4-b5.tar.gz
Unpack and go to the build directory:
tar xvzf mac-3.99-u4-b5 .tar.gz
cd mac-3.99-u4-b5
make
if everything went smoothly - sudo make install.
So, you're done!
And now you need to write your own script to automate the whole process. But wait, I already sketched something;)
So, we will have three scripts.
A script for cutting the original into separate tracks and their subsequent tagging.
cuesplit
#! / bin / bash if ["$ 1" == ""]; then echo "Usage: $ 0 flac / apefile cuesheetname" exit else cuebreakpoints $ 2 | shnsplit -o flac -O always $ 1 cuetag $ 2 split-track * .flac fi
Script to rename received tracks:
cuerename
#! / bin / bash TRACKNAME = split-track ENDNAME = ". Flac" PLAYLISTNAME = "! Playlist.m3u" rm $ PLAYLISTNAME 2> / dev / null for i in 01 02 03 04 05 06 07 08 09 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; do if [-f $ TRACKNAME $ i $ ENDNAME]; then echo -n else exit fi PERFORMER = `cueprint -t '% p_ \ n' -n $ i $ 2 | tr [: blank:] '_' | tr ':' '_' | tr '*' '_'` TRACK = `cueprint -t '_% t \ n' -n $ i $ 2 | tr [: blank:] '_' | tr ':' '_' | tr '*' '_'` echo "$ PERFORMER $ i $ TRACK $ ENDNAME" >> $ PLAYLISTNAME echo "$ PERFORMER $ i $ TRACK $ ENDNAME" mv $ TRACKNAME $ i $ ENDNAME $ PERFORMER $ i $ TRACK $ ENDNAME done;
Explanation about the cycle. I needed the tracks to be called 01, 02, 03, for proper sorting, and not 1, 2, 3. There were 66 tracks on one of the disks (Mexicans are my favorites) :) A
script that executes the first and second script in turn; )
cuemagic
#! / bin / bash if ["$ 2" == ""]; then echo "Usage: $ 0 flac / apefile cuesheet-file" exit else cuesplit $ 1 $ 2 cuerename $ 1 $ 2 fi
According to statistics, most people are normal windows users, respectively, there are spaces in the files.
Unfortunately, I am a bad programmer (I’m a mining engineer by training). Therefore, for the sake of order and for my scripts to work in general, I wrote another small primitive script to replace spaces in the file name with underscores. I hope in the comments they will tell me a more elegant way.
A script for mass renaming of files with spaces in the name.
mrnm
#! / bin / bash. find. -depth | rename 's / \ / _ / g'
And now an example of work!
grinder: / home / massiv / LOSSLESS / Terminal Choice - Navigator [1998] # ls -la total 411841 drwxrwxrwx 1 root root 0 2009-06-04 00:26. drwxrwxrwx 1 root root 0 2009-06-04 02:56 .. -rwxrwSrwx 1 root root 260 2009-06-04 09:12 audiochecker.log drwxrwxrwx 1 root root 0 2009-06-03 21:02 Covers -rwxrwSrwx 1 root root 1951 2009-06-04 09:12 Terminal Choice - Navigator.cue -rwxrwSrwx 1 root root 421561038 2009-06-04 09:13 Terminal Choice - Navigator.flac -rwxrwSrwx 1 root root 3331 2009-06-03 23:21 Terminal Choice - Navigator.log grinder: / home / massiv / LOSSLESS / Terminal Choice - Navigator [1998] # mrnm grinder: / home / massiv / LOSSLESS / Terminal Choice - Navigator [1998] # ls -la total 411841 drwxrwxrwx 1 root root 0 2009-06-29 20:13. drwxrwxrwx 1 root root 0 2009-06-04 02:56 .. -rwxrwSrwx 1 root root 260 2009-06-04 09:12 audiochecker.log drwxrwxrwx 1 root root 0 2009-06-03 21:02 Covers -rwxrwSrwx 1 root root 1951 2009-06-04 09:12 Terminal_Choice _-_ Navigator.cue -rwxrwSrwx 1 root root 421561038 2009-06-04 09:13 Terminal_Choice _-_ Navigator.flac -rwxrwSrwx 1 root root 3331 2009-06-03 23:21 Terminal_Choice _-_ Navigator.log grinder: / home / massiv / LOSSLESS / Terminal Choice - Navigator [1998] # cuemagic Terminal_Choice _-_ Navigator.flac Terminal_Choice _-_ Navigator.cue Splitting [Terminal_Choice _-_ Navigator.flac] (64: 21.10) -> [split-track01.flac] (3: 07.70): 100% OK Splitting [Terminal_Choice _-_ Navigator.flac] (64: 21.10) -> [split-track02.flac] (5: 05.02): 100% OK Splitting [Terminal_Choice _-_ Navigator.flac] (64: 21.10) -> [split-track03.flac] (6: 03.03): 100% OK Splitting [Terminal_Choice _-_ Navigator.flac] (64: 21.10) -> [split-track04.flac] (3: 49.72): 100% OK Splitting [Terminal_Choice _-_ Navigator.flac] (64: 21.10) -> [split-track05.flac] (1: 51.05): 100% OK Splitting [Terminal_Choice _-_ Navigator.flac] (64: 21.10) -> [split-track06.flac] (5: 55.52): 100% OK Splitting [Terminal_Choice _-_ Navigator.flac] (64: 21.10) -> [split-track07.flac] (4: 40.68): 100% OK Splitting [Terminal_Choice _-_ Navigator.flac] (64: 21.10) -> [split-track08.flac] (5: 46.30): 100% OK Splitting [Terminal_Choice _-_ Navigator.flac] (64: 21.10) -> [split-track09.flac] (5: 00.20): 100% OK Splitting [Terminal_Choice _-_ Navigator.flac] (64: 21.10) -> [split-track10.flac] (1: 11.63): 100% OK Splitting [Terminal_Choice _-_ Navigator.flac] (64: 21.10) -> [split-track11.flac] (6: 06.00): 100% OK Splitting [Terminal_Choice _-_ Navigator.flac] (64: 21.10) -> [split-track12.flac] (6: 07.35): 100% OK Splitting [Terminal_Choice _-_ Navigator.flac] (64: 21.10) -> [split-track13.flac] (4: 17.70): 100% OK Splitting [Terminal_Choice _-_ Navigator.flac] (64: 21.10) -> [split-track14.flac] (1: 48.35): 100% OK Splitting [Terminal_Choice _-_ Navigator.flac] (64: 21.10) -> [split-track15.flac] (3: 29.10): 100% OK Terminal_Choice_01_ (Intro) _Actual_Reality? .Flac Terminal_Choice_02_Without_Warning.flac Terminal_Choice_03_Victim_Of_Life.flac Terminal_Choice_04_Someone.flac Terminal_Choice_05_Navigator_I.flac Terminal_Choice_06_Der_Tod.flac Terminal_Choice_07_House_Of_Evil.flac Terminal_Choice_08_No_Escape.flac Terminal_Choice_09_The_Sons_Of_Doom.flac Terminal_Choice_10_Tenderness.flac Terminal_Choice_11_Navigator_II.flac Terminal_Choice_12_The_Eternal_Evil.flac Terminal_Choice_13_Kaltes_Herz.flac Terminal_Choice_14_Navigator_III.flac Terminal_Choice_15_Navigator_IV_ (Version) .flac grinder: / home / massiv / LOSSLESS / Terminal Choice - Navigator [1998] # ls -la total 828610 drwxrwxrwx 1 root root 0 2009-06-29 20:17. drwxrwxrwx 1 root root 0 2009-06-04 02:56 .. -rwxrwSrwx 1 root root 260 2009-06-04 09:12 audiochecker.log drwxrwxrwx 1 root root 0 2009-06-03 21:02 Covers -rwxrwSrwx 1 root root 574 2009-06-29 20:17! playlist.m3u -rwxrwSrwx 1 root root 17370275 2009-06-29 20:17 Terminal_Choice_01_ (Intro) _Actual_Reality.flac -rwxrwSrwx 1 root root 37622950 2009-06-29 20:17 Terminal_Choice_02_Without_Warning.flac -rwxrwSrwx 1 root root 38571483 2009-06-29 20:17 Terminal_Choice_03_Victim_Of_Life.flac -rwxrwSrwx 1 root root 25643068 2009-06-29 20:17 Terminal_Choice_04_Someone.flac -rwxrwSrwx 1 root root 11619094 2009-06-29 20:17 Terminal_Choice_05_Navigator_I.flac -rwxrwSrwx 1 root root 41084081 2009-06-29 20:17 Terminal_Choice_06_Der_Tod.flac -rwxrwSrwx 1 root root 32317355 2009-06-29 20:17 Terminal_Choice_07_House_Of_Evil.flac -rwxrwSrwx 1 root root 39866544 2009-06-29 20:17 Terminal_Choice_08_No_Escape.flac -rwxrwSrwx 1 root root 35956407 2009-06-29 20:17 Terminal_Choice_09_The_Sons_Of_Doom.flac -rwxrwSrwx 1 root root 6399212 2009-06-29 20:17 Terminal_Choice_10_Tenderness.flac -rwxrwSrwx 1 root root 30924941 2009-06-29 20:17 Terminal_Choice_11_Navigator_II.flac -rwxrwSrwx 1 root root 46413377 2009-06-29 20:17 Terminal_Choice_12_The_Eternal_Evil.flac -rwxrwSrwx 1 root root 30521201 2009-06-29 20:17 Terminal_Choice_13_Kaltes_Herz.flac -rwxrwSrwx 1 root root 10079967 2009-06-29 20:17 Terminal_Choice_14_Navigator_III.flac -rwxrwSrwx 1 root root 21843539 2009-06-29 20:17 Terminal_Choice_15_Navigator_IV_ (Version) .flac -rwxrwSrwx 1 root root 1951 2009-06-04 09:12 Terminal_Choice _-_ Navigator.cue -rwxrwSrwx 1 root root 421561038 2009-06-04 09:13 Terminal_Choice _-_ Navigator.flac -rwxrwSrwx 1 root root 3331 2009-06-03 23:21 Terminal_Choice _-_ Navigator.log grinder: / home / massiv / LOSSLESS / Terminal Choice - Navigator [1998] # rm Terminal_Choice _-_ * grinder: / home / massiv / LOSSLESS / Terminal Choice - Navigator [1998] #
If you have any questions, please ask. Especially welcome suggestions and thoughts regarding the elegant solution to the problem with spaces and other special characters :)
ps When I finished the article, I noticed that such tags were already indicated by someone, I looked at these tags, it turned out that way - the person already wrote about this, but he had slightly different goals. In any case, this example can be a good example of how not to program or how amateurs program;)