[RELEASE] xbmclyrics script - automatically grabs lyrics online

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Closed
EnderW Offline
Skilled Python Coder
Posts: 249
Joined: Feb 2005
Reputation: 0
Thumbs Up  [RELEASE] xbmclyrics script - automatically grabs lyrics online
Post: #1
xbmclyrics is a script which will grab lyrics from http://www.lyrc.com.ar for the song you are currently playing. it is not a final release, but as i am going away for some days i decided to release it now. there are a lot of bugs i am sure, please report them.

there is one feature that is planned, but i haven't got it done yet. this is automatic updating of lyrics as song changes. i will add that later. the script looks best with pm1 or pm2 as it uses chokemaniac's panel as base (thanks cm). for easy access i suggest either adding it to the submenu or mapping it to a button using keymap.xml (this is possible, right? Wink)

not much more left to say then i guess, i hope you find some use in it. enjoy!

http://enderw.emutalk.net/xbmclyrics.rar

xbmcscripts.com administrator
find
Tomkun Online
Fan
Posts: 558
Joined: Jul 2004
Reputation: 4
Location: Japan
Post: #2
hi,

first of all, great script! i can see this is gonna be a good one, but for now i have found a couple of bugs...

1) the panel doesn't show up. this means it just overlays on the current screen, which can make it difficult to read.

2) it doesn't size correctly for my ntsc tv. i guess it was sized for pal? is there a way to make it automatically resize?

3) if the song lyrics don't exist on the website, it will display the lyrics of a different song by the same artist. i checked the website and it does it too. i don't know if you could fix that in the script somehow?

other that that, this seems to be a great script! well done!
:thumbsup:
find
Tomkun Online
Fan
Posts: 558
Joined: Jul 2004
Reputation: 4
Location: Japan
Post: #3
ok, referring to point (1) above, i found the problem. i was running the script from a subdirectory in the scripts folder, but the script looks for the image in the scripts folder only. i edited the script to reflect the change and it works fine now. is there a way to make this automatic?
find
Tomkun Online
Fan
Posts: 558
Joined: Jul 2004
Reputation: 4
Location: Japan
Post: #4
ok, me again.

referring to point (2) above, i have been fiddling about with the settings for my ntsc tv. i have found some good sizes for ntsc. if you have an ntsc tv, change :

Quote:self.addcontrol(xbmcgui.controlimage(158,25,520,500, 'q:\\scripts\\lyricspanel.png'))

self.textbox = xbmcgui.controltextbox(190,130,400,350, 'font14', '0xffffffff')
self.addcontrol(self.textbox)

self.fadelabel = xbmcgui.controlfadelabel(270,95,255,25, 'font14','0xffffffff')

to

Quote: self.addcontrol(xbmcgui.controlimage(158,20,520,420, 'q:\\scripts\\xbmclyrics\\lyricspanel.png'))

self.textbox = xbmcgui.controltextbox(190,110,400,290, 'font14', '0xffffffff')
self.addcontrol(self.textbox)

self.fadelabel = xbmcgui.controlfadelabel(270,75,255,15, 'font14','0xffffffff')

it should fit much better! Smile
find
pop Offline
Junior Member
Posts: 22
Joined: Dec 2004
Reputation: 0
Post: #5
this is mint well done :bowdown:
find
solexalex Offline
Skilled Python Coder
Posts: 706
Joined: Jul 2004
Reputation: 6
Post: #6
hi ! i did not test your script yet ...
anyway, i changed a couple os things to make it instalable anywhere :
add :
Quote:import os
on a new line where you can see other import

add :
Quote: self.home=os.getcwd()[:-1]+'\\'
on a new line just after def in the overlay class

replace the line (a couple of lines after) :
Quote: self.addcontrol(xbmcgui.controlimage(158,25,520,500, 'q:\\scripts\\lyricspanel.png'))
with :
Quote: self.addcontrol(xbmcgui.controlimage(158,25,520,500, self.home+'lyricspanel.png'))

____
as for the autosize to fit any screen, it is easy to do, but a bit longer... i will do it if none of you made it before.
find
EnderW Offline
Skilled Python Coder
Posts: 249
Joined: Feb 2005
Reputation: 0
Post: #7
(tomkun @ feb. 26 2005,03:11 Wrote:2) it doesn't size correctly for my ntsc tv.  i guess it was sized for pal?  is there a way to make it automatically resize?

3) if the song lyrics don't exist on the website, it will display the lyrics of a different song by the same artist.  i checked the website and it does it too.  i don't know if you could fix that in the script somehow?

