Newbie-Script: Import lyrics from Evillyrics (check code,pls
Yes, it overwrites anything in the lyrics field. One of my tweaks was to check if there were any contents before checking for the file so none were overwritten.
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.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
This is the same script, with two exceptions.
1) Lyrics are not overwritten if they already exist.
2) Special characters are replaced by underscore (the same as EvilLyrics does).
1) Lyrics are not overwritten if they already exist.
2) Special characters are replaced by underscore (the same as EvilLyrics does).
Code: Select all
Sub EvilTagger
'This scripts imports the Lyrics from Evillyrics
'set the Evillyrics Cache options to "Cache organization ---> by first letter"
'
'Script will check if the lyrics.txt file of the selected songs exists
'and import it then to the lyrics tag
'Filename must be "Artist - Title.txt"
'Possible erros are strange characters in the Artist or Title Tag, e.g. "C'est la vie" or "ä/22*~"
'Here are the ini-Lines
'[Eviltagger]
'FileName=Eviltagger.vbs
'ProcName=Eviltagger
'Order=10
'DisplayName=EvilTagger
'Description=Import Lyrics from Evillyrics
'Language=VBScript
'ScriptType=0
DIM path, filename
DIM list, itm
DIM headline,lyrics, line
DIM msg, errorcounter, filecounter, msgtext
'######################################################
'Set the Errorcounter to his starting point
errorcounter = 0
'Set the Path to the Evillyrics Lyrics
'Evillyrics Options must be set to "Cache organization ---> by first letter" --> see below
path = "C:\Programme\Evillyrics\Lyrics\"
'######################################################
' Get list of selected tracks from MediaMonkey
Set list = SDB.CurrentSongList
filecounter = list.count
' Process all selected tracks
For i=0 To list.count-1
Set itm = list.Item(i)
If itm.Lyrics = "" Then 'Trixmoto - ignore tracks with lyrics already
'##################################################
'set the headline of the Lyrics
headline = itm.artistname & " - " & itm.title & CHR(10) &"___________________________________" & CHR(10)
'##################################################
' Create Filename
' by adding the first letter of the artist to the path ("Cache organization ---> by first letter")
'and then the Evillyrics scheme
Dim cap : cap = UCase(Left(itm.ArtistName,1))
If InStr("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",cap) = 0 Then
cap = "_"
End If
Dim art : art = correctfilename(itm.ArtistName)
Dim tit : tit = correctfilename(itm.Title)
filename = path & "\" & cap &"\" & art & " - " & tit & ".txt"
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FileExists(filename) = true Then
Set file = filesys.OpenTextFile(filename, 1, false)
'add headline to the beginning of the Lyrics
lyrics = headline
Do while not file.AtEndOfStream
line = file.ReadLine
lyrics = lyrics & chr(10) & line
Loop
'write Lyrics to the Lyrics tag
itm.lyrics = lyrics
Else
errorcounter = errorcounter +1
End if
End If
Next
' Write all back to DB and update tags
list.UpdateAll
'#####################################################
'set the final message
msgtxt = filecounter - errorcounter & " of " & filecounter& " lyrics imported "
msgtxt = msgtxt & CHR(10)& CHR(10) & "check missing lyrics manually, e.g. filename versus artist, title tag"
'#####################################################
'final user information
Msg = SDB.MessageBox(msgtxt , mtInformation, Array(mbOk))
End sub
Function correctfilename(str) 'Trixmoto - replaces special characters with underscore
Dim i,cap
For i = 1 To Len(str)
cap = Mid(str,i,1)
If InStr("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789. ",UCase(cap)) = 0 Then
cap = "_"
End If
correctfilename = correctfilename&cap
Next
End FunctionDownload 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.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Hi guys,
I improved trixmoto's edition by moving the UpdateAll-function into to loop. Now only songs with a new lyric will be tagged. It's much faster now.
Big_Berny
I improved trixmoto's edition by moving the UpdateAll-function into to loop. Now only songs with a new lyric will be tagged. It's much faster now.
Big_Berny
Code: Select all
EDIT: removed - see below
Last edited by Big_Berny on Fri Oct 20, 2006 8:51 am, edited 1 time in total.

