Hello, nice script, i had to customize it a little bit. So it does split the banners in anime and tvshows.
@Raytestrak: i read that your python skills are directing towards nil, but i hope you can read the part you need out of it:
My starting situation is, that i have mapped following paths for tv-series in XBMC:
\\NAS\Anime\
\\NAS\Serien\
I want my fanarts do be in different directories to set it as background in my home window of xbmc.
Code:
def _copy_tvshowfanart( self ):
animedir = os.path.join(self.tvshowfanartpath,'Animes');
tvshowdir = os.path.join(self.tvshowfanartpath,'Tvshows');
xbmcvfs.mkdir(animedir);
xbmcvfs.mkdir(tvshowdir);
count = 0
processeditems = 0
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"properties": ["title", "fanart","file"]}, "id": 1}')
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = simplejson.loads(json_query)
if (json_response['result'] != None) and (json_response['result'].has_key('tvshows')):
totalitems = len( json_response['result']['tvshows'] )
for item in json_response['result']['tvshows']:
if self.dialog.iscanceled():
log('script cancelled')
return
processeditems = processeditems + 1
self.dialog.update( int( float( processeditems ) / float( totalitems ) * 100), __language__(32002) + ': ' + str( count + 1 ) )
copypath = self.tvshowfanartpath;
if 'Anime' in item['file']:
copypath = animedir;
if 'Serien' in item['file']:
copypath = tvshowdir;
name = item['title']
artwork = item['fanart']
tmp_filename = name + '.jpg'
filename = clean_filename( tmp_filename )
if artwork != '':
try:
xbmcvfs.copy( xbmc.translatePath( artwork ) , os.path.join( copypath, filename ) )
count += 1
except:
count -= 1
log( 'failed to copy tvshowfanart' )
log( 'tvshowfanart copied: %s' % count )
In my case i only need to use the manager for tvshow-fanarts.
what i did:
Code:
animedir = os.path.join(self.tvshowfanartpath,'Animes');
tvshowdir = os.path.join(self.tvshowfanartpath,'Tvshows');
xbmcvfs.mkdir(animedir);
xbmcvfs.mkdir(tvshowdir);
create the directories "Animes" and "Tvshows" inside the TVShowFanart - folder
Code:
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"properties": ["title", "fanart","file"]}, "id": 1}')
add "file" to the query, so i know where the file came from...
Code:
copypath = self.tvshowfanartpath;
made a new copypath variable that will be our tvshowfanartpath in default
Code:
if 'Anime' in item['file']:
copypath = animedir;
if 'Serien' in item['file']:
copypath = tvshowdir;
change our default copy path variable as needed
Code:
xbmcvfs.copy( xbmc.translatePath( artwork ) , os.path.join( copypath, filename ) )
copy the image to our path
Thats way I end up having a folder "Animes" and a folder "Tvshows" inside my TVShowFanart folder containing the fanarts (that i need as backgrounds in my Aeon-Nox)