Inline Lyrics 3.2 - Updated 29/07/2014

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

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

Post by Steegy »

Hmm, probably wrong guess, because the previous example lyrics file has that too, and there it isn't the cause of the error.
They Shouldn't be there anyway
Why not? Lyrics files are made following a standard and so have some standard tags too.

Maybe it's the blank line that's causing the problem. Anyway, I don't know (haven't read) the code so I don't know how the script works.

ADDITION: just briefly looked at the code; "deheader" removes the header in the beginning of the file (the standard tags)
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

The header should be there and is handled. The problem is the blank line that you have in the middle. Each line after the headers must start with a timestamp. The next version will be more flexible and deal with these situations better.
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.
wallstreetwalker
Posts: 150
Joined: Wed Dec 07, 2005 9:56 am

Post by wallstreetwalker »

thanks it works now

Amazing script !!

can't wait for future versions of this!! :P
PUNK IN DRUBLIC
Guest

Post by Guest »

Trixmoto,

I'm getting the same previously mentioned error when editing timestamps with the LyricTimer:

InlineLyrics2.vbs

Line: 91
Char: 3
Type Mismatch: 'Clng'
Code: 800A000D
Source: Microsoft VBscript runtime error.

The line is:
min = Clng(mid(txt,2,2))
When the error occurs I say yes to continue. InlineLyrics closes, but I can still continue to edit in the LyricTimer and save the changes. This happens whether Loop is set to No or Yes.

NB I am adding extra lines into the Lyrics (to get them absolutely right), and then re-running the Lyric Timer to timestamp the new lines, which it recognises. Of course, InlineLyrics is running while I'm doing this, and doesn't expect the extra lines in the loop - as I see it.

Is there a quick code fix for this, that I can implement? Some way to let the InlineLyrics know that the LyricTimer is in edit mode with previously unseen lines. As opposed to only fine tuning the timings.

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

Post by trixmoto »

Well I definitely wouldn't suggest running them both at the same time. I hadn't considered this situation but thinking about it there will definitely be some conflicts at the moment.

I need to do some work on Inline Lyrics to bring it up to speed with the new robust reading I've added to Lyric Timer.

I will have to experiment with running both at the same time and then the next release should have any conflicts dealt with.

Thank you for bringing this to my attention! :)
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.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

New version (2.1) has been fixed so it should it should be much more stable when reading the lyrics. Also it switches off if you are running LyricTimer as this causes conflicts.

InlineLyrics.vbs

Code: Select all