Scripts in use: Genre Finder / Last.fm DJ / Magic Nodes / AutoRateAccurate / Last.FM Node
Skins in use: ZuneSkin SP / Eclipse SP
AutoRateAccurate 3.0.0 (New) - Rates all your songs in less than 5 seconds!
About me: icoaching - internet | marketing | design
Oups! Here's the new version which uses UpdateDB. It's better anyway.
Big_Berny
Big_Berny
Code: Select all
see my last post
Last edited by Big_Berny on Wed Nov 15, 2006 3:31 am, edited 1 time in total.

Scripts in use: Genre Finder / Last.fm DJ / Magic Nodes / AutoRateAccurate / Last.FM Node
Skins in use: ZuneSkin SP / Eclipse SP
AutoRateAccurate 3.0.0 (New) - Rates all your songs in less than 5 seconds!
About me: icoaching - internet | marketing | design
I've noticed a fault in all versions.
This section:
Doesn't account for characters like "Ö" which Eviltagger does save properly.
(Took me a while to figure out why Blue Öyster Cult tracks weren't being imported.)
Plus, if a song has "-" in the name, it gets saved as a space not an underscore.
The song title: "X-Ray Eyes" is treated by Evillyrics as "X Ray Eyes" not "X_Ray Eyes"
I'm sure there are a number of others.
This section:
Code: Select all
If InStr("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789. ",UCase(cap)) = 0 Then
cap = "_"
End If (Took me a while to figure out why Blue Öyster Cult tracks weren't being imported.)
Plus, if a song has "-" in the name, it gets saved as a space not an underscore.
The song title: "X-Ray Eyes" is treated by Evillyrics as "X Ray Eyes" not "X_Ray Eyes"
I'm sure there are a number of others.
This can easily be fixed. So let's find these specialcharacters which are not saved as underscore.
I found (additionally):
ÄÁÀÂÃËÉÈÊÏÍÌÎÖÓÒÔÕÜÚÙÛÑ¿
Any others?
And you're right: "-" gets " ".
Big_Berny
I found (additionally):
ÄÁÀÂÃËÉÈÊÏÍÌÎÖÓÒÔÕÜÚÙÛÑ¿
Any others?
And you're right: "-" gets " ".
Big_Berny

Scripts in use: Genre Finder / Last.fm DJ / Magic Nodes / AutoRateAccurate / Last.FM Node
Skins in use: ZuneSkin SP / Eclipse SP
AutoRateAccurate 3.0.0 (New) - Rates all your songs in less than 5 seconds!
About me: icoaching - internet | marketing | design
I've altered that last function as follows:
Also the special characters need to be inserted at the other point they are used in the code.
One thing I'm puzzled about: this section of the trixmoto's code:
Why is that instr function there? Why not just pass that to the correctfilename code?
Code: Select all
Function correctfilename(str) 'Trixmoto - replaces special characters with underscore
Dim i,cap
For i = 1 To Len(str)
cap = Mid(str,i,1)
If InStr("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ÄÁÀÂÃËÉÈÊÏÍÌÎÖÓÒÔÕÜÚÙÛÑ¿. ",UCase(cap)) = 0 Then
if cap = "-" then
cap = " "
else
cap = "_"
end if
End If
correctfilename = correctfilename&cap
Next
End Function
One thing I'm puzzled about: this section of the trixmoto's code:
Code: Select all
' Create Filename
' by adding the first letter of the artist to the path ("Cache organization ---> by first letter")
'and then the Evillyrics scheme
Dim cap : cap = UCase(Left(itm.ArtistName,1))
If InStr("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ÄÁÀÂÃËÉÈÊÏÍÌÎÖÓÒÔÕÜÚÙÛÑ¿",cap) = 0 Then
cap = "_"
End If
Dim art : art = correctfilename(itm.ArtistName)
Dim tit : tit = correctfilename(itm.Title)
Yes, it's the same for the folders. Just tested it.
By the way I just found out that a "-" gets replaced with "" (nothing) and not with a " " (space).
Big_Berny
By the way I just found out that a "-" gets replaced with "" (nothing) and not with a " " (space).
Big_Berny

Scripts in use: Genre Finder / Last.fm DJ / Magic Nodes / AutoRateAccurate / Last.FM Node
Skins in use: ZuneSkin SP / Eclipse SP
AutoRateAccurate 3.0.0 (New) - Rates all your songs in less than 5 seconds!
About me: icoaching - internet | marketing | design