Kodi Community Forum
[RELEASE] CU Lyrics (Script) Addon - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Lyrics Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=146)
+---- Thread: [RELEASE] CU Lyrics (Script) Addon (/showthread.php?tid=62853)

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 25 26


- dny238 - 2010-01-25

If you want some improvements to the capitalization script hack I did a few days ago here they are.

PHP Code:
if ( len(lyrics) < 100):
                        
song song.title()
                        
artist artist.title() 

replace .capitalize with .title
also, upcase the artist as well as the song. I've had both fail.
Rob


- dny238 - 2010-01-25

xbmcmomomo Wrote:I have some tracks that dont have mp3 id tags.

(the same as when artist tag is missing).

Is it possible to just search on the filename

eg: Life_on_your_own.mp3

to do a search on :

http://lyrics.wikia.com/Special:Search?search=life+on+your+own&go=1

then just scrape the first result (it is most likely to be the correct one!!).

<ul class='mw-search-results'>
<li><a href="http://lyrics.wikia.com/wiki/The%20Human%20League%3ALife%20On%20Your%20Own"
</li>

I haven't searched the code extensively, but from what I can tell at first glance, the script doesn't 'search' for subtitles.
It presumes it can find them by opening the following URL and scraping out the lyrics.
http://lyricwiki.org/index.php?title=<artist>%3A<title>&action=edit

There is an 'if' block that prints a warning when there aren't any MP3Tags to be found. You could try to put some code there.

However, I'd argue that you should just run your MP3's though a tagger. There are a number of benefits of cleaning up your library IMHO. Check out Music Brainz if you want a super powerful one.

My2C,
Rob


- amet - 2010-01-25

dny238 Wrote:If you want some improvements to the capitalization script hack I did a few days ago here they are.

PHP Code:
if ( len(lyrics) < 100):
                        
song song.title()
                        
artist artist.title() 

replace .capitalize with .title
also, upcase the artist as well as the song. I've had both fail.
Rob

how is that different than the code thats already in lyricsScraper.py?

Code:
def lyricwiki_format(self, text):
        return urllib.quote(str(unicode(text).title()))



- dny238 - 2010-01-25

Amet Wrote:how is that different than the code thats already in lyricsScraper.py?

Code:
def lyricwiki_format(self, text):
        return urllib.quote(str(unicode(text).title()))

That's a great question. if there is already something there attempting to upper case the song title before it searchs the wiki, I wonder why it's not working.

