Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
  • 1
  • 4
  • 5
  • 6(current)
  • 7
  • 8
  • 26
[RELEASE] CU Lyrics (Script) Addon
#76
PS: Is there a way for me to manually correct the title on screen, rather than editing the MP3?

Rob
#77
dny238 Wrote:I found a setting to auto scroll, assuming that would cause the lyrics to roll during the duration of the song. But picking it doesn't have any apparent effect that I can see.

Also, having the capitalization problem I guess.
Another One Bites the Dust doesn't work, but Another One Bites The Dust does.
http://lyrics.wikia.com/index.php?title=...ction=edit

seems like a few keywords like 'a', 'the', 'of' could be CAPPED and tried a 2nd time to increase the success rate, or you could try CAPPING the entire title if the normal version fails to find lyrics. Have these approaches been discussed/tried already?

I will try and spend some time on this over the weekend, I will post a "beta" version here once its done and whoever is comfortable using it can try. if and when new features are polished and fixed I will add it to SVN repo installer

dny238 Wrote:Is there a way to paypal a contribution for all your hardwork?
Rob

If you wish, you can donate to XBMC

Cheers
Zeljko
#78
Are the 'beta' releases available publicly?
Can you point me to the correct URL?
Thanks in advance,
Rob
#79
dny238 Wrote:Are the 'beta' releases available publicly?
Can you point me to the correct URL?
Thanks in advance,
Rob

there is no beta releases. ronie and I test them. when its ready it will be posted here.
#80
Amet Wrote:there is no beta releases. ronie and I test them. when its ready it will be posted here.

Ok. 2 questions

1) The current version will occasionally show me the previous lyric file on the current song. Hitting next and prev will usually fix it, but that shouldn't be necessary. Is this a known issue?

2) The SVN version isn't automatically scrolling for me. Is that a known issue, or am I doing something wrong. I checked an option called smooth scroll in the prefs.

Thx
#81
Hey, Python is fun! Tongue

I was trying to track down a problem (displays incorrect lyrics once in a while) but I ended up not finding that bug, but I changed other little things in the process.
  1. Strip whitespace from beginning and end of the lyrics. The newline at the beginning of most lyrics bugged me. Smile
  2. Fixed Instrumental detection
  3. Fixed problem that made it so "No lyrics have been found for..." would never be displayed (text wasn't being added to control 110)
  4. Changed the "no lyrics found" bit to display whatever lyrics it "didn't find", because I don't trust it. Smile
  5. Removed a reference to an old XBMC Lyrics string
  6. Added a "xbmcgui.unlock()" to a finally block so XBMC doesn't appear to hang when I screw things up.

It's all in this function from gui.py, if you want it:
Code:
def show_lyrics( self, rawLyrics, save=False ):
        try:
            xbmcgui.lock()
            lyrics = self.unescape(rawLyrics).strip()
            
            if (lyrics == "{{Instrumental}}"):
                lyrics = "Instrumental"
            elif (len(lyrics) < 100 and (lyrics.find("{{Instrumental}}") < 0)):
                lyrics = "No lyrics have been found for ' %s '\n%s" % (self.song, lyrics)
                save = False

            self.getControl( 100 ).setText( lyrics )
            splitLyrics = lyrics.splitlines()
            for x in splitLyrics:
                self.getControl( 110 ).addItem( x )
            
            self.getControl( 110 ).selectItem( 0 )
            
            if ( __settings__.getSetting( "save_lyrics" ) == "true" and save ):
                self.save_lyrics_to_file( lyrics )
            
            self.show_control( 100 + ( int(__settings__.getSetting( "smooth_scrolling" ) == "true") * 10 ) )
    
            next_artist = xbmc.getInfoLabel( "MusicPlayer.offset(1).Artist" )
            next_song = xbmc.getInfoLabel( "MusicPlayer.offset(1).Title" )
            print xbmc.getInfoLabel( "MusicPlayer.offset(1)" )
            print "Next Artist: " + next_artist
            print "Next Song: " + next_song
            if ( next_song and  next_artist ):
                self.get_lyrics( next_artist, next_song, False )
            else:
                print "Missing Artist or Song name in ID3 tag for next track"    
        finally:
            xbmcgui.unlock()

Standard disclaimers apply (I've spent maybe 4 hours in Python total, so it's likely that I don't know what I'm doing)
#82
Hey All.
I got tired of 25% of my lyric lookups failing because of capitalization problems, so I put together this crappy hack to try to fix it. It seems to work a bit better.
Thanks,
Rob

PHP Code:
def get_lyrics(selfartist1song1show):
        if 
show:
                
self.reset_controls()
                
self.getControl100 ).setText"" )
                
self.getControl200 ).setLabel"" )

        
self.menu_items = []
        
self.allow_exception False
        artist2 
unicode(artist1'utf-8')                             # de-accent Search String
        
artist unicodedata.normalize('NFKD'unicode(artist2)).encode('ascii','ignore')
        
song2 unicode(song1'utf-8')                         # de-accent Search String
        
song unicodedata.normalize('NFKD'unicode(song2)).encode('ascii','ignore')
        
lyrics ""
        
current_song self.song
        lyrics
kind self.get_lyrics_from_fileartistsongshow )
        if (
artist.find"\'" )) or (song.find"\'", )):
                