other that that, this seems to be a great script!  well done!
:thumbsup:
2.

i am not too sure on how i would implement that. i could put in an "if" check on the resolution, but that's perhaps not the best implementation (by far the easiest though, so i might go with that).

3.

this isn't really something i can do anything about. i might expand the script to work with different sites later, but as it is now it pretty much works just like lyrc.com.ar. if that site gives a wrong, so does the script. lyrc.com.ar has a pretty bad search engine, so it gives wrong quite often if it can't find the actual song.

i will update the script soon (a day or two) with the location fix (thanks solexalex) and probably a size fix.

xbmcscripts.com administrator
find
solexalex Offline
Skilled Python Coder
Posts: 706
Joined: Jul 2004
Reputation: 6
Post: #8
to make your script fit any screen size, try this tricks :
1- get the screensize :
w=xbmc.getwidth()
h=xbmc.getheight()
2- you know that you made the skin in your own format (i guess it is pal format so 720x540 ; ntsc is 720x480). so the sizes you gave in your script are for pal screen.
just calculate a 'ratio' between your screen size and any other size : (your size is the reference)
xratio=float(w/720.0)
yratio=float(h/640.0)
3- now you'll have to tell all objects, taht x;y positions and w/h size have to be modified with the ratio. don't forget to say the result should be integer
examples :
self.addcontrol(xbmcgui.controlimage(int(xratio*158),int(yratio*25),int(xratio*5​20),int(yr
atio*500), self.home+'lyricspanel.png'))
self.fadelabel = xbmcgui.controlfadelabel(int(xratio*270),int(yratio*95),int(xratio*255),int(yrat​io*25), 'font14','0xffffffff')
...
notice that xratio apply to x position and width
yratio apply to y positions and height

maybe sometimes, you'll prefer to make a position 'fixed' so play a bit wether you should use ratio for a value or not !

i hope this can be understandable...(i.e can you understand what i'm trying to explain Smile )
find
luciverse Offline
Junior Member
Posts: 16
Joined: Mar 2004
Reputation: 0
Post: #9
link has expired. Sad
find
erpi99 Offline
Senior Member
Posts: 137
Joined: Dec 2003
Reputation: 0
Post: #10
can it be added to the scriptrunner?
find
solexalex Offline
Skilled Python Coder
Posts: 706
Joined: Jul 2004
Reputation: 6
Post: #11
erpi99
if you want scripts added inside scriptrunner, you have to request the creator of this script : threezee
find
EnderW Offline
Skilled Python Coder
Posts: 249
Joined: Feb 2005
Reputation: 0
Post: #12
did a little work on the script today, trying to add support for auto-update of lyrics. however, it seems that xbmc crashes when you call getmusicinfotag() more than once. the weirdest part is that sometimes you can exit the script, and it won't crash until you start a new song. i could be doing something wrong, but i'd have no idea why. anyone else experienced problems using this?

the other things mentioned in this thread will come shortly..

xbmcscripts.com administrator
find
Tomkun Online
Fan
Posts: 558
Joined: Jul 2004
Reputation: 4
Location: Japan
Post: #13
i've used this script a lot and i have never had it crash yet. even if i play two or more songs in a row and look up the lyrics for all of them. i have to say, i am loving this script! i hope you can get everything working that you want.
find
EnderW Offline
Skilled Python Coder
Posts: 249
Joined: Feb 2005
Reputation: 0
Post: #14
well, it could be bad coding on my part. this is the function in a class spawned by threading.thread:

Quote:    def run(self):
       artist_name = ""
       title_name = ""
       tag = self.overlay.get_player().getmusicinfotag()
       while (self.running):
           if tag.gettitle() != title_name:
               artist_name = tag.getartist()
               title_name = tag.gettitle()
               self.overlay.lyrics(artist_name, title_name)
           time.sleep(5)

any suggestions?

self.overlay.get_player() returns xbmc.player() from the other class (overlay).

xbmcscripts.com administrator
find
EnderW Offline
Skilled Python Coder
Posts: 249
Joined: Feb 2005
Reputation: 0
Post: #15
ok, i have added the two things as "promised". i have a feeling that it won't look correct on a ntsc tv though, but as i have got none to test with it's rather hard to adjust. if you find correct values. please report and i'll of course fix it...

i have got a new server, so hopefully no downtimes anymore:

http://enderw.emutalk.net/xbmclyrics.rar

xbmcscripts.com administrator
find
Thread Closed