The branch, frodo has been updated
       via  a78d7edf210d06ac03a1cd4198724608faa833a2 (commit)
      from  7fee11e071148dd1acec0d21554f9a75e68f6ece (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=a78d7edf210d06ac03a1cd4198724608faa833a2

commit a78d7edf210d06ac03a1cd4198724608faa833a2
Author: taxigps <[email protected]>
Date:   Wed Nov 21 16:07:00 2012 +0800

    [script.lrclyrics] -v1.7.1 for frodo

diff --git a/script.lrclyrics/addon.xml b/script.lrclyrics/addon.xml
index 950f7d2..b33f36d 100644
--- a/script.lrclyrics/addon.xml
+++ b/script.lrclyrics/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="script.lrclyrics"
        name="LRC Lyrics"
-       version="1.4.4"
+       version="1.7.1"
        provider-name="Taxigps">
   <requires>
     <import addon="xbmc.python" version="1.0"/>
diff --git a/script.lrclyrics/changelog.txt b/script.lrclyrics/changelog.txt
index b7677bb..fd08127 100644
--- a/script.lrclyrics/changelog.txt
+++ b/script.lrclyrics/changelog.txt
@@ -1,4 +1,22 @@
-[B]1.4.4 (2012.04.10)[/B]
+[B]1.7.1 (2012.11.21)[/B]
+initialized into frodo
+added: MiniLyrics scraper
+changed: use xbmcvfs to access files to support nas share
+fixed: can't read lrc file under music library mode because 
xbmc.Player().getPlayingFile() return path like 
'musicdb://3/3/4.mp3?albumid=3'. use 
xbmc.getInfoLabel('Player.Filenameandpath') to get real file path.
+
+[B]1.4.7 (2012.11.19)[/B]
+fixed: handle I/O error
+fixed: TXXX(Lyrics) load error
+
+[B]1.4.6 (2012.11.18)[/B]
+fixed: can't change lyrics when skip to next song
+fixed: encoding error and lrc error by additional \n\r with SYLT lyrics
+
+[B]1.4.5 (2012.11.18)[/B]
+added: embed lyrics support for Lyrics3/Lyrics3V2/SYLT/TXXX(Lyrics) 
+added: use chardet to detect lyrics encoding 
+
+[B]1.4.4 (2012.04.10)[/B]
 fixed: encoding error when login as non english user name under windows
 
 [B]1.4.3 (2012.01.25)[/B]
diff --git a/script.lrclyrics/resources/language/Chinese (Simple)/strings.xml 
b/script.lrclyrics/resources/language/Chinese (Simple)/strings.xml
index f3d788d..901bea0 100644
--- a/script.lrclyrics/resources/language/Chinese (Simple)/strings.xml  
+++ b/script.lrclyrics/resources/language/Chinese (Simple)/strings.xml  
@@ -4,6 +4,7 @@
     <string id="0">XBMC歌词</string>
     <string id="30000">文件</string>
     <string id="30001">歌词未找到!</string>
+    <string id="30002">内嵌</string>
 
     <!-- Settings labels -->
     <string id="30100">刮削器</string>
diff --git a/script.lrclyrics/resources/language/English/strings.xml 
b/script.lrclyrics/resources/language/English/strings.xml
index 24e9144..2611fca 100644
--- a/script.lrclyrics/resources/language/English/strings.xml
+++ b/script.lrclyrics/resources/language/English/strings.xml
@@ -4,6 +4,7 @@
     <string id="0">XBMC Lyrics</string>
     <string id="30000">File</string>
     <string id="30001">No lyrics found!</string>
+    <string id="30002">Embed</string>
 
     <!-- Settings labels -->
     <string id="30100">Scraper</string>
diff --git a/script.lrclyrics/resources/lib/gui.py 
b/script.lrclyrics/resources/lib/gui.py
index 12a02dc..5fdeddf 100644
--- a/script.lrclyrics/resources/lib/gui.py
+++ b/script.lrclyrics/resources/lib/gui.py
@@ -2,10 +2,10 @@ import sys
 import os
 import re
 import thread
-import xbmc
-import xbmcgui
+import xbmc, xbmcgui, xbmcvfs
 from threading import Timer
 from utilities import *
+from embedlrc import *
 
 __scriptname__ = sys.modules[ "__main__" ].__scriptname__
 __version__    = sys.modules[ "__main__" ].__version__
@@ -84,64 +84,57 @@ class GUI( xbmcgui.WindowXMLDialog ):
         self.getControl( 200 ).setLabel( "" )
         self.menu_items = []
 
-        lyrics = self.get_lyrics_from_file2()
-        if ( lyrics == "" ):
-            lyrics = self.get_lyrics_from_file( artist, song )
-        if ( lyrics != "" ):
+        xbmc.sleep( 60 )
+        lyrics =  
getEmbedLyrics(xbmc.getInfoLabel('Player.Filenameandpath').decode("utf-8"))
+        if ( lyrics ):
             self.show_lyrics( lyrics )
             self.getControl( 200 ).setEnabled( False )
-            self.getControl( 200 ).setLabel( __language__( 30000 ) )
+            self.getControl( 200 ).setLabel( __language__( 30002 ) )
         else:
-            self.getControl( 200 ).setEnabled( True )
-            self.getControl( 200 ).setLabel( self.scraper_title )
-            lyrics = self.LyricsScraper.get_lyrics( artist, song )
+            lyrics = self.get_lyrics_from_file2()
+            if ( lyrics == "" ):
+                lyrics = self.get_lyrics_from_file( artist, song )
+            if ( lyrics != "" ):
+                self.show_lyrics( lyrics )
+                self.getControl( 200 ).setEnabled( False )
+                self.getControl( 200 ).setLabel( __language__( 30000 ) )
+            else:
+                self.getControl( 200 ).setEnabled( True )
+                self.getControl( 200 ).setLabel( self.scraper_title )
+                lyrics = self.LyricsScraper.get_lyrics( artist, song )
 
-            if ( isinstance( lyrics, basestring ) ):
-                self.show_lyrics( lyrics, True )
-            elif ( isinstance( lyrics, list ) and lyrics ):
-                self.show_choices( lyrics )
+                if ( isinstance( lyrics, basestring ) ):
+                    self.show_lyrics( lyrics, True )
+                elif ( isinstance( lyrics, list ) and lyrics ):
+                    self.show_choices( lyrics )
 
     def get_lyrics_from_list( self, item ):
         lyrics = self.LyricsScraper.get_lyrics_from_list( self.menu_items[ 
item ] )
         self.show_lyrics( lyrics, True )
 
     def get_lyrics_from_file( self, artist, song ):
-        try:
-            xbmc.sleep( 60 )
-            if ( self.settings[ "artist_folder" ] ):
-                self.song_path = unicode( os.path.join( self.settings[ 
"lyrics_path" ], artist.replace( "\\", "_" ).replace( "/", "_" ), song.replace( 
"\\", "_" ).replace( "/", "_" ) + ".lrc" ), "utf-8" )
-            else:
-                self.song_path = unicode( os.path.join( self.settings[ 
"lyrics_path" ], artist.replace( "\\", "_" ).replace( "/", "_" ) + " - " + 
song.replace( "\\", "_" ).replace( "/", "_" ) + ".lrc" ), "utf-8" )
-            lyrics_file = open( self.song_path, "r" )
-            lyrics = lyrics_file.read()
-            lyrics_file.close()
-            return lyrics
-        except IOError:
-            return ""
+        if ( self.settings[ "artist_folder" ] ):
+            self.song_path = unicode( os.path.join( self.settings[ 
"lyrics_path" ], artist.replace( "\\", "_" ).replace( "/", "_" ), song.replace( 
"\\", "_" ).replace( "/", "_" ) + ".lrc" ), "utf-8" )
+        else:
+            self.song_path = unicode( os.path.join( self.settings[ 
"lyrics_path" ], artist.replace( "\\", "_" ).replace( "/", "_" ) + " - " + 
song.replace( "\\", "_" ).replace( "/", "_" ) + ".lrc" ), "utf-8" )
+        return get_textfile( self.song_path )
 
     def get_lyrics_from_file2( self ):
-        try:
-            xbmc.sleep( 60 )
-            path = xbmc.Player().getPlayingFile()
-            dirname = os.path.dirname(path)
-            basename = os.path.basename(path)
-            filename = basename.rsplit( ".", 1 )[ 0 ]
-            if ( self.settings[ "subfolder" ] ):
-                self.song_path = unicode( os.path.join( dirname, 
self.settings[ "subfolder_name" ], filename + ".lrc" ), "utf-8" )
-            else:
-                self.song_path = unicode( os.path.join( dirname, filename + 
".lrc" ), "utf-8" )
-            lyrics_file = open( self.song_path, "r" )
-            lyrics = lyrics_file.read()
-            lyrics_file.close()
-            return lyrics
-        except IOError:
-            return ""
+        path = xbmc.getInfoLabel('Player.Filenameandpath')
+        dirname = os.path.dirname(path)
+        basename = os.path.basename(path)
+        filename = basename.rsplit( ".", 1 )[ 0 ]
+        if ( self.settings[ "subfolder" ] ):
+            self.song_path = unicode( os.path.join( dirname, self.settings[ 
"subfolder_name" ], filename + ".lrc" ), "utf-8" )
+        else:
+            self.song_path = unicode( os.path.join( dirname, filename + ".lrc" 
), "utf-8" )
+        return get_textfile( self.song_path )
 
     def save_lyrics_to_file( self, lyrics ):
         try:
-            if ( not os.path.isdir( os.path.dirname( self.song_path ) ) ):
-                os.makedirs( os.path.dirname( self.song_path ) )
-            lyrics_file = open( self.song_path, "w" )
+            if ( not xbmcvfs.exists( os.path.dirname( self.song_path ) ) ):
+                xbmcvfs.mkdirs( os.path.dirname( self.song_path ) )
+            lyrics_file = xbmcvfs.File( self.song_path, "w" )
             lyrics_file.write( lyrics )
             lyrics_file.close()
             return True
@@ -259,7 +252,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
                     artist = xbmc.Player().getMusicInfoTag().getArtist()
                     print "Song: " + song + " /Artist: " + artist
 
-                    songfile = xbmc.Player().getPlayingFile()
+                    songfile = xbmc.getInfoLabel('Player.Filenameandpath')
                 except:
                     pass
                 if ( song and ( not artist or self.settings[ "use_filename" ] 
) ):
diff --git a/script.lrclyrics/resources/lib/utilities.py 
b/script.lrclyrics/resources/lib/utilities.py
index 2dbe1c4..466456b 100644
--- a/script.lrclyrics/resources/lib/utilities.py
+++ b/script.lrclyrics/resources/lib/utilities.py
@@ -1,8 +1,8 @@
 import sys
 import os
 import re
-import xbmc
-import xbmcgui
+import chardet
+import xbmc, xbmcgui, xbmcvfs
 
 DEBUG_MODE = 4
 
@@ -40,8 +40,8 @@ LOG_INFO, LOG_ERROR, LOG_NOTICE, LOG_DEBUG = range( 1, 5 )
 
 def _create_base_paths():
     """ creates the base folders """
-    if ( not os.path.isdir( BASE_DATA_PATH.decode("utf-8") ) ):
-        os.makedirs( BASE_DATA_PATH.decode("utf-8") )
+    if ( not xbmcvfs.exists( BASE_DATA_PATH.decode("utf-8") ) ):
+        xbmcvfs.mkdirs( BASE_DATA_PATH.decode("utf-8") )
 _create_base_paths()
 
 def get_xbmc_revision():
@@ -100,3 +100,22 @@ def get_settings():
     settings[ "subfolder" ] = __settings__.getSetting( "subfolder" ) == "true"
     settings[ "subfolder_name" ] = __settings__.getSetting( "subfolder_name" )
     return settings
+
+def get_textfile(filepath):
+    try:
+        if (not xbmcvfs.exists(filepath)):
+            return ""
+        file = xbmcvfs.File( filepath )
+        data = file.read()
+        file.close()
+        # Detect text encoding
+        enc = chardet.detect(data)
+        if (enc['encoding'] == 'utf-8'):
+            return data
+        else:
+            return unicode( data, enc['encoding'] ).encode( "utf-8")
+    except UnicodeDecodeError:
+        return data
+    except IOError:
+        return ""
+
diff --git a/script.lrclyrics/resources/settings.xml 
b/script.lrclyrics/resources/settings.xml
index 63ffb50..a33095e 100644
--- a/script.lrclyrics/resources/settings.xml
+++ b/script.lrclyrics/resources/settings.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <settings>   
-    <setting id="scraper" type="labelenum" label="30100" default="ttplayer" 
values="ttplayer|lyrdb|embedded" />
+    <setting id="scraper" type="labelenum" label="30100" default="ttplayer" 
values="ttplayer|minilyrics|lyrdb" />
     <setting type="sep" />
     <setting id="save_lyrics" type="bool" label="30101" default="true"/>
     <setting id="lyrics_path" type="folder" source="files" label="30102" 
default="" />

-----------------------------------------------------------------------

Summary of changes:
 script.lrclyrics/addon.xml                         |    2 +-
 script.lrclyrics/changelog.txt                     |   20 +-
 .../language/Chinese (Simple)/strings.xml          |    1 +
 .../resources/language/English/strings.xml         |    1 +
 .../resources}/lib/chardet/__init__.py             |    0
 .../resources}/lib/chardet/big5freq.py             |    0
 .../resources}/lib/chardet/big5prober.py           |    0
 .../resources}/lib/chardet/chardistribution.py     |    0
 .../resources}/lib/chardet/charsetgroupprober.py   |    0
 .../resources}/lib/chardet/charsetprober.py        |    0
 .../resources}/lib/chardet/codingstatemachine.py   |    0
 .../resources}/lib/chardet/constants.py            |    0
 .../resources}/lib/chardet/escprober.py            |    0
 .../resources}/lib/chardet/escsm.py                |    0
 .../resources}/lib/chardet/eucjpprober.py          |    0
 .../resources}/lib/chardet/euckrfreq.py            |    0
 .../resources}/lib/chardet/euckrprober.py          |    0
 .../resources}/lib/chardet/euctwfreq.py            |    0
 .../resources}/lib/chardet/euctwprober.py          |    0
 .../resources}/lib/chardet/gb2312freq.py           |    0
 .../resources}/lib/chardet/gb2312prober.py         |    0
 .../resources}/lib/chardet/hebrewprober.py         |    0
 .../resources}/lib/chardet/jisfreq.py              |    0
 .../resources}/lib/chardet/jpcntx.py               |    0
 .../resources}/lib/chardet/langbulgarianmodel.py   |    0
 .../resources}/lib/chardet/langcyrillicmodel.py    |    0
 .../resources}/lib/chardet/langgreekmodel.py       |    0
 .../resources}/lib/chardet/langhebrewmodel.py      |    0
 .../resources}/lib/chardet/langhungarianmodel.py   |    0
 .../resources}/lib/chardet/langthaimodel.py        |    0
 .../resources}/lib/chardet/latin1prober.py         |    0
 .../resources}/lib/chardet/mbcharsetprober.py      |    0
 .../resources}/lib/chardet/mbcsgroupprober.py      |    0
 .../resources}/lib/chardet/mbcssm.py               |    0
 .../resources}/lib/chardet/sbcharsetprober.py      |    0
 .../resources}/lib/chardet/sbcsgroupprober.py      |    0
 .../resources}/lib/chardet/sjisprober.py           |    0
 .../resources}/lib/chardet/universaldetector.py    |    0
 .../resources}/lib/chardet/utf8prober.py           |    0
 script.lrclyrics/resources/lib/embedlrc.py         |  125 ++++
 script.lrclyrics/resources/lib/gui.py              |   85 ++--
 .../lib/scrapers/embedded/lyricsScraper.py         |   65 --
 .../scrapers/{embedded => minilyrics}/__init__.py  |    0
 .../lib/scrapers/minilyrics/lyricsScraper.py       |  102 ++++
 script.lrclyrics/resources/lib/tagger/__init__.py  |   49 ++
 script.lrclyrics/resources/lib/tagger/constants.py |  277 +++++++++
 script.lrclyrics/resources/lib/tagger/debug.py     |   16 +
 script.lrclyrics/resources/lib/tagger/encoding.py  |   26 +
 .../resources/lib/tagger/exceptions.py             |   36 ++
 script.lrclyrics/resources/lib/tagger/id3v1.py     |  201 +++++++
 script.lrclyrics/resources/lib/tagger/id3v2.py     |  463 +++++++++++++++
 .../resources/lib/tagger/id3v2frame.py             |  617 ++++++++++++++++++++
 script.lrclyrics/resources/lib/tagger/utility.py   |  116 ++++
 script.lrclyrics/resources/lib/utilities.py        |   27 +-
 script.lrclyrics/resources/settings.xml            |    2 +-
 55 files changed, 2113 insertions(+), 118 deletions(-)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/__init__.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/big5freq.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/big5prober.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/chardistribution.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/charsetgroupprober.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/charsetprober.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/codingstatemachine.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/constants.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/escprober.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/escsm.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/eucjpprober.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/euckrfreq.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/euckrprober.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/euctwfreq.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/euctwprober.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/gb2312freq.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/gb2312prober.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/hebrewprober.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/jisfreq.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/jpcntx.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/langbulgarianmodel.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/langcyrillicmodel.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/langgreekmodel.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/langhebrewmodel.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/langhungarianmodel.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/langthaimodel.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/latin1prober.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/mbcharsetprober.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/mbcsgroupprober.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/mbcssm.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/sbcharsetprober.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/sbcsgroupprober.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/sjisprober.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/universaldetector.py (100%)
 copy {script.module.chardet => 
script.lrclyrics/resources}/lib/chardet/utf8prober.py (100%)
 create mode 100644 script.lrclyrics/resources/lib/embedlrc.py
 delete mode 100644 
script.lrclyrics/resources/lib/scrapers/embedded/lyricsScraper.py
 rename script.lrclyrics/resources/lib/scrapers/{embedded => 
minilyrics}/__init__.py (100%)
 create mode 100644 
script.lrclyrics/resources/lib/scrapers/minilyrics/lyricsScraper.py
 create mode 100644 script.lrclyrics/resources/lib/tagger/__init__.py
 create mode 100644 script.lrclyrics/resources/lib/tagger/constants.py
 create mode 100644 script.lrclyrics/resources/lib/tagger/debug.py
 create mode 100644 script.lrclyrics/resources/lib/tagger/encoding.py
 create mode 100644 script.lrclyrics/resources/lib/tagger/exceptions.py
 create mode 100644 script.lrclyrics/resources/lib/tagger/id3v1.py
 create mode 100644 script.lrclyrics/resources/lib/tagger/id3v2.py
 create mode 100644 script.lrclyrics/resources/lib/tagger/id3v2frame.py
 create mode 100644 script.lrclyrics/resources/lib/tagger/utility.py


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to