Newbie-Script: Import lyrics from Evillyrics (check code,pls
Posted: Wed Apr 26, 2006 2:44 am
Hi again,
and here is my second script for MM (i am very productive you see, using MM for two days and two new scripts came out
)
I use Evillyrics for my Lyrics and do not want to copy/paste all the lyrics in the lyrics tag of the mp3files (i have to do this because otherwise they will not show on this ipod-thing).
So i have written this importer script. I am a bit worried about, if this script will corrupt my files (writing tags without knowing anaything about and just using this scripting language).... Any comments??
Begges
and here is my second script for MM (i am very productive you see, using MM for two days and two new scripts came out

I use Evillyrics for my Lyrics and do not want to copy/paste all the lyrics in the lyrics tag of the mp3files (i have to do this because otherwise they will not show on this ipod-thing).
So i have written this importer script. I am a bit worried about, if this script will corrupt my files (writing tags without knowing anaything about and just using this scripting language).... Any comments??
Begges
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)
'##################################################
'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
filename = path & "\" & left(itm.artistname,1) &"\" & itm.artistname & " - " & itm.title & ".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
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