]> diplodocus.org Git - flac-archive/blobdiff - flacsplit
Commit a bunch of state sitting around in the old bzr checkout!
[flac-archive] / flacsplit
index b598985df990428342fd87a6233520df1c5d6637..032fea26415de16f39d0a87e61a9e7c930a1378b 100755 (executable)
--- a/flacsplit
+++ b/flacsplit
@@ -42,7 +42,8 @@ sub get_decode_args {
     my $fn = shift;
     my @l;
 
-    open(F, '-|', 'metaflac', '--export-cuesheet-to=-', $fn);
+    open(F, '-|', 'metaflac', '--no-utf8-convert', '--export-cuesheet-to=-',
+         $fn);
     while (<F>) {
         /INDEX 01 (\d\d):(\d\d):(\d\d)$/ or next;
         push(@l, [$1, $2, $3]);
@@ -130,10 +131,12 @@ sub flacsplit {
     my $outdir;
     my $outfile;
 
-    open(my $fp, '-|', 'metaflac', '--export-vc-to=-', $fn)
-      or die("open(metaflac --export-vc-to=- $fn): $!");
+    open(my $fp, '-|', 'metaflac', '--no-utf8-convert', '--export-tags-to=-',
+         $fn)
+      or die("open(metaflac --no-utf8-convert --export-tags-to=- $fn): $!");
     ($artist, $album, $discnum, @tags) = get_tags($fp, $fn);
-    close($fp) or die("close(metaflac --export-vc-to=- $fn): $?");
+    close($fp)
+        or die("close(metaflac --no-utf8-convert --export-tags-to=- $fn): $?");
     for ($artist, $album) {
         s/'/'\\''/g;
         s|/|_|g;
@@ -149,9 +152,12 @@ sub flacsplit {
     my %tracks_to_tags;
     my @disc_artist;
     my @tmp;
+    my $hack = 1;
     for my $tag (@tags) {
         if ($tag =~ /^([^[]+)\[(\d+)]=(.*)/) {
             push(@{$tracks_to_tags{$2}->{$1}}, $3);
+        } elsif ($tag =~ /^TITLE=(.*)/) {
+            push(@{$tracks_to_tags{$hack++}->{'TITLE'}}, $1);
         } elsif ($tag =~ /^ARTIST=/) {
             push(@disc_artist, $tag);
         } else {