I haven't looked up this line in the code yet, are you calling it on the URL?
Code:
//Your original output....
13:04:34 T:2868177808 M:609550336  NOTICE: Title:[Deniece Williams:Let's Hear It for the Boy]
13:04:42 T:2868177808 M:609558528  NOTICE: http://lyricwiki.org/index.php?title=Deniece%20Williams%3ALet%27s%20Hear%20It%20for%20the%20Boy&action=edit
//when the lookup fails, my additional code outputs this.
13:04:42 T:2868177808 M:609558528  NOTICE: Search failed for show: Capitalizing Let's Hear It For The Boy Deniece William
s
13:04:46 T:2868177808 M:609566720  NOTICE: Title:[Deniece Williams:Let's Hear It For The Boy]
13:04:53 T:2868177808 M:609583104  NOTICE: http://lyricwiki.org/index.php?title=Deniece%20Williams%3ALet%27s%20Hear%20It%
20For%20The%20Boy&action=edit

I'll look that function over the next time I get a chance, much rather use something built in.
Rob


- amet - 2010-01-25

dny238 Wrote:That's a great question. if there is already something there attempting to upper case the song title before it searchs the wiki, I wonder why it's not working.

I haven't looked up this line in the code yet, are you calling it on the URL?
Code:
//Your original output....
13:04:34 T:2868177808 M:609550336  NOTICE: Title:[Deniece Williams:Let's Hear It for the Boy]
13:04:42 T:2868177808 M:609558528  NOTICE: http://lyricwiki.org/index.php?title=Deniece%20Williams%3ALet%27s%20Hear%20It%20for%20the%20Boy&action=edit
//when the lookup fails, my additional code outputs this.
13:04:42 T:2868177808 M:609558528  NOTICE: Search failed for show: Capitalizing Let's Hear It For The Boy Deniece William
s
13:04:46 T:2868177808 M:609566720  NOTICE: Title:[Deniece Williams:Let's Hear It For The Boy]
13:04:53 T:2868177808 M:609583104  NOTICE: http://lyricwiki.org/index.php?title=Deniece%20Williams%3ALet%27s%20Hear%20It%
20For%20The%20Boy&action=edit

I'll look that function over the next time I get a chance, much rather use something built in.
Rob

no, it gets called for song name and artist, the problem comes in when we try to do it on "let's hear it for the boy" it becomes "Let'S Hear It For The Boy".

Zeljko


- dny238 - 2010-01-25

Amet Wrote:no, it gets called for song name and artist, the problem comes in when we try to do it on "let's hear it for the boy" it becomes "Let'S Hear It For The Boy".

Zeljko

That's true.
Here's where I got after goofing around with all the mistakes it was making today.

Code:
if ( len(lyrics) < 100):
                        song = song.title()
                        artist = artist.title()
                        song = song.replace("'S ","'s ")
                        artist = artist.replace(" And "," & ")
                        print "Search failed for show: Capitalizing " + song + " " + artist
                        lyrics = self.LyricsScraper.get_lyrics_thread( artist, song, quote )

After that it was perfect. When it failed to lookup and i'd check It was always a problem with my MP3 Tagging.

Rob


- ZorMonkey - 2010-01-26

Amet Wrote:no, it gets called for song name and artist, the problem comes in when we try to do it on "let's hear it for the boy" it becomes "Let'S Hear It For The Boy".

Zeljko

That's what my old change was supposed to address:

Code:
def lyricwiki_format(self, text):
        titleCase =lambda value: re.sub("([a-zA-Z])'([A-Z])", lambda m: m.group(0).lower(), value.title())
        return urllib.quote(str(unicode(titleCase(text))))

The old regex was "([a-z])'([A-Z])" until I came across an "I've" that was being changed to "I'Ve"


- dny238 - 2010-01-26

ZorMonkey Wrote:That's what my old change was supposed to address:

Code:
def lyricwiki_format(self, text):
        titleCase =lambda value: re.sub("([a-zA-Z])'([A-Z])", lambda m: m.group(0).lower(), value.title())
        return urllib.quote(str(unicode(titleCase(text))))

The old regex was "([a-z])'([A-Z])" until I came across an "I've" that was being changed to "I'Ve"

Are you guys always upper casing stuff? I figured we'd try the default title and 'try again' with capitalization if there was a lookup issue. Maybe that's unnecessarily complex.

ZorMonkey, i'm giving your latest Zip a try. So far I like a number of things about it. It's faster, it doesn't leave the old lyrics on the screen while it plays the new song, and it's not giving me issues with Caps.
Quick question, what are you doing with songs with Featuring Jay-Z in them? Is there a standard approach to that type of thing on LyricsWiki?
2nd question, whose issue is it that i'm seeing HTML encoding on tracks like http://lyrics.wikia.com/index.php?title=Carrie%20Underwood:Before%20He%20Cheats&action=edit? &quot; is visible and there are double quotes sometimes.

Is there a way to sync these changes into the SVN easier? Since the XBMC Lyrics guy pulled his version, this seems to be the best place to pool resources?
Rob


- dny238 - 2010-01-26

Do you consider this a MP3 Tagging Issue?
Addicted [Explicit] fails.
http://lyricwiki.org/index.php?title=Saving%20Abel:Addicted%20%5BExplicit%5D&fmt=js


- dny238 - 2010-01-26

ZorMonkey,
I've been playing with your ZIP version of the script today and it works really well. Kudos. Bummer it doesn't work well on Xbox, but I got rid of mine for this Acer so i'm not looking back yet.

Question for you about scripts. It seems like there could be a threading issue somewhere. Let me setup the scene.
1) I have a directory of songs I've never played before
2) I play the first song, and the system gets its lyrics and starts to get the next one.
3) Before the results are back I hit next 2x, skipping over the song which is currently being loaded.
4) I want to immediately see a "Fetching lyrics..." message, but I don't.
5) On my system it takes about 9 seconds. So for 9 seconds I'm stuck looking at the lyrics from the song 2 clicks ago.