quote False
        
else:
                
quote True
        
if show :
                if ( 
lyrics != "" ):
                    if ( 
current_song == self.song ):
                        
self.show_lyricslyrics )
                        
self.getControl200 ).setEnabledFalse )
                        
self.getControl200 ).setLabel"File" )
                else:
                    
self.getControl200 ).setEnabledTrue )
                    
self.getControl200 ).setLabel"LyricWiki API" )

                    
lyrics self.LyricsScraper.get_lyrics_threadartistsongquote )
                    if ( 
len(lyrics) < 100):
                        
song song.capitalize()
                        print 
"Search failed for show: Capitalizing"
                        
lyrics self.LyricsScraper.get_lyrics_threadartistsongquote )
                    if ( 
current_song == self.song ):
                        
self.show_lyricslyricsTrue )
        else:
            if ( 
len(lyrics) > 100):
                print 
"Next Lyrics Already Exist"
            
else:
                
lyrics self.LyricsScraper.get_lyrics_threadartistsongquote )
                if ( 
len(lyrics) < 100):
                        print 
"Search failed: Capitalizing the title"
                        
song song.capitalize()
                        
lyrics self.LyricsScraper.get_lyrics_threadartistsongquote 
                if ( 
len(lyrics) > 100):
                        
success self.save_lyrics_to_filelyrics )
                        print 
"Next Lyrics Saved" 
#83
I'm using the new confluence skin and have a few issues

1) I can't get CU Lyrics to scroll lyrics automatically. Is there something more to it? I can scroll manually, but I'd prefer it just roll by itself.

2) Long lines aren't wrapping properly in the popout window CU Lyrics provides on the right side for the lyrics display.

Rob
#84
dny238 Wrote:I'm using the new confluence skin and have a few issues

1) I can't get CU Lyrics to scroll lyrics automatically. Is there something more to it? I can scroll manually, but I'd prefer it just roll by itself.

It doesnt scroll automatically, you can set it to "smooth scroll" under script settings. that will scroll line by line

dny238 Wrote:2) Long lines aren't wrapping properly in the popout window CU Lyrics provides on the right side for the lyrics display.

Rob

Try with smooth scrolling, i think it might wrap there.

Zeljko
#85
Amet Wrote:It doesnt scroll automatically, you can set it to "smooth scroll" under script settings. that will scroll line by line

Zeljko

Got it. I was overthinking it.

Can you add a autoscroll option to the script? I imagined it working like this. (Numbers are fake to illustrate the math)
1) Song is 3 minutes long
2) View is 90 lines high starting with 30 lines visible. - 60 lines left to see.
3) 180 seconds / 60 lines = 3 seconds per line.
4) Every 3 seconds automatically scroll down one line.

It won't be perfect, but I'd bet it'd work more often than not.
Rob
#86
dny238 Wrote:Got it. I was overthinking it.

Can you add a autoscroll option to the script? I imagined it working like this. (Numbers are fake to illustrate the math)
1) Song is 3 minutes long
2) View is 90 lines high starting with 30 lines visible. - 60 lines left to see.
3) 180 seconds / 60 lines = 3 seconds per line.
4) Every 3 seconds automatically scroll down one line.

It won't be perfect, but I'd bet it'd work more often than not.
Rob

sure, unless you like pink floyd Smile

I have done something similar, having some issues with it so it was never released. I might revisit the problem when I have some time. In a week or two.

Zeljko
#87
Amet Wrote:sure, unless you like pink floyd Smile

I have done something similar, having some issues with it so it was never released. I might revisit the problem when I have some time. In a week or two.

Zeljko

Thanks! Sounds good. I have some time to bang away on some sample code, if you want help. Many hands make light work.
Rob
#88
I fixed the bug where it'd display lyrics for the wrong song in certain cases. But, that snowballed into a lot of refactoring. Nothing major, just stuff like making the "show_lyrics" method show lyrics, and that's it. The biggest change is that I created classes for song and lyrics information, which helped fix the bug I mentioned. Still not sure I'm 100% happy with it, but its a lot easier for me to follow now. I zipped up everything and put the source online. Do with it what you will.

My next project is to help the scraper a little. I want to parse the lyrics better (to pick up italics/bold formatting), and I have some ideas to get lyrics more reliably and quicker.
#89
ZorMonkey Wrote:I fixed the bug where it'd display lyrics for the wrong song in certain cases. But, that snowballed into a lot of refactoring. Nothing major, just stuff like making the "show_lyrics" method show lyrics, and that's it. The biggest change is that I created classes for song and lyrics information, which helped fix the bug I mentioned. Still not sure I'm 100% happy with it, but its a lot easier for me to follow now. I zipped up everything and put the source online. Do with it what you will.

My next project is to help the scraper a little. I want to parse the lyrics better (to pick up italics/bold formatting), and I have some ideas to get lyrics more reliably and quicker.


Well, these changes work like crap on an Xbox. The UI and everything freezes up for a few seconds when switching songs. It seemed okay on Windows. BOOOO. I'll have to see about that
#90
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?s...r+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>
  • 1
  • 4
  • 5
  • 6(current)
  • 7
  • 8
  • 26

Logout Mark Read Team Forum Stats Members Help
[RELEASE] CU Lyrics (Script) Addon1