Skip to content

Instantly share code, notes, and snippets.

@diresi
Last active August 11, 2017 15:19
Show Gist options
  • Save diresi/a1a905546aa0136eaf7399c3ae4ffedd to your computer and use it in GitHub Desktop.
Save diresi/a1a905546aa0136eaf7399c3ae4ffedd to your computer and use it in GitHub Desktop.
#!/bin/bash
#flac --endian=big --channels=2 --bps=16 --sample-rate=44100 --sign=signed --force-raw-format data.bin -o data.flac
toc2cue audiocd.toc audiocd.cue
flac --endian=big --channels=2 --bps=16 --sample-rate=44100 --sign=signed --cuesheet=audiocd.cue -o data.flac data.bin
#metaflac --import-cuesheet-from=audiocd.cue data.flac
cat audiocd.toc | ~/tmp/toc2tag.pl > album.tags
metaflac --add-replay-gain --no-utf8-convert --import-tags-from=album.tags data.flac
#!/bin/bash
cdrdao read-cd audiocd.toc
cdrdao read-cddb audiocd.toc
cdrdao write audiocd.toc
#!/usr/bin/perl -w
# from: http://forums.slimdevices.com/showthread.php?12776-Using-linux-to-generate-a-FLAC-file-of-a-complete-CD&p=33237&viewfull=1#post33237
$GotAlbum=0;
$Tracknum=0;
$IsVarious=0;
$Artist="";
while (<>)
{
if (/\/\/ Track (\d*)/)
{
$Tracknum=$1;
print "TRACKNUMBER[$Tracknum]=$Tracknum\n";
}
if (/TITLE "(.*)"/)
{
if (!$GotAlbum)
{
$GotAlbum=1;
$Album=$1;
$Album=~ s/\// - /;
print "ALBUM=$Album\n";
}
else
{
print "TITLE[$Tracknum]=$1\n";
}
}
if (/PERFORMER "(.*)"/)
{
if ($Tracknum==0)
{
$Artist=$1;
$Artist=~ s/\// - /;
print "ARTIST=$Artist\n";
}
else
{
if ($1 ne $Artist)
{
print "ARTIST[$Tracknum]=$1\n";
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment