Kodi Community Forum
[RELEASE] xbmclyrics script - automatically grabs lyrics online - Printable Version

+- Kodi Community Forum (http://forum.kodi.tv)
+-- Forum: Help and Support (/forumdisplay.php?fid=33)
+--- Forum: Add-ons Help and Support (/forumdisplay.php?fid=27)
+---- Forum: Lyrics Add-ons (/forumdisplay.php?fid=146)
+---- Thread: [RELEASE] xbmclyrics script - automatically grabs lyrics online (/showthread.php?tid=10187)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24


[RELEASE] xbmclyrics script - automatically grabs lyrics online - EnderW - 2005-02-25 03:34

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


- Tomkun - 2005-02-26 05:11

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:


- Tomkun - 2005-02-26 05:19

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?


- Tomkun - 2005-02-26 06:00

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


- pop - 2005-02-26 12:06

this is mint well done :bowdown:


- solexalex - 2005-02-26 14:41

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.


- EnderW - 2005-02-27 22:08

(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.


- solexalex - 2005-02-28 02:21

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 )


- luciverse - 2005-03-01 11:13

link has expired. Sad


- erpi99 - 2005-03-01 20:03

can it be added to the scriptrunner?


- solexalex - 2005-03-01 20:09

erpi99
if you want scripts added inside scriptrunner, you have to request the creator of this script : threezee


- EnderW - 2005-03-02 00:03

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..


- Tomkun - 2005-03-02 09:16

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.


- EnderW - 2005-03-02 15:48

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).


- EnderW - 2005-03-02 16:31

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