'
' MediaMonkey Script
'
' NAME: InlineLyrics 2.1
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 15/03/2006 
'
' INSTALL: Copy to Scripts directory and add the following to Scripts.ini 
'          Don't forget to remove comments (') and set the order appropriately
'          Needs file 'InlineLyrics2.vbs' to be in '{MM}\Scripts\'
'
' FIXES: Don't run if LyricTimer is running
'        Improve reading of timestamps
'
' [InlineLyrics]
' FileName=InlineLyrics.vbs
' ProcName=InlineLyrics
' Order=12
' DisplayName=&InlineLyrics
' Description=Show timed lyrics in a progress bar
' Language=VBScript
' ScriptType=2 
'

Option Explicit

Sub InlineLyrics
  
  'check for LyricTimer running
  Dim form,res
  Set form = SDB.Objects("LyricTimer")
  If Not (form is Nothing) Then
    If form.Common.Visible Then Exit Sub
  End If
  
  'check helper script exists
  Dim LoopScript,filesys
  LoopScript = SDB.ApplicationPath&"Scripts\InlineLyrics2.vbs"
  Set filesys = CreateObject("Scripting.FileSystemObject")
  If not filesys.FileExists(LoopScript) Then
    res = SDB.MessageBox("File '"&LoopScript&"' cannot be found.", mtError, Array(mbOk))
    Exit Sub
  End If
  
  'run helper script
  Dim lrc,WShell,command
  lrc = SDB.Player.CurrentSong.Lyrics
  If Left(lrc,1) = "[" Then
    Set WShell = CreateObject("WScript.Shell")
    command = "wscript "&Chr(34)&LoopScript&Chr(34)
    res = WShell.Run(command, 1, 0)
  End If
End Sub
InlineLyrics2.vbs

Code: Select all

'
' MediaMonkey Script
'
' NAME: InlineLyrics 2.1
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 15/03/2006
'
' INSTALL: Helper script for 'InlineLyrics.vbs'
'          Needs to be in '{MM}\Scripts\'
'

Option Explicit

Dim SDB,line
Set SDB = CreateObject("SongsDB.SDBApplication")
Set line = SDB.Progress
line.Text = "InLineLyrics by Trixmoto (http://trixmoto.net)"

Dim idx,tot,lrc
idx = SDB.Player.CurrentSong.ID
tot = SDB.Player.CurrentSong.SongLength
lrc = SDB.Player.CurrentSong.Lyrics
If lrc = "" Then
  line.Text = "InlineLyrics - Error01 - No lyrics"
Else
  lrc = deheader(lrc)
  If lrc = "" Then
    line.Text = "InlineLyrics - Error02 - No timestamps"
  Else
    lrc = simplify(lrc)
    If lrc = "" Then
      line.Text = "InlineLyrics - Error03 - No lines"
    Else
      Dim arr,lst,pos,tsp
      arr = split(lrc,VBCrLf)
      lst = SDB.Player.CurrentSongLength
      Do While valid() 
        If SDB.Player.PlaybackTime < lst Then 
          pos = 0
          tsp = gettime(arr(pos))
        End If
        If pos <= UBound(arr) Then
          If tsp < SDB.Player.PlaybackTime+100 Then
            line.Text = getline(arr(pos))
            pos = pos + 1
            If pos <= UBound(arr) Then tsp = gettime(arr(pos))
          End If
        End If
        lst = SDB.Player.PlaybackTime
        WScript.Sleep 100
      Loop
    End If
  End If
End If

Set line = nothing
Set SDB = nothing

Function valid()
  valid = true
  If line.Terminate Then 				'user cancels
    valid = false
    Exit Function
  End If
  If not SDB.Player.CurrentSong.ID = idx Then 		'song changes
    valid = false
    Exit Function
  End If
  If not SDB.Player.isPlaying Then 			'play stopped
    valid = false
    Exit Function
  End If
  If SDB.Player.PlaybackTime+100 > tot Then 		'song ended
    valid = false
    Exit Function
  End If
  Dim form,res						'LyricTimer running
  Set form = SDB.Objects("LyricTimer")
  If Not (form is Nothing) Then
    If form.Common.Visible Then 
      valid = false
      Exit Function
    End If
  End If
End Function

Function deheader(txt)
  Dim wid,pos
  wid = Len(txt)
  pos = 0
  Do while pos < wid
    pos = pos + 1
    If Mid(txt,pos,2) = "[0" Then Exit Do      
  Loop
  deheader = mid(txt,pos)
End Function

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

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

Function getline(txt)
  Dim length
  length = Len(txt)-10
  getline = mid(txt,11,length)
End Function
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.
Investor

Post by Investor »

I've set this script to Type=0 so that I can view Inline lyrics per song on individual demand.

It would be very useful if I could toggle the script to auto, from within MM, during a session. In other words, choose whether to have the Inline Lyrics showing continuously (as tracks change) or not.

Also:

If I use the player scroll to jump to different points in the track (and similarly when invoking the script on demand) the lyrics can be seen 'catching up'.

Is it possible to recognise the interrupt so that the status bar only shows the text when Inline Lyrics has reached the time point?

btw This is a really good project and I like the current form of it. But what are the possibilities (or limitations!) for future development? I'm thinking of things like text formats; scrolling text; fade in and out; maybe using a dockable panel etc. Do you plan to do more?

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

Post by trixmoto »

I don't really plan to do much more with this script, because Lyric Timer is become a more advanced version of it.

There's no way to fade text because a standard progress bar is used, although scrolling text could be achieved using a timer and a ticker-tape style algorithm.

The "catching up" is the most stable way of doing it. A more complex set of timers could be set up to run the lyrics at the correct time, but just starting from zero and running through to the right point ensures stability.

Check out the Lyric Timer script and see what you think of that. It's type 0! :)
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.
Investor

Post by Investor »

Thanks for reply. I'll have a look at the other script, for certain. :)
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

New version (3.0) is now available to download from my website. Changes include...

- Made compatible with MM3
- Combined helper script into main script
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.
rrfpacker
Posts: 1065
Joined: Sat Jul 12, 2008 5:47 pm

Re: Inline Lyrics 3.0 [MM2+3]

Post by rrfpacker »

I installed Inline Lyrics today and I continue to get two error messages when a song starts. It's the same message that this poster had (see link below). It continues to give this error until MM either shuts down or I use Task Master to shut down.

I tried to ask the other person, but they don't seem to be a member anymore. I'm thinking I would really like this script as it will not take up so much space if I choose to shut down Mini Lyrics.

FYI. Also, updated ML today to 6.4.212.

http://www.mediamonkey.com/forum/viewto ... cs#p165631

Any thoughts?
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: Inline Lyrics 3.0 [MM2+3]

Post by trixmoto »

The other user was using a different version of the scripts (assuming you are using 3.0) - can you please upload a screenshot so I can see what line number is throwing the error?
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.
rrfpacker
Posts: 1065
Joined: Sat Jul 12, 2008 5:47 pm

Re: Inline Lyrics 3.0 [MM2+3]

Post by rrfpacker »

I don't have a way to insert/attach a screen shot, unless I attach it in an email.

However, the error message reads;

Error #5 - Microsoft VBScript Runtime Error
Invalid Procedure Call or Argument: 'Mid'
File: "C:\Program Files\Media Monkey\Scripts\InlineLyrics.vbs" Line: 245, Column: 2

The above error message occurs first and within a second another that reads;

Error executing script event.

I have MM version 3.07.1191 and InlineLyrics 3.0.
Operating system is Windows 2000

I also read in the same thread where your Lyrics Timer is more advanced. Is that a better way to go or is it a companion?

Hope this helps. Thanks
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: Inline Lyrics 3.0 [MM2+3]

Post by trixmoto »

The "Lyric Timer" script is really for adding timings to lyrics and this "Inline Lyrics" script is designed to be a streamlined way of displaying them whilst the track is playing, so they are designed to be used together.

Can you please email or PM me the lyrics of the track which gives you this error?
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.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: Inline Lyrics 3.1 [MM2+3]

Post by trixmoto »

New version (3.1) is now available to download from my website. Changes include...

- Fixed errors for songs with lyrics but no timestamps
- Extended time for displaying error messages
- Added update server to installation package
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.
Post Reply