Simple Lyrics Viewer

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Simple Lyrics Viewer

Re: Simple Lyrics Viewer

by Guest » Sun Jul 28, 2013 11:23 am

Begges wrote:Hi Monkey out there,

when i have added all lyrics from Evillyrics with my Eviltagger-script, i was searching for a script, that shows these lyrics from the ID3v2 tag
the info panel was a bit too much for me, as i can see album art and song infos straight in MM.
I was just missing a lyrics panel, as the one with the covers.

And here it is :-)
Please check and submit errors

Code: Select all


' a simple Show lyrics script
'just adds a docking panle with lyrics inside
'
'thanks to all forum members for their code snippets!!!!
'
'
'here are the ini-Lines
'
' [ShowLyrics]
' FileName=ShowLyrics.vbs
' ProcName=ShowLyrics
' Order=17
' DisplayName=Show  InsideLyrics (id3V2)
' Description=Shows InsideLyrics (id3V2)
' Language=VBScript
' ScriptType=0
'

Dim Tmr, strOldsong
Dim strPath
Dim lyrPanel

Sub Showlyrics
	ExportLyrics
	CreatePanel
	Set Tmr = SDB.CreateTimer(1000)
	Script.RegisterEvent Tmr, "OnTimer", "Update"
End Sub

Sub ExportLyrics
	Dim Song, strLyrics, strHeader
	Dim TmpFile
  	
	'exports the lyrics to a temporary html file
	strPath=sdb.applicationpath
	strPath=strPath & "~~SimpleLyricsTemp.html"
	Set Song = SDB.Player.CurrentSong
	strLyrics = Song.lyrics
	if StrLyrics = "" then StrLyrics ="No id3V2 Lyric Tag found in" & CHR(10) & Song.path
	strOldsong = song.path
	strheader = "<plaintext style=""font-family:Arial,sans-serif; font-size:10px;"">"
	strlyrics = strheader & strlyrics '& "</plaintext>"
	Set tmpFile = sdb.tools.filesystem.CreateTextFile (strPath, true)
	tmpFile.WriteLine strLyrics
End Sub


Sub CreatePanel
	Dim Form
	
	'creates the panel
	Set Form = SDB.Objects("LyricPanel")
	If Form is Nothing Then
		Set Form = SDB.UI.NewDockablePersistentPanel("LyricPanel")
		Form.DockedTo = 2
		Form.Common.Width = 250
		Form.Caption = "Lyrics"
		Set lyrPanel = SDB.UI.NewActiveX(Form, "Shell.Explorer")
		lyrPanel.Common.Align = 5  
		lyrPanel.Interf.Navigate strpath  ' open the temp-lyric-file
		Form.Common.Visible = True
		SDB.Objects("LyricPanel") = Form    
		SDB.Objects("LyricX") = lyrPanel.Interf
		Script.RegisterEvent Form, "OnClose", "FormClose"
	End If
End Sub

Sub Update(Timer)
	Dim NewSong
	Set NewSong = SDB.Player.CurrentSong
	If strOldsong <> NewSong.path Then
		ExportLyrics	'export new lyrics
		lyrPanel.Interf.Navigate strpath 'open the temp-lyric-file again
	End If

End Sub

Sub FormClose(Node)
	SDB.Objects("LyricPanel") = Nothing
	SDB.Objects("LyricX").Navigate "about:blank"
	SDB.Objects("LyricX") = Nothing
	Script.UnregisterEvents Tmr
End Sub

Re: Simple Lyrics Viewer

by pranjal » Fri Feb 27, 2009 5:34 am

are lyrics displayed for any song?and if yes how can i see them :( :x

Re: Simple Lyrics Viewer

by julian1 » Mon Sep 01, 2008 11:43 pm

I have successfully installed the lyrics panel. However, how to make it view chinese characters? thx

by gege » Thu Feb 07, 2008 7:39 am

Use my Lyrics and Comment Viewer. Link in my signature.

by DickDiver » Thu Feb 07, 2008 5:18 am

for I am total new to this could you please post the whole working code?

MM3 appreciated

I am using evillyrics.

thanks

by mjs93 » Thu Feb 22, 2007 10:36 pm

I have just gotten around to using this script. Works great, many thanks. :)

I see the light!

by MCSmarties » Tue Feb 06, 2007 11:35 am

Thanks Gege. Will wrap this up tonight.

And sure I'll post the "complete" code!

What between Begges 95%, your 3% and the 2% I figured out using one of DiddeLeeDoo's scripts as template, my own contribution is tending to nil... :P

Here we go...

by gege » Tue Feb 06, 2007 7:26 am

1. Try this:

