by Big_Berny » Mon Oct 01, 2007 4:28 pm
Ok, I think I found the problem. Use this script. Should work now. At least I hope so...
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, ignored, msgtext
'######################################################
'Set the Errorcounter to his starting point
errorcounter = 0
ignored = 0
'Set the Path to the Evillyrics Lyrics
'Evillyrics Options must be set to "Cache organization ---> by first letter" --> see below
path = "C:\Program Files\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
if cap = "-" then
cap = ""
else
cap = "_"
end if
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 and itm.lyrics= "" Then
Set file = filesys.OpenTextFile(filename, 1, false)
lyrics = ""
lyrics = headline 'add headline to the beginning of the Lyrics
Do while not file.AtEndOfStream
line = file.ReadLine
if line="----------------" then
exit do
end if
lyrics = lyrics & chr(10) & line
Loop
itm.lyrics = lyrics 'write Lyrics to the Lyrics tag
itm.UpdateDB
itm.WriteTags
Else
errorcounter = errorcounter+1
End if
Else
ignored = ignored+1
End If
Next
'#####################################################
'set the final message
msgtxt = filecounter-errorcounter-ignored & " of " & filecounter& " lyrics imported" & CHR(10) & CHR(10)& "Missing lyric-files:" & CHR(9) & CHR(9) & errorcounter & CHR(10) & "Lyrics-tag already exists:" & CHR(9) & ignored
'#####################################################
'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
if cap = "-" then
cap = ""
else
cap = "_"
end if
End If
correctfilename = correctfilename&cap
Next
End Function
Ok, I think I found the problem. Use this script. Should work now. At least I hope so...
[code]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, ignored, msgtext
'######################################################
'Set the Errorcounter to his starting point
errorcounter = 0
ignored = 0
'Set the Path to the Evillyrics Lyrics
'Evillyrics Options must be set to "Cache organization ---> by first letter" --> see below
path = "C:\Program Files\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
if cap = "-" then
cap = ""
else
cap = "_"
end if
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 and itm.lyrics= "" Then
Set file = filesys.OpenTextFile(filename, 1, false)
lyrics = ""
lyrics = headline 'add headline to the beginning of the Lyrics
Do while not file.AtEndOfStream
line = file.ReadLine
if line="----------------" then
exit do
end if
lyrics = lyrics & chr(10) & line
Loop
itm.lyrics = lyrics 'write Lyrics to the Lyrics tag
itm.UpdateDB
itm.WriteTags
Else
errorcounter = errorcounter+1
End if
Else
ignored = ignored+1
End If
Next
'#####################################################
'set the final message
msgtxt = filecounter-errorcounter-ignored & " of " & filecounter& " lyrics imported" & CHR(10) & CHR(10)& "Missing lyric-files:" & CHR(9) & CHR(9) & errorcounter & CHR(10) & "Lyrics-tag already exists:" & CHR(9) & ignored
'#####################################################
'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
if cap = "-" then
cap = ""
else
cap = "_"
end if
End If
correctfilename = correctfilename&cap
Next
End Function[/code]