PDA

View Full Version : New 'Favorites' and FLACs with embedded cuesheets



sbjaerum
2007-02-05, 13:43
The current Favorites implementation does not work with my FLACs with embedded cuesheets. The problem is related to the anchor added to the URL.

Let's say I start out with empty favorites, and add a track by holding the Favorites button. I then end up with this favorites.opml:


<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head title="Favorites">
<expansionState></expansionState>
</head>
<body>
<outline URL="file:///D:/audio/flac/C/Johnny_Cash/Johnny_Cash-American_V_A_Hundred_Highways-2006.flac#171.693333333333-330.36" text="God's Gonna Cut You Down" type="audio" />
</body>
</opml>

To be able to later play this favorite track, the patch below is necessary. The patch is not at all sufficient, but it sort of illustrates the problem and suggests a starting point for a fix.
Unfortunately my limited perl skills makes it difficult for me to develop a complete patch...

Index: server/Slim/Control/Commands.pm
================================================== =================
--- server/Slim/Control/Commands.pm (revision 11346)
+++ server/Slim/Control/Commands.pm (working copy)
@@ -913,8 +913,10 @@
$client->currentPlaylistModified(1);
}

+ my $anchor;
if (!Slim::Music::Info::isRemoteURL($path) && Slim::Music::Info::isFileURL($path)) {

+ $anchor = Slim::Utils::Misc::anchorFromURL($path);
$path = Slim::Utils::Misc::pathFromFileURL($path);

$log->info("path: $path");
@@ -980,6 +982,7 @@

Slim::Utils::Scanner->scanPathOrURL({
'url' => $path,
+ 'anchor' => $anchor,
'listRef' => Slim::Player::Playlist::playList($client),
'client' => $client,
'callback' => sub {
Index: server/Slim/Utils/Scanner.pm
================================================== =================
--- server/Slim/Utils/Scanner.pm (revision 11346)
+++ server/Slim/Utils/Scanner.pm (working copy)
@@ -326,6 +326,11 @@

if (Slim::Music::Info::isSong($url)) {

+ my $anchor = $args->{'anchor'};
+ if (defined $anchor) {
+ $url = "$url" . "#" . "$args->{'anchor'}";
+ }
+
$log->debug("Adding $url to database.");

my $track = Slim::Schema->$method({

Triode
2007-02-06, 11:19
I'm happy to look at this, but can you confirm - did it work before as I
can't find any code which did the equivalent???

> The current Favorites implementation does not work with my FLACs with
> embedded cuesheets. The problem is related to the anchor added to the
> URL.

sbjaerum
2007-02-06, 12:28
I'm happy to look at this, but can you confirm - did it work before as I
can't find any code which did the equivalent???


I believe that previously the Favorites worked the same way as the Zapped playlist is still working. The file URL with anchor is put into an m3u playlist. The Zapped playlist still works with cuesheets. However, when the Favorites was moved to OPML, a scan is triggered for the items in the playlist, and this is what causes the problem with anchors.

Steinar

sbjaerum
2007-02-17, 02:01
Can I contribute in any way to get this fixed?

Triode
2007-02-17, 04:34
Reason I'm holding off is that I'm reviewing the path favorites plays by -
probably looking up in the database for local files, so this fix may need to
be different.

----- Original Message -----
From: "sbjaerum" <sbjaerum.2m56ab1171703101 (AT) no-mx (DOT) forums.slimdevices.com>
To: <developers (AT) lists (DOT) slimdevices.com>
Sent: Saturday, February 17, 2007 9:01 AM
Subject: Re: [Developers] New 'Favorites' and FLACs with embedded cuesheets


>
> Can I contribute in any way to get this fixed?
>
>
> --
> sbjaerum
> ------------------------------------------------------------------------
> sbjaerum's Profile: http://forums.slimdevices.com/member.php?userid=237
> View this thread: http://forums.slimdevices.com/showthread.php?t=32477
>
>

cjk32
2007-02-18, 15:15
sbjaerum wrote:
> The current Favorites implementation does not work with my FLACs with
> embedded cuesheets. The problem is related to the anchor added to the
> URL.
>
Is there any chance of reworking the way anchors are used in
slimserver. The current implementation using pair of floats formatted
to perl's accuracy is far from ideal. When preparing playlists etc, you
need to know many digits to use (is it platform specific even?) in order
for slimserver to be able to identify the track correctly in the
database. What I'd propose is to use the CD timecode format, i.e.
mmm:ss:ff, where ff is a frame number from 0 - 74, for the anchor. This
would work very nicely with whole album rips and associated cue sheets.
If there's any interest in this, I'm happy to give it a go.

As an related aside, is there much involved in getting the squeezebox to
be able to play from a specified offset within a file, removing the
necessity of flac-flac transcoding on the server, hence allowing seeking
forwards / backwards on the squeezebox itself?

Chris

Triode
2007-02-23, 10:46
Steinar,

Could you retry this with r11511 or later - it should now use the db to play
favorites, but I am not sure what impact this will have on cue sheet support

Adrian

>
> I believe that previously the Favorites worked the same way as the
> Zapped playlist is still working. The file URL with anchor is put into
> an m3u playlist. The Zapped playlist still works with cuesheets.
> However, when the Favorites was moved to OPML, a scan is triggered for
> the items in the playlist, and this is what causes the problem with
> anchors.
>
> Steinar

sbjaerum
2007-02-25, 16:29
Steinar,

Could you retry this with r11511 or later - it should now use the db to play
favorites, but I am not sure what impact this will have on cue sheet support

Adrian


Tested r11539, and it now works without problems for cue sheets. Thanks.

Steinar

Stuart
2007-04-06, 10:52
Hi...

I was wondering:

Could someone give me a quick run down as to how a FLAC encoded audio
file is sent to a client. For instance, how does the client ask for the
server to not convert the file to mp3? And how does the server tell the
client it is spooling a FLAC file instead of an mp3?

....thanks

kdf
2007-04-06, 12:09
On 6-Apr-07, at 10:52 AM, stuart wrote:

>
> Hi...
>
> I was wondering:
>
> Could someone give me a quick run down as to how a FLAC encoded audio
> file is sent to a client. For instance, how does the client ask for
> the
> server to not convert the file to mp3? And how does the server tell
> the
> client it is spooling a FLAC file instead of an mp3?
>
Look in Slim/Player/*.pm for more details, but each client type has an
ordered list of supported formats.
Each new track start goes through a process taking the file format
matched with the supported formats (in order)
and finding a valid playback command as given in convert.conf or
custom-convert.conf. You can observe the process using d_source
debugging flag.

more details in various threads:
http://forums.slimdevices.com/showthread.php?t=17433
http://forums.slimdevices.com/showthread.php?t=29689
http://forums.slimdevices.com/showthread.php?t=31183
http://forums.slimdevices.com/showthread.php?t=20071

-kdf