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

+- XBMC Community Forum (http://forum.xbmc.org)
+-- 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


- smuto - 2006-12-05 16:32

but i have one more problem, mayby sameone from coders can help

script reads lyrics from text file which are stored on HDD

e.g.
Artist Tag - U2
Song Tag - One

LyricsPath
Q:\UserData\lyrics\U2\One.txt'

problem
non latin characters in info tags

e.g. ( for polish one)
Artist Tag - ĄĘść
Song Tag - żńąć

i need part of code which convert characters from tags to set proper path
Q:\UserData\lyrics\AEsc\znac.txt'

kind regards smuto


- smuto - 2006-12-11 20:23

Dead certainty i'm not a python coderNo
i try to follow thor918's tips, but with no luck
thor918 Wrote:hi there. if there is someone that is developing on this script still, please consider to redo the code that detects media change. last time i checked the code. it had a codeloop that where sleeping and checking. there is a much more efficient way to do this.

http://forum.xbmc.org/showthread.php?tid=5978
or
http://forum.xbmc.org/showthread.php?tid=19493

please XBMCLyrics needs the real improved version

smuto


- luna - 2006-12-11 23:20

I have an issue with recent XBMC builds (e.g. 2006-12-08) an this script: it displays lyrics fine, until i skip to a song that has multiple options. Instead of showing the list of options to make a manual choice the script hangs te box requiring a power cycle to recover.
When I use the script on older xbox versions it runs fine.

Any clues?

Cheers,
Luna


- SleepyP - 2006-12-13 02:52

not only that, if you accidentally run the script with no media playing, it hangs the system as well Sad


- smuto - 2006-12-29 00:41

XBMCLyrics with GuiBuilder - fastMethod

Blackbolt Classic skin - that all, what i add
Build SVN 27.12.2006 - script working with no problem

still looking for aktive python dev with free time - XBMCLyrics needs improved updade class

smuto


- Nuka1195 - 2007-02-15 20:26

Smuto this snuck past me, I didn't know you added a BBC skin, now known as Xbox-Classic.

If you don't mind. I'll add this to the scripting SVN, I'll update it to the 2.1 skinning too.

I wait for your reply.


- smuto - 2007-02-15 21:53

sure, but only if u improve more stafBig Grin

this script need better
- update class
- language support
- hdd read
- fatX compatibility

i wrote some temporary part of code, just for myself, that all what i can do with my basic python knowledge

smuto


- Nuka1195 - 2007-02-15 22:35

update class - done Smile
language support - if you mean for the lyrics, then maybe different lyrics search sites
hdd -read and fatx ok, i'll look into it when i get a chance.

You've done a very good job with this. I updated the skins to 2.1. The BBC skin now Xbox-Classic skin is great. Why hide the cover art?


- Nuka1195 - 2007-02-16 02:03

XBMC Lyrics originally by SveinT and updated by Smuto is now in SVN.

Key features:
- Update lyrics now uses the Player on* events.
- Skinnable - You have two options a 4x3 (skin.xml) and 16x9 (skin_16x9.xml). special gfx go in there /gfx/ folder
- Saves lyrics in q:\userdata\lyrics\artistname\song.txt. If you don't want this edit the top of the script and set SAVE_LYRICS = False

http://xbmc-scripting.googlecode.com/svn/trunk/XBMC%20Lyrics


Thanks to Smuto and SveinT


- Nuka1195 - 2007-02-17 08:24

changed: [XBMC Lyrics] Separated parsers into there own .py file. (So someone could create a parser to parser lyrics from mp3's)
added: [XBMC Lyrics] http://www.lyricwiki.org/ (Default, change it at the top of the script uncomment the other parser and comment this one out "#PARSER = 'lyrc.com.ar'")
added: [XBMC Lyrics] Warning message if no music is playing.
changed: [XBMC Lyrics] Language routine
added: [XBMC Lyrics] English language strings (10-11)

If someone wants to create a new parser:
- Name it "lyrics_parser" and put it in it's own folder under /parsers/
- The Main class needs to be named "Lyrics_Fetcher"
- Two defs are required:
- def get_lyrics( self, artist, song ): <- This returns either the lyrics or a list of tuple selections, with [ 0 ] being added to the ControlList.
- def get_lyrics_from_list( self, item ): <- This returns the lyrics after the user as selected an item from the list. item is the selected tuple from above.

The options at the top of the script you change to suit:
SAVE_LYRICS = False
LYRICS_PATH = 'Q:\\UserData\\lyrics\\'
PARSER = 'lyricwiki'
#PARSER = 'lyrc.com.ar'

I need to know if you have SAVE_LYRICS = False. If a list is returned to you want to save that file anyway to avoid the list next time?


- smuto - 2007-02-18 18:28

just love uSmile - wiki is much better than - hdd read support


- Nuka1195 - 2007-02-19 01:36

Big Grin you have both, just the file writing is disabled by default.


- smuto - 2007-02-19 19:21

yes, i know

now my problems
e.g.
artist - Dżem
song - A jednak czegoś żal

for hdd support i need to replace polish chars
UserData\lyrics\Dzem\A jednak czegos zal.txt
(xbmc convert all chars to utf-8)

Code:
#Polish non fatx_compatible chars :
        name = name.replace( 'Ä„', 'A' ).replace( 'Ę', 'E' ).replace( 'Ć', 'C' ).replace( 'Ł', 'L' ).replace( 'Ĺƒ', 'N' )
        name = name.replace( 'Ă“', 'O' ).replace( 'Ĺš', 'S' ).replace( 'Ĺ»', 'Z' ).replace( 'Ĺą', 'Z' )
        name = name.replace( 'Ä…', 'a' ).replace( 'Ä™', 'e' ).replace( 'ć', 'c' ).replace( 'Ĺ‚', 'l' ).replace( 'Ĺ„', 'n' )
        name = name.replace( 'Ăł', 'o' ).replace( 'Ĺ›', 's' ).replace( 'ĹĽ', 'z' ).replace( 'Ĺş', 'z' )
        return name
or take a look to my mod
lyrics.py

for lyricwiki
- scraper returns utf8 formatted strings, but script display it in 8-Bit

smuto


- Nuka1195 - 2007-02-19 21:21

Ah, ok. Try replacing make_fatx_compatible with the following. If it works I'll add it.

Code:
def make_fatx_compatible( self, name, extension ):
        name = name.decode( 'utf-8', 'replace' ).encode( 'ascii', 'replace' )
        if len( name ) > 42:
            if ( extension ): name = '%s_%s' % ( name[ : 37 ], name[ -4 : ], )
            else: name = name[ : 42 ]
        name = name.replace( ',', '_' ).replace( '*', '_' ).replace( '=', '_' ).replace( '\\', '_' ).replace( '|', '_' )
        name = name.replace( '<', '_' ).replace( '>', '_' ).replace( '?', '_' ).replace( ';', '_' ).replace( ':', '_' )
        name = name.replace( '"', '_' ).replace( '+', '_' ).replace( '/', '_' )
        return name



- smuto - 2007-02-19 22:14

it's working, but

try to imagine

my polish song name - "ąężćś"
from your code on hdd i have "_____" , i prefer "aezcs" instead, so this is why i made mod of your script

smuto