Newbie-Script: Import lyrics from Evillyrics (check code,pls

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Newbie-Script: Import lyrics from Evillyrics (check code,pls

by gh0st » Tue Oct 02, 2007 10:22 am

Berny, it works! Thanks for all the help, you rock!

by Big_Berny » Mon Oct 01, 2007 5:08 pm

Well, it was a really stupid 'bug':

Code: Select all

'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\"
This lines you had to modify because there was 'C:\Programme\...' as I use a german windows. And the '%programfiles%' didn't work at all altough it showes correct in a messagebox... MM-Bug?

So maybe you have to modify the path-line if you use a non-english windows. Here with german vista 'program files' works too.

by Vyper » Mon Oct 01, 2007 4:50 pm

Awesome! Works like a charm now! You da man! Image

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

by Vyper » Mon Oct 01, 2007 3:16 pm

Okay, I replaced my script with the one in your last past and when I highlighted a song that doesn't have any lyrics in the tag but does have lyrics in Evillyrics' cache and ran your script, this is what I got:


Image


When I closed that error box, this one was behind it:


Image

by gh0st » Sun Sep 30, 2007 8:44 pm

Berny, I deleted all previous versions of this script and made a new one jsut to be sure this is the correct one. I get:

0 out of 1 lyric imported

missing lyric-files: 1
Lyrics tag already exists: 0

by Big_Berny » Sun Sep 30, 2007 7:39 pm

Sorry, but it takes hours to find a bug if nobody follows my instructions.

Please use this version for a test on one of these songs and note the path which will be shown. After that click in windows on start/run, enter the exact path and click ok. Does the text-file with the lyric open? If not try to check the path by yourself and post it (the path) here please.

Code: Select all

EDIT: Code removed. Check last post.

by Vyper » Sun Sep 30, 2007 7:08 pm

Big_Berny wrote:Could you please read my posts!
Calm down BB, I'd like to work with you on this .... I already said I was getting the same error as ghost but I'll do as you just requested.

Here's what I get when I select a song that Evillyrics says I have lyrics for:


Image


:)

by Big_Berny » Sun Sep 30, 2007 8:31 am

Could you please read my posts! If you want me to find the bug I need more informations! Select a song where evillyrics shows the lyric but the script doesn't save it into the tag. Then select that song again, run my script and tell me the numbers behind "Missing lyric-files:" and "Lyrics-tag already exists:".

Thanks!

by Vyper » Sun Sep 30, 2007 8:28 am

The script from the last page is the one I used but just to be sure, I just tried the script on this page with the same result.

In the Evillyrics cache/B folder is Bobby Vinton - I Love How You Love Me.txt.

The script isn't putting anything into the lyrics tag of that song in my database when I highlight it and run the script.

by Big_Berny » Sun Sep 30, 2007 7:00 am

Well with following script (which I already posted on the last page) it sould show you "Missing lyric-files:" and "Lyrics-tag already exists:".

This information is needed to find out where the problem is...

Code: Select all

EDIT: Code removed. Check the last post later in the thread.

by Vyper » Sun Sep 30, 2007 6:25 am

Getting the same error as ghost and I've got your latest version.


Let me make sure I understand how this is supposed to work.


When I highlight a song in my database and then run this script, if there is a .txt file (formatted artist - title.txt) in the evillyrics/cache directory, the contents of that .txt file are written into the lyrics portion of the song's tag, correct?


If so, it's not working for me either.

by Big_Berny » Sun Sep 30, 2007 3:38 am

Then you don't have installed the last version I posted here... As this version shows anaother message. Check my last post with code (last page).

by gh0st » Sat Sep 29, 2007 9:32 pm

Anything else I can do?

by gh0st » Fri Sep 28, 2007 12:32 pm

I get the same:

0 out of 1 lyrics imported
check lyrics manually etc....

Top