Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 4 of 4
  1. #1
    Victor Brilon
    Guest

    One more try at the Info.pm patch

    Dean,

    This is an updated version of the Info.pm patch to allow different file
    types to be album cover images. This just fixes a stupid typo on my part
    as well as handles the case when the cover might not be readable for
    some reason but still exists.

    Victor

    Index: server/Slim/Music/Info.pm
    ================================================== =================
    RCS file: /cvsroot/slim/server/Slim/Music/Info.pm,v
    retrieving revision 1.76
    diff -u -r1.76 Info.pm
    --- server/Slim/Music/Info.pm 14 Feb 2004 02:21:02 -0000 1.76
    +++ server/Slim/Music/Info.pm 19 Feb 2004 16:50:32 -0000
    @@ -2295,30 +2295,31 @@
    $::d_info && Slim::Utils::Misc::msg("Looking for image files for $file\n");

    my @filestotry = ();
    + my @names = qw(cover thumb album albumartsmall folder);
    + my @ext = qw(jpg gif);
    + my %nameslist = map { $_ => [do { my $t=$_; map { "$t.$_" } @ext }] } @names ;
    +
    if ($image eq 'thumb') {
    if (Slim::Utils::Prefs::get('coverThumb')) {
    my $cover = Slim::Utils::Prefs::get('coverThumb');
    - if ($cover =~ /^%(.*?)(\..*?){0,1}$/) {
    - my $suffix = $2 ? $2 : ".jpg";
    - $cover = infoFormat($file, $1)."$suffix";
    - $::d_info && Slim::Utils::Misc::msg("Variable Thumbnail: $cover from $1\n");
    + @filestotry = map { @{$nameslist{$_}} } qw(thumb albumartsmall cover folder album);
    }
    - if (defined $cover) {push @filestotry, $cover;}
    - }
    - push @filestotry, ('thumb.jpg', 'albumartsmall.jpg', 'cover.jpg', 'folder.jpg', 'album.jpg');
    } else {
    if (Slim::Utils::Prefs::get('coverArt')) {
    my $cover = Slim::Utils::Prefs::get('coverArt');
    - if ($cover =~ /^%(.*?)(\..*?){0,1}$/) {
    - my $suffix = $2 ? $2 : ".jpg";
    - $cover = infoFormat($file, $1)."$suffix";
    - $::d_info && Slim::Utils::Misc::msg("Variable Cover: $cover from $1\n");
    - }
    - if (defined $cover) {push @filestotry, $cover;}
    + @filestotry = map { @{$nameslist{$_}} } qw(cover albumartsmall folder album thumb);
    }
    - push @filestotry, ('cover.jpg', 'albumartsmall.jpg', 'folder.jpg', 'album.jpg', 'thumb.jpg');
    }
    + if ($cover && $cover =~ /^%(.*?)(\..*?){0,1}$/) {
    + my $suffix = $2 ? $2 : ".jpg";
    + $cover = infoFormat($file, $1)."$suffix";
    + my $cover_type = $image eq 'thumb' ? "Thumbnail" : "Cover";
    + $::d_info && Slim::Utils::Misc::msg("Variable $cover_type: $cover from $1\n");
    + }
    +
    + if (defined $cover) {push @filestotry, $cover;}

    +
    foreach my $file (@filestotry) {
    $file = catdir(@components, $file);
    $body = getImageContent($file);

  2. #2
    NOT a Slim Devices Employee kdf's Avatar
    Join Date
    Apr 2005
    Posts
    9,493

    Re: One more try at the Info.pm patch

    Quoting Victor Brilon <victor (AT) victorland (DOT) com>:

    + if (defined $cover) {push @filestotry, $cover;}

    I'd like to see this as:
    if (defined $cover) {unshift @filestotry, $cover;}

    The reason is, that if a user has entered a formatted cover filename, chances
    are that the user exepects to make use of them. This way the server will look
    for the formatted variable name FIRST and not waste time looking for the rest,
    or worse, find one of the defaults when the preference really should take
    precedence.

    This patch also no longer allows the user to enter a defined image, or to
    override the search with a preset filename. Currently, if you enter folder.jpg
    as in the cover art setting, the server will search folder.jpg FIRST, since it
    expects that is the preferred filename to use.

    I have been using your older patch for a while now, and its a nice addition. I
    haven't had the time to do proper timing tests to see what, if any, performance
    hits result. I have modified it to include my first point, but haven't yet
    wrote in the second. both are very minor changes. I have mentioned this to
    Dean, as I have a couple other changes to Info.pm to patch in as well, and the
    plan is to wait until after 5.1.1 to put this in, as these are more feature
    changes than bugs. In fact, I personally have a number of reported 'bugs' ready
    to go that are technically feature enhancements. These will come along once its
    clear again to be adding such features. 5.1.1 will hopefully be a nice stable
    release that will match 4.2.6's reported stability.

    -kdf

  3. #3
    Victor Brilon
    Guest

    Re: One more try at the Info.pm patch

    kdf wrote:
    > Quoting Victor Brilon <victor (AT) victorland (DOT) com>:
    >
    > + if (defined $cover) {push @filestotry, $cover;}
    >
    > I'd like to see this as:
    > if (defined $cover) {unshift @filestotry, $cover;}



    Actually that piece of code inthe module isn't even mine. But I agree
    with your reasoninig anyway

    Victor

  4. #4
    NOT a Slim Devices Employee kdf's Avatar
    Join Date
    Apr 2005
    Posts
    9,493

    Re: One more try at the Info.pm patch

    Quoting Victor Brilon <victor (AT) victorland (DOT) com>:

    > kdf wrote:
    > > Quoting Victor Brilon <victor (AT) victorland (DOT) com>:
    > >
    > > + if (defined $cover) {push @filestotry, $cover;}
    > >
    > > I'd like to see this as:
    > > if (defined $cover) {unshift @filestotry, $cover;}

    >
    >
    > Actually that piece of code inthe module isn't even mine. But I agree
    > with your reasoninig anyway
    >

    yeah, sorry. I read it as being removed, but having looked at it outside of a
    diff or email, I realised it was fine.
    -kdf

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •