Hiya,

I've just spent a little time adding 'Browse by year' to the browse
menu in 6.1.1, only to find that it's in the 6.2 sources already... oh
well... Anyhow...

Whilst looking at the source for 6.2 I notice that there isn't any
option to display the artist name with the album name. That is, the
current Browse by year might look like this :

"1970" -> "The Best Of (Disc 1)"

which isn't too helpful.

What I've done to my source here (for 6.1.1) is duplicated the special
case code that is used for albums at the top level with modifications
so that the menu now reads :

"1970" -> "The Best Of (Disc 1) by Ralph McTell"

Because this is 'just a hack', I've just directly bolted the code in
that I wanted. For real use (and because I'm sure other people wouldn't
like that) it would be better if the code had an option in the server
configuration near the 'Show Artist with albums' section, something
like 'You may choose to show the artist when browsing by Year. When
enabled, the album's artist will be shown next to the album title.' (ie
similar wording to the Artist with Albums section. I couldn't find how
to do that, so I left it.

The code I've used to do this can be added to Slim/Buttons/BrowseDB.pl
in the browsedbItemName() special case checks :


Code:
--------------------
    
  # JRF: For Browse by Years
  } elsif (($levels[$level] eq 'album') && $level == 1 && $levels[0] eq "year") 
{
  
  my $name = &{$levelInfo->{'resultToName'}}($item);
  
  my $artist;
  my ($track) = $item->tracks;
  
  if ($track) {
  $artist  = $track->artist;
  } else {
  msg("Item has no tracks\n");
  use Data::Dumper;
  print Dumper($item);
  }
  
  if (defined $artist && $artist ne $client->string('NO_ARTIST')) 
  {
  $name .= ' ' . Slim::Utils::Strings::string('BY') . " $artist";
  }
  
  return $name;
  # JRF: End
  
--------------------


-- 
gerph
_______________________________________________
beta mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/beta

Reply via email to