here is the log
Code:
14:06:41 T:3042715536 M:573001728   DEBUG: LIRC: Update - NEW at 67720755:000000037ff07be5 00 Skip mceusb (Skip)
14:06:41 T:3042715536 M:573001728   DEBUG: OnKey: 223 pressed, action is 14
14:06:41 T:3042715536 M:573001728   DEBUG: new file set audiostream:0
14:06:41 T:3042715536 M:573001728   DEBUG: CPlayerCoreFactory::GetPlayers(smb://192.168.254.6/data/Music/Rock Collection/vol1/Puddle of Mudd - She Hates Me.mp3)
<snipped out boring stuff>
14:06:41 T:3042715536 M:573526016   DEBUG: SaveFileState - Saving file state for audio item smb://192.168.254.6/data/Music/Rock Collection/vol5/Foo Fighters - The Pretender.mp3
14:06:41 T:2730113936 M:573460480    INFO: CFileCache::Process - Hit eof.

<time gap>

14:06:43 T:2805619600 M:574029824  NOTICE: Puddle Of Mudd:She Hates Me Lyrics - LyricWiki - Music lyrics from songs and albums
14:06:43 T:2805619600 M:574029824  NOTICE: Title:[Puddle Of Mudd:She Hates Me]
14:06:48 T:2805619600 M:574038016  NOTICE: http://lyricwiki.org/index.php?title=Puddle%20Of%20Mudd%3AShe%20Hates%20Me&action=edit
14:06:48 T:2805619600 M:574038016  NOTICE: After get_lyrics_thread
14:06:48 T:2805619600 M:574038016  NOTICE: GUI-DEBUG: myPlayerChanged event:2, force_update:False
14:06:48 T:2805619600 M:574038016  NOTICE: GUI-DEBUG: show_prefetch_message

Translation...
14:06:41 - I hit next here.
14:06:48 - The script finally gets the message the the player's changed so it can update the screen, 9 seconds later.
It seems to be busy looking up the lyrics the song I skipped over?
Is this a threading issue?
Rob

PS. Found one bug, for some reason the I've became i've.
SCRAPER-DEBUG: LyricsFetcher.get_lyrics_thread Artist: Linkin Park, Title: What I've Done
14:59:55 T:2805619600 M:513093632 NOTICE: http://lyricwiki.org/index.php?title=Linkin%20Park:What%20i%27ve%20Done&fmt=js


- ZorMonkey - 2010-01-26

dny238 Wrote:Are you guys always upper casing stuff? I figured we'd try the default title and 'try again' with capitalization if there was a lookup issue. Maybe that's unnecessarily complex.

The way we're looking for lyrics needs the first letter of every word capitalized. But there are other options. For example, we could leverage what is left of their API. Here's an example of a query for a song with messed up capitalization, which returns good results: http://lyrics.wikia.com/api.php?func=getSong&artist=breaking%20benjamin&song=until%20The%20EnD&fmt=xml


Quote:Quick question, what are you doing with songs with Featuring Jay-Z in them? Is there a standard approach to that type of thing on LyricsWiki?

I'm not doing anything special. My hunch is that LyricsWiki is happy with that coming through as "Jay-Z"

Quote:2nd question, whose issue is it that i'm seeing HTML encoding on tracks like http://lyrics.wikia.com/index.php?title=Carrie%20Underwood:Before%20He%20Cheats&action=edit? &quot; is visible and there are double quotes sometimes.

I can't easily check right now, but I'm willing to bet that's because the lyrics have been formatted to have bold and/or italics in them. That's one of the next things on my list.


- ZorMonkey - 2010-01-26

dny238 Wrote:ZorMonkey,
Question for you about scripts. It seems like there could be a threading issue somewhere. Let me setup the scene.
1) I have a directory of songs I've never played before
2) I play the first song, and the system gets its lyrics and starts to get the next one.
3) Before the results are back I hit next 2x, skipping over the song which is currently being loaded.
4) I want to immediately see a "Fetching lyrics..." message, but I don't.
5) On my system it takes about 9 seconds. So for 9 seconds I'm stuck looking at the lyrics from the song 2 clicks ago.

