Page 4 of 5

Posted: Sun Aug 06, 2006 9:19 pm
by DiddeLeeDoo

Posted: Sun Aug 06, 2006 9:50 pm
by MeMeMe
You may be right!

<slinks away quietly, hoping no-one notices that I actually posted in that thread... :oops: >

:D

Posted: Sun Aug 06, 2006 9:57 pm
by DiddeLeeDoo
It's a bit like that here. You almost need your 'Sherlock Holm' hat on at times to find stuff here.. ;)

Posted: Mon Aug 14, 2006 2:05 pm
by mynameistajmahal
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?

Need some help to tweak the code...

Posted: Thu Feb 01, 2007 6:26 pm
by MCSmarties
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!

Posted: Fri Feb 02, 2007 4:37 am
by trixmoto
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.

Try this...

Posted: Fri Feb 02, 2007 10:33 am
by gege
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

Posted: Fri Feb 02, 2007 2:08 pm
by MCSmarties
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.

Got a working version

Posted: Tue Feb 06, 2007 12:39 am
by MCSmarties
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!

Here we go...

Posted: Tue Feb 06, 2007 7:26 am
by gege
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 ;-)

I see the light!

Posted: Tue Feb 06, 2007 11:35 am
by MCSmarties
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

Posted: Thu Feb 22, 2007 10:36 pm
by mjs93
I have just gotten around to using this script. Works great, many thanks. :)

Posted: Thu Feb 07, 2008 5:18 am
by DickDiver
for I am total new to this could you please post the whole working code?

MM3 appreciated

I am using evillyrics.

thanks

Posted: Thu Feb 07, 2008 7:39 am
by gege
Use my Lyrics and Comment Viewer. Link in my signature.

Re: Simple Lyrics Viewer

Posted: Mon Sep 01, 2008 11:43 pm
by julian1
I have successfully installed the lyrics panel. However, how to make it view chinese characters? thx