Lyrics Dockable Panel v1.52 [Script]

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Lyrics Dockable Panel v1.52 [Script]

Post by DiddeLeeDoo » Thu Sep 07, 2006 11:24 am

I had this one in the Lyrics Find - Copy & Paste Thread, but found it a bit difficult to notify about updates there. Therefore put in this separate thread.

Feature On/Off switch in the View menu.
ImageImage


Install Script Open zip, and just double click the install file.


New feature: for songs with no lyrics, a 'Find lyrics' link is added.

Changelog:
1.00 - 1.20 : Fix for view when installed fresh plus check-up.
1.20 - 1.21 : Made Artist / Title line-break better.
1.21 - 1.30 : More formatting of the Lyrics Text Window. Easy to modify.
1.30 - 1.31 : Tiny clean-up
1.31 - 1.32 : Blank lines fix
1.32 - 1.40 : "Find Lyrics" link for songs with no lyrics, plus style work
1.40 - 1.41 : Font to Georgia (Best screen serif font?)
1.41 - 1.50 : Reformatting the .html part, more fields added
1.50 - 1.51 : Less clutter in the heading.
1.51 - 1.52 : Fix for songs not in library.

Style tweaks.
Background picture (The \MediaMonkey\Skins folder)
Back=Replace("file:///" & SDB.ApplicationPath & "Skins\music_sheet.bmp", "\", "/")

Font and size
Doc.Add " p { font-family:Georgia;font-size: 10pt

Code: Select all

'----------------------------------------------------------------------
'\Program Files\MediaMonkey\Scripts\Auto\Panel_Lyrics.vbs
' Version: 1.52
' Date: 23 November 2006
' By DiddeLeeDoo (c)
'----------------------------------------------------------------------
Sub OnStartup
Set MVL=SDB.UI.AddMenuItem(SDB.UI.Menu_View,1,0)
    MVL.Caption=SDB.Localize("L&yrics")
    MVL.ShortCut="Ctrl+Alt+Y"
    MVL.UseScript=Script.ScriptPath
    MVL.OnClickFunc="LyricsSwitch"
    SetLyrPanel
    MVL.Checked=SDB.Objects("PLS").Common.ChildControl("Lyrics").Common.Visible
    SDB.Objects("MVL")=MVL
 If MVL.Checked Then Start
End Sub

Private Prv
Sub LyricsSwitch(o)
 If SDB.Objects("MVL").Checked Then
    SDB.Objects("PLS").Common.ChildControl("Lyrics").Common.Visible=False
    SDB.Objects("MVL").Checked=False
 Else
    SDB.Objects("PLS").Common.ChildControl("Lyrics").Common.Visible=True
    SDB.Objects("MVL").Checked=True
    Start
 End If
End Sub

Sub Start
    Set LyrTmr=SDB.CreateTimer(1500)
    Script.RegisterEvent LyrTmr,"OnTimer","Check"
End Sub

Sub SetLyrPanel
    If SDB.Objects("PLS") Is Nothing Then
      Set Pnl=SDB.UI.NewDockablePersistentPanel("Lyrics")
          Pnl.Caption=SDB.Localize("Lyrics")
       If Pnl.IsNew Then
          Pnl.Common.Width=250
          Pnl.DockedTo=2
       End If
      Set Sxp=SDB.UI.NewActiveX(Pnl,"Shell.Explorer")
          Sxp.Common.Align=5
          Sxp.Common.ControlName="SXP"
          SDB.Objects("PLS")=Pnl
    End If
End Sub

Sub Check(LyrTmr)
If Not SDB.Player.CurrentSong Is Nothing Then 
    If SDB.Objects("PLS").Common.ChildControl("Lyrics").Common.Visible Then
        Set Sng=SDB.Player.CurrentSong
        X=Len(Sng.Lyrics):Y=Sng.ID:Z="ID"&Y&"v"&X
        If Prv<>Z Then 
           Prv= Z
           Refresh
        End If
    Else
        Script.UnregisterEvents LyrTmr
        SDB.Objects("MVL").Checked=False
    End If       
End If
End Sub

Sub Refresh
Set Doc=SDB.Objects("PLS").Common.ChildControl("SXP").Interf.Document
    Doc.Write Lyrics
    Doc.Close
End Sub

Function Lyrics
    Back=Replace("file:///" & SDB.ApplicationPath & "Skins\music_sheet.bmp" , "\", "/")
    Set Sng=SDB.Player.CurrentSong
    LyrTxt=Sng.Lyrics
    LyrTxt=Replace(LyrTxt,"<","(")
    LyrTxt=Replace(LyrTxt,">",")")
    LyrTxt=Replace(LyrTxt,vbNewLine,"</p>" & vbNewLine & "     <p>")
    LyrTxt=Replace(LyrTxt,"     <p></p>","     <br>")
 If LyrTxt="" Then 
    LyrTxt=SDB.Localize("Find Lyrics")
    LyrTxt="<a target=""_New"" href="""& FndLyr(Sng.ArtistName,Sng.Title) &""">"& LyrTxt &"</a>"
 End If
    Set Doc=New Page
    Doc.Add "<html>"
    Doc.Add " <head>"
    Doc.Add "  <style>"
    Doc.Add "   <!--"
    Doc.Add "    th { padding-left:0px;padding-right:0px;padding-top:0px;padding-bottom:1px }"
    Doc.Add "    td { padding-left:0px;padding-right:0px;padding-top:0px;padding-bottom:1px }"
    Doc.Add "    h1 { font-family:Georgia;font-size:11pt;margin-top:0;margin-bottom:5;text-align:center;font-weight:bold;font-style:italic }"
    Doc.Add "    h2 { font-family:Georgia;font-size:9pt;font-style:italic;text-align:right;font-weight:400;margin-top:0;margin-bottom:2 }"
    Doc.Add "    h3 { font-family:Georgia;font-size:9pt;font-style:italic;text-align:left;font-weight:400;margin-top:0;margin-bottom:2 }"
    Doc.Add "    h4 { font-family:Georgia;font-size:9pt;font-style:normal;text-align:center;font-weight:400;margin-top:0;margin-bottom:0 }"
    Doc.Add "    h5 { font-family:Georgia;font-size:11pt;font-style:italic;text-align:center;font-weight:400;margin-top:0;margin-bottom:0 }"
    Doc.Add "    h6 { font-family:Georgia;font-size:8pt;font-style:italic;text-align:center;font-weight:400;margin-top:3;margin-bottom:0 }"
    Doc.Add "    p  { font-family:Georgia;font-size:9pt;font-style:italic;text-align:center;margin-top:0;margin-bottom:5 }"
    Doc.Add "   -->"
    Doc.Add "  </style>"
    Doc.Add " </head>"
    Doc.Add " <body background="""&Back&""" background-attachment:fixed topmargin=2 leftmargin=2 rightmargin=1 bottommargin=1>"
    Doc.Add "  <table border=0 width=100% cellspacing=0 cellpadding=0>"

    Doc.Add "      <tr>"
    Doc.Add "        <td valign=top>"
    Doc.Add "         <h1>" & Sng.Title & "</h1>"
    Doc.Add "        </td>"
    Doc.Add "      </tr>"

    Doc.Add "      <tr>"
    Doc.Add "       <td valign=top>"
    Doc.Add "        <h4>-------<font face=Symbol> ¨ </font>-------</h4>"
    Doc.Add "       </td>"
    Doc.Add "      </tr>"
    
    Doc.Add "      <tr>"
    Doc.Add "       <td valign=top>"
    Doc.Add "        <h5>" & Sng.ArtistName & "</h5>"
    Doc.Add "       </td>"
    Doc.Add "      </tr>"

    Doc.Add "      <tr>"
    Doc.Add "       <td valign=top>"
    Doc.Add "        <h5>" & GetYear(Sng.OriginalYear,Sng.Year) & "</h5>"
    Doc.Add "       </td>"
    Doc.Add "      </tr>"

'Popular Music

 If Not Sng.Author & Sng.Lyricist="" Then 
         If Sng.Author="" Then 
          w=Sng.Lyricist
     ElseIf Sng.Lyricist="" Then
          w=Sng.Author
     Else:w=Sng.Author & ", " & Sng.Lyricist
     End If
    Doc.Add "      <tr>"
    Doc.Add "       <td valign=top>"
    Doc.Add "         <h6>(" & w & ")</h6>"
    Doc.Add "        </td>"
    Doc.Add "      </tr>"
 End If
    Doc.Add "      <tr>"
    Doc.Add "       <td valign=top>"
    Doc.Add "        <h4>-------<font face=Symbol> ¨ </font>-------</h4>"
    Doc.Add "       </td>"
    Doc.Add "      </tr>"

    Doc.Add "   <tr>"
    Doc.Add "    <td>"
    Doc.Add "     <p>" & LyrTxt & "</p>"
    Doc.Add "    </td>"
    Doc.Add "   </tr>"

    Doc.Add "  </table>"
    Doc.Add " </body>"
    Doc.Add "</html>"
    Lyrics=Doc.Content
End Function

Class Page
    Dim ATable,AddRows,Row
    Private Sub Class_Initialize()
        AddRows=50
        Row=0
        ReDim ATable(AddRows)
    End Sub
    Public Sub Add(Line)
        If Row>UBound(ATable) Then ReDim Preserve ATable(UBound(ATable)+AddRows)
        ATable(Row)=Line
        Row=Row+1
    End Sub
    Public Function Content
        Content=Join(ATable,vbNewLine)
    End Function
End Class

Function FndLyr(cArtist,cTitle)
    x="allinurl%3A+"& cArtist & " " & cTitle & " lyrics"
    x=Replace(x,"&","%26")
    x=Replace(x," ","+")
    x=Replace(x,"#","%23")
    FndLyr="http://www.google.com/search?q="&x&"&btnG"
End Function

Function GetYear(O,N)
        If O>0 Then
           GetYear=O
    ElseIf N>0 Then
           GetYear=N
    Else:  GetYear=""
    End If
End Function

---------
Note about version 1.00.
If you got a square up in the upper left corner then do:
1. Quit MediaMonkey
2. Execute this script in zip
Last edited by DiddeLeeDoo on Mon Mar 05, 2007 4:18 am, edited 26 times in total.
Image

Sgrom
Posts: 84
Joined: Sat Sep 02, 2006 5:59 am

Post by Sgrom » Thu Sep 07, 2006 11:41 am

Yippee

Simple and perfect :D

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Fri Sep 08, 2006 8:01 pm

I don't want to sound difficult, but why another lyrics script? Begges already made one: http://www.mediamonkey.com/forum/viewto ... 6355#46355

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Fri Sep 08, 2006 8:07 pm

Tiny update: Made v1.21 break ArtistName and SongTitle better.

@Sgrom. Glad installation/view went well this second time around.

@Steegy. I know he made one too, and in many ways was a pioneer in this field. But I guess it is only natural that little things like this you may want to make your own version, and make it to the best of your knowledge.

That's what I did, and I like and use my version and share it here. Seems like almost every scripter have some sort of 'lyrics solution'.

By the way, I would not share it if it was anything similar to Begges's version. I would then suggest changes to that script. This is a totally different way of doing it, apart from those things that naturally have to be the similar.
Image

MCSmarties
Posts: 248
Joined: Tue Dec 06, 2005 8:01 pm

Post by MCSmarties » Mon Sep 11, 2006 8:42 am

DiddeLeeDoo wrote:This is a totally different way of doing it, apart from those things that naturally have to be the similar.
Do you mean a different coding approach or a different result?

I am using Begges' script and love it so I'm curious if there's a reason to change. In your opinion, what makes your script better?
(I'm definitely not trying to start a script war, just curious because from the screenshot they look pretty much the same)

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Mon Sep 11, 2006 8:51 am

I simply made this one because I wanted to, and there's no major difference, so there's no reason to use this one to Begges version.

I just like to 'roll my own' and share them here in the process...
Image

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Sun Sep 17, 2006 1:49 am

Trying out a new style, where 1.5 line breaks for new lines, and 1.0 line break for incomplete lines.

Also made it much easier to modify background, font and font size.
Image

MCSmarties
Posts: 248
Joined: Tue Dec 06, 2005 8:01 pm

Post by MCSmarties » Mon Sep 18, 2006 3:08 pm

Here's an idea to make your script definitely different from Begges':
how about an option to include song information at the top of the panel?

I manually tweaked Begges's script so that it shows Album, Artist, Title and Year but I can't get it to display Original Year.

What I'd like is the following:
<Song title> (<Original Year> if it exists, else <Year>)
<Album>
<Artist>

My setup is such that the album art and Begges' lyrics panel fill up a considerable part of the screen. I can now glance at it from a distance
and recognize what song is currently played!

But I would like it to display the "Original Year" information rather than "Year. After all, it's interesting to know how old a song really is, not the year in which the particular "Best Of..." compilation was released!

Just an idea...

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Mon Sep 18, 2006 5:47 pm

Thank you for the comment and idea.

If you wanted something like that in this script, you would have to change the 'Lyrics' function to something like this.

Code: Select all

Function Lyrics
Back=Replace("file:///" & SDB.ApplicationPath & "Skins\music_sheet.bmp", "\", "/")
Head="<p style=""font-family:Verdana;font-size:10pt;font-weight:bold;color:#000080;margin-top:0;margin-bottom:8"">"
Body="<p style=""font-family:Verdana;font-size: 9pt;                               margin-top:0;margin-bottom:6"">"
    
    Set Sng=SDB.Player.CurrentSong
    
    If Sng.OriginalYear>0 Then 
       SnYear=" ("& Sng.OriginalYear &")"
    ElseIf Sng.Year>0 Then
       SnYear=" ("& Sng.Year &")"
    Else
       SnYear=""
    End If
    
    LyrTxt=Sng.Lyrics
    LyrTxt=Replace(LyrTxt,vbNewLine,"&nbsp;</p>" & vbNewLine & Body)
 If LyrTxt="" Then LyrTxt=SDB.Localize("No Lyrics")
    Set Doc=New Page
    Doc.Add "<html>"
    Doc.Add " <head>"
    Doc.Add "  <style>"
    Doc.Add "   <!--"
    Doc.Add "    th{ padding-left: 0px;padding-right: 0px; padding-top: 0px; padding-bottom: 3px }"
    Doc.Add "    td{ padding-left: 0px;padding-right: 0px; padding-top: 0px; padding-bottom: 3px }"
    Doc.Add "     -->"
    Doc.Add "  </style>"
    Doc.Add " </head>"
    Doc.Add " <body background="""&Back&""" style=background-attachment: fixed topmargin=""0"" leftmargin=""0"">"
    Doc.Add "  <table border=""0"" width=""100%"" cellspacing=""3"">"
    Doc.Add "   <tr>"
    Doc.Add "    <td>"
    Doc.Add "     " & Head 
    Doc.Add "      " & Sng.Title & SnYear & "<br>"
    Doc.Add "      " & Sng.AlbumName & "<br>"
    Doc.Add "      " & Sng.ArtistName
    Doc.Add "     </p>"
    Doc.Add "    </td>"
    Doc.Add "   </tr>"
    Doc.Add "   <tr>"
    Doc.Add "    <td>"
    Doc.Add "     " & Body
    Doc.Add "      " & LyrTxt
    Doc.Add "     </p>"
    Doc.Add "    </td>"
    Doc.Add "   </tr>"
    Doc.Add "  </table>"
    Doc.Add " </body>"
    Doc.Add "</html>"
    Lyrics=Doc.Content
End Function 
The year get extracted here.

Code: Select all

    If Sng.OriginalYear>0 Then 
       SnYear=" ("& Sng.OriginalYear &")"
    ElseIf Sng.Year>0 Then
       SnYear=" ("& Sng.Year &")"
    Else
       SnYear=""
    End If
and is used here.

Code: Select all

    Doc.Add "     " & Head 
    Doc.Add "      " & Sng.Title & SnYear & "<br>"
    Doc.Add "      " & Sng.AlbumName & "<br>"
    Doc.Add "      " & Sng.ArtistName
All up fun to play with, and I can only admire that you are into original years already. Haven't come that far in tagging yet.
Image

paulmt
Posts: 1170
Joined: Tue Jul 18, 2006 6:06 pm

Post by paulmt » Mon Sep 18, 2006 7:44 pm

Is "Original Year" information available from tags?

I get quiet frustrated at buying a cheap compilation album with say, best 100 blues songs of all time by various artists, only to see it tagged as year 2005 or something similar. Yes I know they are cheap but...

I would really like the original year to be sourced somehow.

salamat
Posts: 23
Joined: Sun Aug 20, 2006 3:32 am
Location: Philippines

Error!

Post by salamat » Tue Sep 19, 2006 7:46 am

I tried to install this scrips, but have this error; Error#424-Microsoft VBScript runtime error
Objekt required "Wscript"
File; "c:\programfiles\mediamonkey\scripts\auto\Install_Panel_Lyrics.vbs", line: 117, column: 4

When click OK, another eror; Error happened during script execution; Object required; "WScript"

I tried everything; searcing the web for information about Wscript, found something, tried it, read the help in windows for this program, following all the adwises, but to no avail.....

I'm running windows XP home edition, MM 2.5.3.968, and this is my system information; OS Name Microsoft Windows XP Home Edition
Version 5.1.2600 Service Pack 2 Build 2600
OS Manufacturer Microsoft Corporation
System Name LEO
System Manufacturer INTEL
System Model P4I45Gx_PE,
System Type X86-based PC
Processor x86 Family 15 Model 4 Stepping 1 GenuineIntel ~2392 Mhz
BIOS Version/Date American Megatrends Inc. P3.00, 01.06.2004
SMBIOS Version 2.3
Windows Directory C:\WINDOWS
System Directory C:\WINDOWS\system32
Boot Device \Device\HarddiskVolume1
Locale United States
Hardware Abstraction Layer Version = "5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)"
User Name LEO
Time Zone China Standard Time
Total Physical Memory 768,00 MB
Available Physical Memory 425,89 MB
Total Virtual Memory 2,00 GB
Available Virtual Memory 1,96 GB
Page File Space 2,95 GB
Page File C:\pagefile.sys

I like the idea of a script like this, but have no idea how to run it! I also tried some of this other lyric scripts, but gave up to use it due to almost same problem. Hope somebody can help me out here!

Thanks in advance.....

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK
Contact:

Post by trixmoto » Tue Sep 19, 2006 8:23 am

You don't appear to have Windows Script Host installed on your computer. Download it from Microsoft here.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Re: Error!

Post by DiddeLeeDoo » Tue Sep 19, 2006 9:32 am

salamat wrote:"c:\programfiles\mediamonkey\scripts\auto\Install_Panel_Lyrics.vbs", line: 117, column: 4
This is a sign that you have misunderstood the system a little bit.

Please remove this Install_Panel_Lyrics.vbs and use the new install file that I just made.

You see, what suppose to happen with these Install_.... files is that you download the .zip file, open it, and double-click the install_... file. By doing that, the script will automatically install itself.

In other words, the Install_.... file is a container script that is made for installation only. It contain the script itself.

Earlier I had two versions of this script, and I have taken it down to just one version to make it a bit simpler.

So if you try again, you can download the new .zip file, open the .zip, and just double click the Install_Panel_Lyrics.vbs instead of copying it to the \Auto folder.

You can do it all manually too if you like. What you then do is to copy the 'code from the post, and paste it into a blank Notepad document. Then you save the content to \Program Files\MediaMonkey\Scripts\Auto\ folder and call the file
"Panel_Lyrics.vbs"
Use the double quotes in the beginning and the end to prevent notepad adding .txt to the file.

One tell tell sign with scripts is if you see

Code: Select all

Sub OnStartup
bla bla
End Sub
in the scripts. That basically means that the script goes to the \Auto\ folder.
Image

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Tue Sep 19, 2006 9:48 am

Another thing, like Trixmoto says, you may actually download the scripting system, and many thanks to Trixmoto for providing links!

This will by the way reset scripting to 'Normal' if some sort of program have messed around with your scripting system.

Start - Run and write
CScript //H:WScript
and hit OK
Image

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Thu Sep 21, 2006 8:55 pm

Did more style work in v1.40 and added a link to "Find Lyrics" for songs with no lyrics. Instead of just showing "No Lyrics"

By hitting this 'Find Lyrics' link, your browser will open a page listing lyric sites having the lyrics (if they exist)

For hard to find lyrics, you can trim down a bit of the seach text to see if that helps.
Image

Locked