Yeah, I hate that too. Smile There are a few problem in there, which could possibly be solved with more threading, but I'm not sure yet. One big thing is that we have to do some weird stuff to get the artist and title for the currently playing song. After XBMC tells us that the song has changed it can take a while for it to tell us what that song is. Don't know why, but I want to blame XBMC for that. The skin knows what the song is immediately, so why wont XBMC tell us what the song is immediately? I dunno.

Quote:PS. Found one bug, for some reason the I've became i've.
SCRAPER-DEBUG: LyricsFetcher.get_lyrics_thread Artist: Linkin Park, Title: What I've Done
14:59:55 T:2805619600 M:513093632 NOTICE: http://lyricwiki.org/index.php?title=Linkin%20Park:What%20i%27ve%20Done&fmt=js

Huh, I'll check it out later


- dny238 - 2010-01-27

ZorMonkey Wrote:Yeah, I hate that too. Smile There are a few problem in there, which could possibly be solved with more threading, but I'm not sure yet. One big thing is that we have to do some weird stuff to get the artist and title for the currently playing song. After XBMC tells us that the song has changed it can take a while for it to tell us what that song is. Don't know why, but I want to blame XBMC for that. The skin knows what the song is immediately, so why wont XBMC tell us what the song is immediately? I dunno.

All I want is to put up "Fetching Lyrics..." as soon as we possibly can. It doesn't bother me that it takes 10 seconds to respond. I'd be nice if it didn't... but i'm not greedy. Mostly I just want to take the wrong lyrics off the screen.

Rob


- ZorMonkey - 2010-01-27

dny238 Wrote:All I want is to put up "Fetching Lyrics..." as soon as we possibly can. It doesn't bother me that it takes 10 seconds to respond. I'd be nice if it didn't... but i'm not greedy. Mostly I just want to take the wrong lyrics off the screen.

Rob

Yeah, I'll see what I can figure out. The reason I don't automatically clear the lyrics and display "Fetching Lyrics..." is because in certain cases it may already be displaying the lyrics you want. I don't remember the exact scenario - I'll have to verify. Although, I suppose whatever that scenario is should be fairly uncommon, so maybe it's overkill to even worry about it. I also noticed that I have it sleeping for way too long - that can't help.

BTW - your problem with "I've" that I thought I fixed is fixed for real with this, I hope. Smile

Code:
def lyricwiki_format(self, text):
        titleCase =lambda value: re.sub("([a-zA-Z]')([A-Z])", lambda m: m.group(0) + m.group(1).lower(), value.title())
        return urllib.quote(str(unicode(titleCase(text))))



- lonchaney - 2010-02-02

sorry if this is wrong place to post this

i was wondering if anyone knows a way i can press a button on my remote and have the script come up and show me the lyrics of the song i'm playing? i'm running aeon65 and when i play music i just go back to the home screen (no visualization or anything). i wanna be able to just hit a button on my remote and have the lyrics pop up...is this possible?

thanks.