PDA

View Full Version : Cuesheet & multiple disc numbers



Jochen
2006-06-15, 13:59
Hi,

I've been playing around with my Squeezebox and Slimserver (6.3 build 7624) for quite a while now, and sorted various tagging problems with my collection. I've also got a couple of gapless albums with an according cuesheet (main track is a single, large MP3), and Slimserver handles them nicely. Today I came across a multi-disc album with one cuesheet per disc, and it seems Slimserver doesn't handle the disc numbering.

Digging a bit through the source code, and figured that Slimserver parses DISC and DISCC tags in cuesheets. So I added REM DISC "1" and REM DISC "2" to the top of each cuesheet, and expected Slimserver to pick it up - but it didn't. I looked a bit closer and from what I can see, I have to add this to each track in the cuesheet. Is this the expected procedure?

Anyway, I wasn't happy with that so I hacked the Parse.pm a bit, adding support for global DISC and DISCC tags. I'm happy to post the patch here if anybody is interested, or if there's a chance for getting it merged into the mainline code.

Jochen

Dan Sully
2006-06-15, 14:01
* Jochen shaped the electrons to say...

>Digging a bit through the source code, and figured that Slimserver
>parses DISC and DISCC tags in cuesheets. So I added REM DISC "1" and
>REM DISC "2" to the top of each cuesheet, and expected Slimserver to
>pick it up - but it didn't. I looked a bit closer and from what I can
>see, I have to add this to each track in the cuesheet. Is this the
>expected procedure?
>
>Anyway, I wasn't happy with that so I hacked the Parse.pm a bit, adding
>support for global DISC and DISCC tags. I'm happy to post the patch here
>if anybody is interested, or if there's a chance for getting it merged
>into the mainline code.

Sure. There may already be a bug open for this as well..

-D
--
<iNoah> you know, most free operating systems come preinstalled with their own high horse.

Jochen
2006-06-15, 15:35
Ok, here's the diff against Slim/Formats/Parse.pm:



307a308,309
> my $disc;
> my $discc;
347a350,355
> } elsif ($line =~ /^(?:REM\s+)?DISC\s+\"(.*)\"/i) {
> $disc = $1;
>
> } elsif ($line =~ /^(?:REM\s+)?DISCC\s+\"(.*)\"/i) {
> $discc = $1;
>
379c387
< $line =~ /^(?:\s+REM )?\s*(TITLE|YEAR|GENRE|COMMENT|COMPOSER|CONDUCTOR| BAND|DISC|DISCC)\s+\"(.*)\"/i) {
---
> $line =~ /^(?:\s+REM\s+)?(TITLE|YEAR|GENRE|COMMENT|COMPOSER| CONDUCTOR|BAND|DISC|DISCC)\s+\"(.*)\"/i) {
512a521,530
> if (!exists $track->{'DISC'} && defined $disc) {
> $track->{'DISC'} = $disc;
> $::d_parse && msg(" DISC: " . $track->{'DISC'} . "\n");
> }
>
> if (!exists $track->{'DISCC'} && defined $discc) {
> $track->{'DISCC'} = $discc;
> $::d_parse && msg(" DISCC: " . $track->{'DISCC'} . "\n");
> }
>

Dan Sully
2006-06-15, 15:45
* Jochen shaped the electrons to say...

>Ok, here's the diff against Slim/Formats/Parse.pm:

Could you send a unified diff instead? That's much more readable.

Thanks.

-D
--
<Daemon> seriously, first there was the circle, then sliced bread, then tivo

Jochen
2006-06-15, 23:18
Sure, here you go:



@@ -305,6 +305,8 @@
my $genre;
my $comment;
my $filename;
+ my $disc;
+ my $discc;
my $currtrack;
my $tracks = {};

@@ -345,6 +347,12 @@
} elsif ($line =~ /^(?:REM\s+)?GENRE\s+\"(.*)\"/i) {
$genre = $1;

+ } elsif ($line =~ /^(?:REM\s+)?DISC\s+\"(.*)\"/i) {
+ $disc = $1;
+
+ } elsif ($line =~ /^(?:REM\s+)?DISCC\s+\"(.*)\"/i) {
+ $discc = $1;
+
} elsif ($line =~ /^(?:REM\s+)?COMMENT\s+\"(.*)\"/i) {
$comment = $1;

@@ -376,7 +384,7 @@

} elsif (defined $currtrack and

- $line =~ /^(?:\s+REM )?\s*(TITLE|YEAR|GENRE|COMMENT|COMPOSER|CONDUCTOR| BAND|DISC|DISCC)\s+\"(.*)\"/i) {
+ $line =~ /^(?:\s+REM\s+)?(TITLE|YEAR|GENRE|COMMENT|COMPOSER| CONDUCTOR|BAND|DISC|DISCC)\s+\"(.*)\"/i) {

$tracks->{$currtrack}->{uc $1} = $2;

@@ -510,6 +518,16 @@
$::d_parse && msg(" GENRE: " . $track->{'GENRE'} . "\n");
}

+ if (!exists $track->{'DISC'} && defined $disc) {
+ $track->{'DISC'} = $disc;
+ $::d_parse && msg(" DISC: " . $track->{'DISC'} . "\n");
+ }
+
+ if (!exists $track->{'DISCC'} && defined $discc) {
+ $track->{'DISCC'} = $discc;
+ $::d_parse && msg(" DISCC: " . $track->{'DISCC'} . "\n");
+ }
+
if (!exists $track->{'COMMENT'} && defined $comment) {
$track->{'COMMENT'} = $comment;
$::d_parse && msg(" COMMENT: " . $track->{'COMMENT'} . "\n");

Jochen
2006-06-16, 03:51
Please ignore this part of the patch, it's causing trouble because e.g. a TITLE line wit leading blanks is ignored. Sorry about that.



@@ -376,7 +384,7 @@

} elsif (defined $currtrack and

- $line =~ /^(?:\s+REM )?\s*(TITLE|YEAR|GENRE|COMMENT|COMPOSER|CONDUCTOR| BAND|DISC|DISCC)\s+\"(.*)\"/i) {
+ $line =~ /^(?:\s+REM\s+)?(TITLE|YEAR|GENRE|COMMENT|COMPOSER| CONDUCTOR|BAND|DISC|DISCC)\s+\"(.*)\"/i) {

$tracks->{$currtrack}->{uc $1} = $2;

Dan Sully
2006-06-16, 09:49
* Jochen shaped the electrons to say...

>Please ignore this part of the patch, it's causing trouble because e.g.
>a TITLE line wit leading blanks is ignored. Sorry about that.

Thanks. Applied.

-D
--
Welcome to hell. Here's your accordion.