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 25 26 27 28 29 30 31 32 33 34 35


- 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


- smuto - 2007-02-19 22:23

but in this moment most importent is wiki

i can only repeat
- scraper returns utf8 formatted strings, but script display it in 8-Bit

part of lyrics
Code:
Pamiętać, zapomnieć - śmiać się czy grać
and this i see in xbmc
Code:
Pamiętać, zapomnieć - śmiać się czy grać



- Nuka1195 - 2007-02-19 22:26

First it's your script Smile

Well then all I can say is add all your characters like you posted, then add it to the parser of your choice and name the folder lyricwiki_polish. Then I can add that to svn and you'll just use that for SCRAPER=lyricwiki_polish.

Will that work for you?

Edit: Or you tell me how you want it returned (what encoding) and I'll add the encode() to the return value?


- spiff - 2007-02-19 22:48

the script should be working in utf-8. leave it up to the scrapers to convert to utf-8. any general conversion's gonna be awkward


- Nuka1195 - 2007-02-19 23:48

Ok smuto with cptspiff's help, i think i understand and am working on it.

Edit: Smuto does the other parser work for you? Did it before any of my changes?
Is it the lyrics that are bad or the list of choices?

Edit2: With cptspiff or spiff's help we got it. I'm trying to fix something else then I'll commit.


- Nuka1195 - 2007-02-20 01:52

Ok Smuto I committed.

Let me know if it works it should.