Inline Lyrics 3.2 - Updated 29/07/2014

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Inline Lyrics 3.2 - Updated 29/07/2014

Postby trixmoto » Sun Dec 04, 2005 11:19 am

This script displays lyrics in a progress bar at the bottom of your MM window. I like this because they are unintrusive, but you can sing-a-long if you want to! :)

The lyrics must be LRC timestamped lyrics, stored in the <lyrics> tag. For information on this, check here: http://www.cdmi.net/a2player/lrc_center.html. Enhanced tags are valid, but ignored by this script as the lyrics are displayed line by line.

This site also has some demo lyrics for you to try out. If you find a good site for downloading LRC lyrics, please post it here!

Please note this is a type 2 script, this means that once installed and MM has been (re)started, this script will launch automatically whenever a song is played. Any song without lyrics will simply exit the script as soon as it's started.

As with all my scripts, an installer can be downloaded from my website.

Code: Select all
'
' MediaMonkey Script
'
' NAME: InlineLyrics 3.2
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 29/07/2014
'
' INSTALL: Copy to Scripts directory and add the following to Scripts.ini
'          Don't forget to remove comments (') and set the order appropriately
'
' FIXES: Fixed sync delay when seeking in a track
'
' [InlineLyrics]
' FileName=InlineLyrics.vbs
' ProcName=InlineLyrics
' Order=12
' DisplayName=&Inline Lyrics
' Description=Show timed lyrics in a progress bar
' Language=VBScript
' ScriptType=2
'

Option Explicit

Sub InlineLyrics
  'check for LyricTimer running
  Dim form : Set form = SDB.Objects("LyricTimer")
  If Not (form is Nothing) Then
    If form.Common.Visible Then
      Exit Sub
    End If
  End If
 
  'create display
  Dim line : Set line = SDB.Progress
  line.Text = "InlineLyrics by Trixmoto (http://trixmoto.net)"
  Set SDB.Objects("InlineLyricsLine") = line
 
  'check for current song
  Dim itm : Set itm = SDB.Player.CurrentSong
  If itm Is Nothing Then
    Call Error("No current song in player")
    Exit Sub
  End If   

  'check for lyrics
  Dim lrc : lrc = itm.Lyrics
  If lrc = "" Then
    Call Error("No lyrics in current song")
    Exit Sub
  End If
 
  'remove header
  lrc = deheader(lrc)
  If lrc = "" Then
    Call Error("No timestamps in lyrics")
    Exit Sub   
  End If

  'removed enhanced timestamps 
  lrc = simplify(lrc)
  If lrc = "" Then
    Call Error("No lyric lines found")
    Exit Sub   
  End If
 
  'create data
  Dim dat : Set dat = CreateObject("Scripting.Dictionary")
  dat.Item("idx") = itm.ID
  dat.Item("tot") = itm.SongLength 
  dat.Item("lst") = itm.SongLength
  dat.Item("pos") = 0
  dat.Item("tsp") = 0
  Dim i : i = 0
  Dim arr : arr = split(lrc,VBCrLf)
  For i = 0 To UBound(arr)
    dat.Item("#"&i) = arr(i)
  Next
  dat.Item("max") = UBound(arr)
  Set SDB.Objects("InlineLyricsData") = dat
 
  'start loop
  Dim tmr : Set tmr = SDB.CreateTimer(100)
  Set SDB.Objects("InlineLyricsTimer") = tmr
  Call Script.RegisterEvent(tmr,"OnTimer","MainLoop")
End Sub

Sub MainLoop(Tmr)
  'check for display
  Dim lin : Set lin = SDB.Objects("InlineLyricsLine")
  If lin Is Nothing Then
    Call Script.UnregisterEvents(Tmr)
    Call SDB.MessageBox("InlineLyrics: The progress bar has been lost",mtError,Array(mbOk))
    Exit Sub
  End If 
  If lin.Terminate Then
    Call Script.UnregisterEvents(Tmr)
    Call Error("Cancelled by user")
    Exit Sub
  End If

  'check for data 
  Dim dat : Set dat = SDB.Objects("InlineLyricsData")
  If dat Is Nothing Then
    Call Script.UnregisterEvents(Tmr)
    Call Error("Data has been lost")
    Exit Sub
  End If

  'check for song change 
  If Not SDB.Player.CurrentSong.ID = Int(dat.Item("idx")) Then
    Call Script.UnregisterEvents(Tmr)
    Exit Sub
  End If
 
  'check for player stopped
  If Not SDB.Player.isPlaying Then
    Call Script.UnregisterEvents(Tmr)
    Call Error("Player stopped")
    Exit Sub
  End If
 
  'check for end of song
  If SDB.Player.PlaybackTime+100 > Clng(dat.Item("tot")) Then
    Call Script.UnregisterEvents(Tmr)
    Exit Sub
  End If
 
  'check for LyricTimer
  Dim form : Set form = SDB.Objects("LyricTimer")
  If Not (form is Nothing) Then
    If form.Common.Visible Then
      Call Script.UnregisterEvents(Tmr)
      Exit Sub
    End If
  End If

  'check for position decreased
  Dim tsp : tsp = Int(dat.Item("tsp"))
  Dim pos : pos = Int(dat.Item("pos"))
  Dim lst : lst = Clng(dat.Item("lst"))
  If SDB.Player.PlaybackTime < lst Then
    pos = 0
    tsp = gettime(dat.Item("#"&pos))
  End If
   
  'check for next line
  Dim max : max = Int(dat.Item("max"))
  If pos <= max Then
    While (pos <= max) And (tsp < SDB.Player.PlaybackTime+100)
      pos = pos+1
      If pos <= max Then
        tsp = gettime(dat.Item("#"&pos))
      End If
    WEnd
    If pos > 0 Then
      lin.Text = getline(dat.Item("#"&(pos-1)))
    End If
    lst = SDB.Player.PlaybackTime
  End If
 
  'save data
  dat.Item("pos") = pos
  dat.Item("lst") = lst
  dat.Item("tsp") = tsp
End Sub

Sub Error(txt)
  'check for display
  Dim lin : Set lin = SDB.Objects("InlineLyricsLine")
  If lin Is Nothing Then
    Call SDB.MessageBox("InlineLyrics: "&txt,mtError,Array(mbOk))
    Exit Sub
  End If 

  'display error for short time
  lin.Text = "InlineLyrics: "&txt
  Dim tmr : Set tmr = SDB.CreateTimer(5000)
  Set SDB.Objects("InlineLyricsTimer") = tmr 
  Call Script.RegisterEvent(tmr,"OnTimer","ClearUp")
End Sub

Sub ClearUp(Tmr)
  Call Script.UnregisterEvents(Tmr)
  Set SDB.Objects("InlineLyricsTimer") = Nothing
  Set SDB.Objects("InlineLyricsData") = Nothing 
  Set SDB.Objects("InlineLyricsLine") = Nothing
End Sub

Function deheader(txt)
  Dim pos : pos = InStr(txt,"[0")
  If pos = 0 Then
    deheader = ""
  Else
    deheader = Mid(txt,pos)
  End If
End Function

Function simplify(txt)
  Dim a : a = InStr(txt,"<")
  If a = 0 Then
    simplify = txt
    Exit Function
  End If
 
  Dim b : b = InStr(txt,">")
  Dim l : l = Len(txt)
  Dim c : c = Mid(txt,1,a-1)
  If b = 0 Then
    b = a
  End If
  Dim d : d = Mid(txt,b+1,l-b)
  txt = c&d
  a = InStr(txt,"<")
  If a > 0 Then
    txt = simplify(txt)
  End If
  simplify = txt
End Function

Function gettime(txt)
  gettime = 0
  If Left(txt,1) = "[" Then
    Dim temp,min,sec,mil
    temp = Mid(txt,2,2)
    If isNumeric(temp) Then
      min = Clng(temp)
    End if
    temp = Mid(txt,5,2)
    If isNumeric(temp) Then
      sec = Clng(temp)
    End If
    temp = Mid(txt,8,2)
    If isNumeric(temp) Then
      mil = Clng(temp) 
    End If
    gettime = min*60000 + sec*1000 + mil*1   
  End If
End Function

Function getline(txt)
  getline = Mid(txt,11,Len(txt)-10)
End Function

Sub Install()
  Dim inip : inip = SDB.ApplicationPath&"Scripts\Scripts.ini"
  Dim inif : Set inif = SDB.Tools.IniFileByPath(inip)
  If Not (inif Is Nothing) Then
    inif.StringValue("InlineLyrics","Filename") = "InlineLyrics.vbs"
    inif.StringValue("InlineLyrics","Procname") = "InlineLyrics"
    inif.StringValue("InlineLyrics","Order") = "12"
    inif.StringValue("InlineLyrics","DisplayName") = "Inline Lyrics"
    inif.StringValue("InlineLyrics","Description") = "Show timed lyrics in a progress bar"
    inif.StringValue("InlineLyrics","Language") = "VBScript"
    inif.StringValue("InlineLyrics","ScriptType") = "2"
    SDB.RefreshScriptItems
  End If
End Sub
Last edited by trixmoto on Sat Feb 02, 2008 10:22 am, edited 3 times in total.
Download my scripts at trixmoto.net.
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
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby judas » Sun Dec 04, 2005 1:01 pm

Will try it soon...
judas
 
Posts: 572
Joined: Thu Jun 02, 2005 11:26 pm
Location: Bogotá, Colombia

Postby trixmoto » Mon Dec 05, 2005 4:53 am

I'm using it now and loving it. But then, I wrote it! :lol:
Download my scripts at trixmoto.net.
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
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby trixmoto » Tue Dec 06, 2005 11:53 am

New version of the monitor script. This has been stabalised massively, much better now:

:o NEW CODE BELOW :o
Last edited by trixmoto on Wed Mar 15, 2006 10:58 am, edited 1 time in total.
Download my scripts at trixmoto.net.
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
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby Teknojnky » Mon Jan 23, 2006 5:55 pm

Was wondering if there is a way for this script to read or import the lyrics saved to the mp3 tags via Minilyrics or from a folder of saved .txt and .lrc files (again from minilyrics).
Teknojnky
 
Posts: 5521
Joined: Tue Sep 06, 2005 11:01 pm

Postby trixmoto » Mon Jan 23, 2006 6:12 pm

I don't use MiniLyrics myself.

The .txt and .lrc files: are they the same name as the matching music track with only the extension different? Could you email an example?
Download my scripts at trixmoto.net.
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
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby Teknojnky » Mon Jan 23, 2006 6:39 pm

Minilyris is awesome. I've been using for quite awhile now and love it especially now it recently started working with mediamonkey.

ML has 3 options, it can save the files to the same directory as the mp3, it can save them all to a single directory (ala \music\lyics) and it can save directly to the mp3 (although I have no way to verify this as MM does not show any of the lyrics in the properties window.

To answer your question, yes the files it saves appears to be in the <artist> - <title> format.

I don't know in what format the files are saved to the tags.

I have 6k+ lyrics files from minilyrics so far!
Teknojnky
 
Posts: 5521
Joined: Tue Sep 06, 2005 11:01 pm

Postby pah68 » Tue Jan 24, 2006 3:48 am

Teknojnky wrote:and it can save directly to the mp3 (although I have no way to verify this as MM does not show any of the lyrics in the properties window.


You would need to rescan the files after the lyrics are added.
Image
Image
pah68
 
Posts: 1484
Joined: Wed Apr 07, 2004 5:26 pm
Location: Sydney, Australia

Postby trixmoto » Tue Jan 24, 2006 6:24 am

Well if you save the lyrics to the tags, and they are timestamped (LRC) lyrics then rescanning the files should make this script work.

Having the separate files makes finding the lyrics more difficult. Presumably you can setup the file location using a mask in MiniLyrics?
Download my scripts at trixmoto.net.
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
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby Teknojnky » Tue Jan 24, 2006 1:33 pm

I have MM gold and the folders rescan on startup and the lyrics do not show up, so I am assuming that the embedded lyrics tags are something specific to minilyrics, although I assume other apps could use them if they were programmed to recognize them.

As an aside, I recommend minilyrics as highly as I do mediamonkey.
Teknojnky
 
Posts: 5521
Joined: Tue Sep 06, 2005 11:01 pm

Postby trixmoto » Tue Jan 24, 2006 4:30 pm

I will install minilyrics and see if I can get my script working well with it. I'll let you know if a working version transpires! :)
Download my scripts at trixmoto.net.
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
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby Teknojnky » Tue Jan 24, 2006 4:37 pm

wuwu! I think you will be impressed.

8)
Teknojnky
 
Posts: 5521
Joined: Tue Sep 06, 2005 11:01 pm

Postby Steegy » Wed Jan 25, 2006 4:33 am

@Trixmoto

You'll probably want the newest version from http://www.crintsoft.com

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Steegy
 
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium

Postby trixmoto » Wed Jan 25, 2006 5:53 am

I get the following error message with MiniLyrics:

Image

Any ideas?
Download my scripts at trixmoto.net.
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
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby Teknojnky » Wed Jan 25, 2006 11:37 am

trixmoto wrote:I get the following error message with MiniLyrics:

Image

Any ideas?


I get that rarely if the server is busy or my internet is wacky.

I would double check the minlyrics options, rightlclick window (or control-P ), setup, internet and make sure your internet options are correct, and try the test connection button.

If its just for one file, it usually just means it can't find it. If it's for all, it might be a dns issue or other connection/server problem.

It's been working fine for me lately.
Teknojnky
 
Posts: 5521
Joined: Tue Sep 06, 2005 11:01 pm

Next

Return to Need Help with Addons?

Who is online

Users browsing this forum: No registered users and 15 guests