Code: Select all

   strHeaderBegin = "<html><head><link href=""lyrics_panel.css"" rel=""stylesheet"" type=""text/css""></head><body><div id=""bg"">"
   strSongTitle = "<h3>" & song.Title & origYear & "</h3>"
   strSongTitle="<a target=""_New"" href="""& FndInfo("3",song.Title) &""">"& strSongTitle &"</a>"
   strArtistName = "<h2>" & song.ArtistName & "</h2>"
   strArtistName="<a target=""_New"" href="""& FndInfo("1",song.ArtistName) &""">"& strArtistName &"</a>"
   strAlbumName = "<h1>" & song.AlbumName & albumYear & "</h1>"
   strAlbumName="<a target=""_New"" href="""& FndInfo("2",song.AlbumName) &""">"& strAlbumName &"</a>"
   strHeaderEnd = "<plaintext>"
   strCompleteLyrics = strHeaderBegin & strAlbumName & strArtistName & strSongTitle & strHeaderEnd & strLyrics

   Set tmpFile = sdb.tools.filesystem.CreateTextFile (strPath, true)
   tmpFile.WriteLine strCompleteLyrics
End Sub

Function FndInfo(infoType,cString)
   FndInfo="http://allmusic.com/cg/amg.dll?P=amg&x=34&y=10&opt1=" & infoType & "&sql=" & cString & "&btnG"
End Function
Again, I did not test it!


2. Just add the following line to the end of the CSS file:

Code: Select all

a, a:hover{text-decoration:none} 
3. a) To force links to open in Firefox, install the FirefoxView extension in Firefox. It adds a "View this page in Firefox" option in IE context menu. This way you can right click the link and choose that option.
b) To open a link in the panel itself, without opening a new window, replace "<a target=""_New" by "<a target=""_self" in link's code.


Oh... And I want the complete code when you finish this ;-)

Got a working version

by MCSmarties » Tue Feb 06, 2007 12:39 am

OK guys, I managed to get something to work.
Don't be too hard on me, I'm a newbie in coding! :o

I replaced this part:

Code: Select all

   strHeaderBegin = "<html><head><link href=""lyrics_panel.css"" rel=""stylesheet"" type=""text/css""></head><body><div id=""bg"">"
   strSongTitle =  "<h1>" & song.Title & "</h1>"
   strArtistName = "<h2>" & song.ArtistName & "</h2>"
   strHeaderEnd = "<plaintext>"
   strCompleteLyrics = strHeaderBegin & strSongTitle & strArtistName & strHeaderEnd & strLyrics

   Set tmpFile = sdb.tools.filesystem.CreateTextFile (strPath, true)
   tmpFile.WriteLine strCompleteLyrics
End Sub 
with this:

Code: Select all

   Dim origYear, albumYear
   If song.Year>0 Then
        albumYear= " (" & song.Year & ") "
   Else 
        albumYear= ""
   End If
         
   If song.OriginalYear>0 Then
        origYear= " (" & song.OriginalYear & ")"
   Else 
        origYear= albumYear    
   End If
          
   strHeaderBegin = "<html><head><link href=""lyrics_panel.css"" rel=""stylesheet"" type=""text/css""></head><body><div id=""bg"">"
   strSongTitle = "<h3>" & song.Title & origYear & "</h3>"
   strSongTitle="<a target=""_New"" href="""& FndTitle(song.Title) &""">"& strSongTitle &"</a>"
   strArtistName = "<h2>" & song.ArtistName & "</h2>"
   strArtistName="<a target=""_New"" href="""& FndArtist(song.ArtistName) &""">"& strArtistName &"</a>"
   strAlbumName = "<h1>" & song.AlbumName & albumYear & "</h1>"
   strAlbumName="<a target=""_New"" href="""& FndAlbum(song.AlbumName) &""">"& strAlbumName &"</a>"
   strHeaderEnd = "<plaintext>"
   strCompleteLyrics = strHeaderBegin & strAlbumName & strArtistName & strSongTitle & strHeaderEnd & strLyrics

   Set tmpFile = sdb.tools.filesystem.CreateTextFile (strPath, true)
   tmpFile.WriteLine strCompleteLyrics
End Sub

Function FndArtist(cString)
FndArtist="http://allmusic.com/cg/amg.dll?P=amg&x=34&y=10&opt1=1&sql="&cString&"&btnG"
End Function 

Function FndAlbum(cString)
FndAlbum="http://allmusic.com/cg/amg.dll?P=amg&x=34&y=10&opt1=2&sql="&cString&"&btnG"
End Function 

Function FndTitle(cString)
FndTitle="http://allmusic.com/cg/amg.dll?P=amg&x=34&y=10&opt1=3&sql="&cString&"&btnG"
End Function 
I also modified the lyrics_panel.css file to:

Code: Select all

body{font:8pt Verdana, Arial, sans serif;margin:0;padding:17px 14px;background:#bed7f4 url('lyrics_panel_bg.gif') no-repeat}
plaintext{font:8pt Verdana, Arial, sans serif;margin:0;padding:15px 5px}
h1{margin:5px;clear:both;font-size:150%;font-style:italic;color:#222}
h2{margin:5px;clear:both;font-size:130%;font-weight:normal;color:#222;padding:0 0 12px 0}
h3{margin:5px;clear:both;font-size:180%;font-weight:bolder;color:#222}
Like I said, this seems to be working for me but I'm not 100% happy.

Could somebody help me with the following questions?
1. How can I concatenate the functions FndArtist, FndAlbum and FndTitle into one? They're practically identical!

2. Is there a way to prevent the links from being underlined? Just nitpicking aesthetics...

3. This code opens a IE window even though I have Firefox installed and configured as my default internet browser. Can I make these links open in Firefox (or is there even a way to show that content within the lyrics panel?)

Thanks!

by MCSmarties » Fri Feb 02, 2007 2:08 pm

Duh...! Of course I would have to define a variable to assign to song.OriginalYear first... so that's why it didn't work! :oops:

Thanks for the input guys, will play around with this over the weekend.

Now I need to find out how to add a HTML link but I think I can figure it out.
If I can get something to work, I'll post it here.

Try this...

by gege » Fri Feb 02, 2007 10:33 am

I did not test it but I think the code below may work for the (year) thing...
As always, use it at your own risk ;-)

Code: Select all

Sub ExportLyrics
	DIM origYear, albumYear

	....

	   If song.Year>0 Then
			albumYear= " (" & song.Year & ") "
	   else albumYear= ""
	   
	   If song.OriginalYear>0 Then
			origYear= " (" & song.OriginalYear & ")"
	   else origYear= ""
	
	   strHeaderBegin = "<html><head><link href=""lyrics_panel.css"" rel=""stylesheet"" type=""text/css""></head><body><div id=""bg"">"
	   strSongTitle =  "<h3>" & song.Title & origYear & "</h3>"
	   strArtistName = "<h2>" & song.ArtistName & "</h2>"
	   strAlbumName = "<h1>" & song.AlbumName & albumYear & "</h1>"
	   strHeaderEnd = "<plaintext>"
	   strCompleteLyrics = strHeaderBegin & strAlbumName & strArtistName & strSongTitle & strHeaderEnd & strLyrics

	....

End Sub

by trixmoto » Fri Feb 02, 2007 4:37 am

Have you tried "song.OriginalYear"? :)

For allmusic.com, try something like these...

http://allmusic.com/cg/amg.dll?P=amg&x= ... ql=<Artist>
http://allmusic.com/cg/amg.dll?P=amg&x= ... sql=<Album>
http://allmusic.com/cg/amg.dll?P=amg&x= ... sql=<Title>

I don't think you can search for all of them at once though.

Need some help to tweak the code...

by MCSmarties » Thu Feb 01, 2007 6:26 pm

I love Begges' lyrics panel and have been using it ever since I found it.

I also tried to tweak it a little. My version reformatted a bit the title display and also shows the song year:

<Album>
<Artist>
<Song Title> (<Year>)

Relevant code modified:

Code: Select all

strHeaderBegin = "<html><head><link href=""lyrics_panel.css"" rel=""stylesheet"" type=""text/css""></head><body><div id=""bg"">"
   strSongTitle =  "<h3>" & song.Title & " (" & song.Year & ")" & "</h3>"
   strArtistName = "<h2>" & song.ArtistName & "</h2>"
   strAlbumName = "<h1>" & song.AlbumName & "</h1>"
   strHeaderEnd = "<plaintext>"
   strCompleteLyrics = strHeaderBegin & strAlbumName & strArtistName & strSongTitle & strHeaderEnd & strLyrics
I would like to modify it a bit more extensively, but I'm reaching the end of my (very limited) coding skills!
Can someone help me?

I would like to add the ORIGINAL YEAR (if it exists), like this:

<Album> (<Year>)
<Artist>
<Song Title> (<Original Year>)

Another neat feature would be to include links to allmusic.com.
What I have in mind is to search allmusic.com for <Album>, <Artist> and <Title> whenever these lines are clicked.
Is this possible?
Thanks!

by mynameistajmahal » Mon Aug 14, 2006 2:05 pm

do you think it would be possible to have the lyrics window appear only when there are lyrics in the tag? So instead of having a window that wastes space and says No Lyrics for some songs, there would be no window at all for those songs. And then, when there are songs playing with lyrics, the window can pop up all docked and nice on the side and wow all my friends!

is that possible?

by DiddeLeeDoo » Sun Aug 06, 2006 9:57 pm

It's a bit like that here. You almost need your 'Sherlock Holm' hat on at times to find stuff here.. ;)

Top