lsmithso;264997 Wrote: 
> I'm pleased to announce Version 1.0 of Slimlyrics - a plugin that shows
> the lyrics for the current song on the Squeezebox display or SC web
> page. Karaoke mode is now supported - lyrics are automatically scrolled
> in time to the music. This version works only with Squeezecenter 7.0.
> 
> Get it from http://open-net.vm.bytemark.co.uk/slimlyrics.html
> 
> Many thanks to frold for his help with testing.

I've put together a patch which uses local lyric text files. For
example, if the file is 'Train Of Thought.mp3', it will look at 'Train
Of Thought.txt' for the lyrics. Unlike my earlier efforts, this is done
at scan-time, not at lyric read time. This means that the lyrics are
available in the web interface as well (and Jive?) and to other
clients.

Because it patches the Format.pm script, it is not a candidate for
inclusion with the plugin, but might be useful in some form in the core
server.

The patch is below. However, with the patch installed, playing a track
which has an embedded lyric track, I see the end of the text that the
lyrics plugin shows as 'Please visit http://www.lyrdb.com'. I don't
think that should be there when using the local LYRICS tag. Only a
minor bug, but one which is otherwise annoying.


Code:
--------------------
    
  Index: Slim/Formats.pm
  ===================================================================
  --- Slim/Formats.pm   (revision 17118)
  +++ Slim/Formats.pm   (working copy)
  @@ -216,6 +216,49 @@
  
                        $tags->{$key} ||= 0;
                }
  +             
  +             # If there is no lyric content present in the file,
  +             # see if there is a local lyric file we can use
  +             # instead.
  +             if (!defined($tags->{'LYRICS'}) ||
  +                 $tags->{'LYRICS'} eq "")
  +             {
  +                     my $lyricfilepath = $filepath;
  +                     if ($lyricfilepath =~ s/\..{2,4}$/.txt/)
  +                     {
  +                             if (open(IN, "< $lyricfilepath"))
  +                             {
  +                                     my $lyrics = "";
  +                                     while (<IN>)
  +                                     {
  +                                             $lyrics .= $_;
  +                                     }
  +                                     close(IN);
  +                                     
  +                                     # Try and guess the encoding, otherwise 
just use latin1
  +                                     my $dec = Encode::Guess->guess($lyrics);
  +
  +                                     if (ref $dec) {
  +                                             $lyrics = $dec->decode($lyrics);
  +                                     } else {
  +                                             # Best try
  +                                             $lyrics = 
Encode::decode('iso-8859-1', $lyrics);
  +                                     }
  +
  +                                     # Normalise to LF terminations
  +                                     $lyrics =~ s/\r\n/\n/g;
  +                                     
  +                                     # Trim leading newlines
  +                                     $lyrics =~ s/^\n+//;
  +                                     
  +                                     # Expand tabs
  +                                     $lyrics =~ s/^(.*?)\t/$1 . (' ' x 
(8-(length($1) % 8)))/meg;
  +
  +                                     # Finally, assign
  +                                     $tags->{'LYRICS'} = $lyrics;
  +                             }
  +                     }
  +             }
        }
  
        # Last resort
  
--------------------


-- 
gerph
------------------------------------------------------------------------
gerph's Profile: http://forums.slimdevices.com/member.php?userid=1819
View this thread: http://forums.slimdevices.com/showthread.php?t=42990

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/plugins

Reply via email to