The branch, eden-pre has been updated
via 55daab19724b5603d1ca241af58ab91a9ce71e80 (commit)
from 4c6930efdc5750cb49d8b2591fd7dcb6c6e3f98c (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=55daab19724b5603d1ca241af58ab91a9ce71e80
commit 55daab19724b5603d1ca241af58ab91a9ce71e80
Author: ronie <[email protected]>
Date: Tue Sep 20 22:02:16 2011 +0200
[script.artworkorganizer] -v0.1.2
added option for season and episode thumbs
diff --git a/script.artworkorganizer/addon.xml
b/script.artworkorganizer/addon.xml
index fb35c70..3e26a39 100644
--- a/script.artworkorganizer/addon.xml
+++ b/script.artworkorganizer/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="script.artworkorganizer" name="Artwork Organizer" version="0.1.0"
provider-name="ronie">
+<addon id="script.artworkorganizer" name="Artwork Organizer" version="0.1.2"
provider-name="ronie">
<requires>
<import addon="xbmc.python" version="2.0"/>
</requires>
diff --git a/script.artworkorganizer/changelog.txt
b/script.artworkorganizer/changelog.txt
index c520101..e5e5fda 100644
--- a/script.artworkorganizer/changelog.txt
+++ b/script.artworkorganizer/changelog.txt
@@ -1,3 +1,10 @@
+v0.1.2
+- adjusted to latest json-rpc changes
+- added option for episode and season thumbs
+
+v0.1.1
+- fix utf-8 error
+
v0.1.0
- initial release
diff --git a/script.artworkorganizer/default.py
b/script.artworkorganizer/default.py
index 78fe2c3..bcb021b 100644
--- a/script.artworkorganizer/default.py
+++ b/script.artworkorganizer/default.py
@@ -16,8 +16,7 @@ def log(txt):
def clean_filename(tmp_filename):
illegal_char = '<>:"/\|?*'
for char in illegal_char:
- tmp_filename = tmp_filename.replace( char , '' )
- filename = unicodedata.normalize('NFKD', unicode(unicode(tmp_filename,
'utf-8'))).encode('ascii','ignore')
+ filename = tmp_filename.replace( char , '' )
return filename
@@ -38,6 +37,8 @@ class Main:
self.artistfanart = __addon__.getSetting( "artistfanart" )
self.moviethumbs = __addon__.getSetting( "moviethumbs" )
self.tvshowthumbs = __addon__.getSetting( "tvshowthumbs" )
+ self.seasonthumbs = __addon__.getSetting( "seasonthumbs" )
+ self.episodethumbs = __addon__.getSetting( "episodethumbs" )
self.musicvideothumbs = __addon__.getSetting( "musicvideothumbs" )
self.artistthumbs = __addon__.getSetting( "artistthumbs" )
self.albumthumbs = __addon__.getSetting( "albumthumbs" )
@@ -51,6 +52,8 @@ class Main:
self.artistfanartdir = 'ArtistFanart'
self.moviethumbsdir = 'MovieThumbs'
self.tvshowthumbsdir = 'TVShowThumbs'
+ self.seasonthumbsdir = 'SeasonThumbs'
+ self.episodethumbsdir = 'EpisodeThumbs'
self.musicvideothumbsdir = 'MusicVideoThumbs'
self.artistthumbsdir = 'ArtistThumbs'
self.albumthumbsdir = 'AlbumThumbs'
@@ -77,6 +80,12 @@ class Main:
if self.tvshowthumbs != '':
self.tvshowthumbspath = os.path.join( self.directory,
self.tvshowthumbsdir )
self.artworklist.append( self.tvshowthumbspath )
+ if self.seasonthumbs != '':
+ self.seasonthumbspath = os.path.join( self.directory,
self.seasonthumbsdir )
+ self.artworklist.append( self.seasonthumbspath )
+ if self.episodethumbs != '':
+ self.episodethumbspath = os.path.join( self.directory,
self.episodethumbsdir )
+ self.artworklist.append( self.episodethumbspath )
if self.musicvideothumbs != '':
self.musicvideothumbspath = os.path.join( self.directory,
self.musicvideothumbsdir )
self.artworklist.append( self.musicvideothumbspath )
@@ -134,6 +143,12 @@ class Main:
if self.tvshowthumbs == 'true':
self._copy_tvshowthumbs()
if not self.dialog.iscanceled():
+ if self.seasonthumbs == 'true':
+ self._copy_seasonthumbs()
+ if not self.dialog.iscanceled():
+ if self.episodethumbs == 'true':
+ self._copy_episodethumbs()
+ if not self.dialog.iscanceled():
if self.musicvideothumbs == 'true':
self._copy_musicvideothumbs()
if not self.dialog.iscanceled():
@@ -148,7 +163,7 @@ class Main:
def _copy_moviefanart( self ):
count = 0
processeditems = 0
- json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetMovies", "params": {"fields": ["fanart", "year"] }, "id": 1}')
+ json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetMovies", "params": {"properties": ["fanart", "year"] }, "id":
1}')
json_response = re.compile( "{(.*?)}", re.DOTALL ).findall(json_query)
totalitems = len( json_response )
for item in json_response:
@@ -170,7 +185,7 @@ class Main:
findartwork = re.search( '"fanart": ?"(.*?)",["\n]', item )
if findartwork:
artwork = (findartwork.group(1))[:-4]
- tmp_filename = name + ' (' + year + ' )'
+ tmp_filename = name + ' (' + year + ')'
filename = clean_filename( tmp_filename )
for ext in (".dds", ".tbn"):
if xbmcvfs.exists( xbmc.translatePath( artwork + ext ) ):
@@ -187,7 +202,7 @@ class Main:
def _copy_tvshowfanart( self ):
count = 0
processeditems = 0
- json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetTVShows", "params": {"fields": ["fanart"] }, "id": 1}')
+ json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetTVShows", "params": {"properties": ["fanart"] }, "id": 1}')
json_response = re.compile( "{(.*?)}", re.DOTALL ).findall(json_query)
totalitems = len( json_response )
for item in json_response:
@@ -221,7 +236,7 @@ class Main:
def _copy_musicvideofanart( self ):
count = 0
processeditems = 0
- json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetMusicVideos", "params": {"fields": ["fanart", "artist"] },
"id": 1}')
+ json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetMusicVideos", "params": {"properties": ["fanart", "artist"] },
"id": 1}')
json_response = re.compile( "{(.*?)}", re.DOTALL ).findall(json_query)
totalitems = len( json_response )
for item in json_response:
@@ -260,7 +275,7 @@ class Main:
def _copy_artistfanart( self ):
count = 0
processeditems = 0
- json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"AudioLibrary.GetArtists", "params": {"fields": ["fanart"] }, "id": 1}')
+ json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"AudioLibrary.GetArtists", "params": {"properties": ["fanart"] }, "id": 1}')
json_response = re.compile( "{(.*?)}", re.DOTALL ).findall(json_query)
totalitems = len( json_response )
for item in json_response:
@@ -294,7 +309,7 @@ class Main:
def _copy_moviethumbs( self ):
count = 0
processeditems = 0
- json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetMovies", "params": {"fields": ["thumbnail", "year"] }, "id":
1}')
+ json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetMovies", "params": {"properties": ["thumbnail", "year"] },
"id": 1}')
json_response = re.compile( "{(.*?)}", re.DOTALL ).findall(json_query)
totalitems = len( json_response )
for item in json_response:
@@ -316,7 +331,7 @@ class Main:
findartwork = re.search( '"thumbnail": ?"(.*?)",["\n]', item )
if findartwork:
artwork = (findartwork.group(1))[:-4]
- tmp_filename = name + ' (' + year + ' )'
+ tmp_filename = name + ' (' + year + ')'
filename = clean_filename( tmp_filename )
for ext in (".dds", ".tbn"):
if xbmcvfs.exists( xbmc.translatePath( artwork + ext ) ):
@@ -333,7 +348,7 @@ class Main:
def _copy_tvshowthumbs( self ):
count = 0
processeditems = 0
- json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetTVShows", "params": {"fields": ["thumbnail"] }, "id": 1}')
+ json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetTVShows", "params": {"properties": ["thumbnail"] }, "id": 1}')
json_response = re.compile( "{(.*?)}", re.DOTALL ).findall(json_query)
totalitems = len( json_response )
for item in json_response:
@@ -364,10 +379,111 @@ class Main:
log( 'tvshowthumbs copied: %s' % count )
+ def _copy_seasonthumbs( self ):
+ count = 0
+ tvshowids = []
+ json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetTVShows", "id": 1}')
+ json_response = re.compile( "{(.*?)}", re.DOTALL ).findall(json_query)
+ for item in json_response:
+ if self.dialog.iscanceled():
+ log('script cancelled')
+ return
+ findid = re.search( '"tvshowid": ?(.*)', item )
+ if findid:
+ tvshowid = (findid.group(1))
+ tvshowids.append(tvshowid)
+ for tvshowid in tvshowids:
+ processeditems = 0
+ json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetSeasons", "params": {"properties": ["thumbnail", "showtitle"],
"tvshowid":%s }, "id": 1}' % tvshowid)
+ json_response = re.compile( "{(.*?)}", re.DOTALL
).findall(json_query)
+ totalitems = len( json_response )
+ for item in json_response:
+ if self.dialog.iscanceled():
+ log('script cancelled')
+ return
+ processeditems = processeditems + 1
+ self.dialog.update( int( float( processeditems ) / float(
totalitems ) * 100), __language__(32006) + ': ' + str( count + 1 ) )
+ findname = re.search( '"label": ?"(.*?)",["\n]', item )
+ if findname:
+ name = (findname.group(1))
+ else:
+ continue
+ findtvshow = re.search( '"showtitle": ?"(.*?)",["\n]', item )
+ if findtvshow:
+ tvshow = (findtvshow.group(1))
+ else:
+ tvshow = ""
+ findartwork = re.search( '"thumbnail": ?"(.*?)"', item )
+ if findartwork:
+ artwork = (findartwork.group(1))[:-4]
+ tmp_filename = tvshow + ' - ' + name
+ filename = clean_filename( tmp_filename )
+ for ext in (".dds", ".tbn"):
+ if xbmcvfs.exists( xbmc.translatePath( artwork + ext )
):
+ try:
+ count += 1
+ xbmcvfs.copy( xbmc.translatePath( artwork +
ext ), os.path.join( self.seasonthumbspath, '%s%s' % (filename, ext) ) )
+ break
+ except:
+ count -= 1
+ log( 'failed to copy seasonthumb' )
+ log( 'seasonthumbs copied: %s' % count )
+
+
+ def _copy_episodethumbs( self ):
+ count = 0
+ processeditems = 0
+ json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetEpisodes", "params": {"properties": ["thumbnail", "season",
"episode", "showtitle"] }, "id": 1}')
+ json_response = re.compile( "{(.*?)}", re.DOTALL ).findall(json_query)
+ totalitems = len( json_response )
+ for item in json_response:
+ if self.dialog.iscanceled():
+ log('script cancelled')
+ return
+ processeditems = processeditems + 1
+ self.dialog.update( int( float( processeditems ) / float(
totalitems ) * 100), __language__(32006) + ': ' + str( count + 1 ) )
+ findname = re.search( '"label": ?"(.*?)",["\n]', item )
+ if findname:
+ name = (findname.group(1))
+ else:
+ continue
+ findtvshow = re.search( '"showtitle": ?"(.*?)",["\n]', item )
+ if findtvshow:
+ tvshow = (findtvshow.group(1))
+ else:
+ tvshow = ""
+ findseason = re.search( '"season": ?(.*?),["\n]', item )
+ if findseason:
+ season = (findseason.group(1))
+ else:
+ season = ""
+ findepisode = re.search( '"episode": ?(.*?),["\n]', item )
+ if findepisode:
+ episode = (findepisode.group(1))
+ else:
+ episode = ""
+ findartwork = re.search( '"thumbnail": ?"(.*?)"', item )
+ episodenumber = "s%.2d%.2d" % (int( season ), int( episode ))
+ if findartwork:
+ artwork = (findartwork.group(1))[:-4]
+ tmp_filename = tvshow + ' - ' + episodenumber + ' - ' + name
+ filename = clean_filename( tmp_filename )
+ for ext in (".dds", ".tbn"):
+ if xbmcvfs.exists( xbmc.translatePath( artwork + ext ) ):
+ try:
+ count += 1
+ xbmcvfs.copy( xbmc.translatePath( artwork + ext ),
os.path.join( self.episodethumbspath, '%s%s' % (filename, ext) ) )
+ break
+ except:
+ count -= 1
+ log( 'failed to copy episodethumb' )
+ log( 'episodethumbs copied: %s' % count )
+
+
def _copy_musicvideothumbs( self ):
count = 0
processeditems = 0
- json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetMusicVideos", "params": {"fields": ["thumbnail", "artist"] },
"id": 1}')
+ json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetMusicVideos", "params": {"properties": ["thumbnail", "artist"]
}, "id": 1}')
json_response = re.compile( "{(.*?)}", re.DOTALL ).findall(json_query)
totalitems = len( json_response )
for item in json_response:
@@ -406,7 +522,7 @@ class Main:
def _copy_artistthumbs( self ):
count = 0
processeditems = 0
- json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"AudioLibrary.GetArtists", "params": {"fields": ["thumbnail"] }, "id": 1}')
+ json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"AudioLibrary.GetArtists", "params": {"properties": ["thumbnail"] }, "id": 1}')
json_response = re.compile( "{(.*?)}", re.DOTALL ).findall(json_query)
totalitems = len( json_response )
for item in json_response:
@@ -440,7 +556,7 @@ class Main:
def _copy_albumthumbs( self ):
count = 0
processeditems = 0
- json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"AudioLibrary.GetAlbums", "params": {"fields": ["thumbnail", "artist"] }, "id":
1}')
+ json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"AudioLibrary.GetAlbums", "params": {"properties": ["thumbnail", "artist"] },
"id": 1}')
json_response = re.compile( "{(.*?)}", re.DOTALL ).findall(json_query)
totalitems = len( json_response )
for item in json_response:
diff --git a/script.artworkorganizer/resources/language/English/strings.xml
b/script.artworkorganizer/resources/language/English/strings.xml
index 385fd38..75eb2d2 100644
--- a/script.artworkorganizer/resources/language/English/strings.xml
+++ b/script.artworkorganizer/resources/language/English/strings.xml
@@ -6,8 +6,10 @@
<string id="32004">Copy Artist Fanart</string>
<string id="32005">Copy Movie Thumbs</string>
<string id="32006">Copy TV Show Thumbs</string>
- <string id="32007">Copy Music Video Thumbs</string>
- <string id="32008">Copy Artist Thumbs</string>
- <string id="32009">Copy Album Thumbs</string>
- <string id="32010">Destination directory</string>
+ <string id="32007">Copy Season Thumbs</string>
+ <string id="32008">Copy Episode Thumbs</string>
+ <string id="32009">Copy Music Video Thumbs</string>
+ <string id="32010">Copy Artist Thumbs</string>
+ <string id="32011">Copy Album Thumbs</string>
+ <string id="32012">Destination directory</string>
</strings>
diff --git a/script.artworkorganizer/resources/settings.xml
b/script.artworkorganizer/resources/settings.xml
index 715d8ab..fb91687 100644
--- a/script.artworkorganizer/resources/settings.xml
+++ b/script.artworkorganizer/resources/settings.xml
@@ -7,9 +7,11 @@
<setting id="artistfanart" type="bool" label="32004"
default="true"/>
<setting id="moviethumbs" type="bool" label="32005"
default="true"/>
<setting id="tvshowthumbs" type="bool" label="32006"
default="true"/>
- <setting id="musicvideothumbs" type="bool" label="32007"
default="true"/>
- <setting id="artistthumbs" type="bool" label="32008"
default="true"/>
- <setting id="albumthumbs" type="bool" label="32009"
default="true"/>
- <setting id="directory" type="folder" label="32010"/>
+ <setting id="seasonthumbs" type="bool" label="32007"
default="true"/>
+ <setting id="episodethumbs" type="bool" label="32008"
default="true"/>
+ <setting id="musicvideothumbs" type="bool" label="32009"
default="true"/>
+ <setting id="artistthumbs" type="bool" label="32010"
default="true"/>
+ <setting id="albumthumbs" type="bool" label="32011"
default="true"/>
+ <setting id="directory" type="folder" label="32012"/>
</category>
</settings>
-----------------------------------------------------------------------
Summary of changes:
script.artworkorganizer/addon.xml | 2 +-
script.artworkorganizer/changelog.txt | 7 +
script.artworkorganizer/default.py | 142 ++++++++++++++++++--
.../resources/language/English/strings.xml | 10 +-
script.artworkorganizer/resources/settings.xml | 10 +-
5 files changed, 149 insertions(+), 22 deletions(-)
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons