The branch, eden-pre has been updated
via b1075a2dfac8c10642872e5a38daef0da85cf113 (commit)
from 3da63d2ae34d5dbf0072dc3f3c444d81142cbe51 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=b1075a2dfac8c10642872e5a38daef0da85cf113
commit b1075a2dfac8c10642872e5a38daef0da85cf113
Author: ronie <[email protected]>
Date: Thu Oct 27 21:53:26 2011 +0200
[script.logo-downloader] -v3.0.8
add option to run manually
diff --git a/script.logo-downloader/addon.xml b/script.logo-downloader/addon.xml
index f0aa802..c08ef6c 100644
--- a/script.logo-downloader/addon.xml
+++ b/script.logo-downloader/addon.xml
@@ -1,25 +1,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.logo-downloader"
name="Logo Downloader"
- version="3.0.6"
+ version="3.0.8"
provider-name="ppic, ronie">
<requires>
<import addon="xbmc.python" version="2.0"/>
</requires>
- <extension point="xbmc.python.library"
- library="default.py" />
+ <extension point="xbmc.python.script"
+ library="default.py">
+ <provides>executable</provides>
+ </extension>
<extension point="xbmc.addon.metadata">
<platform>all</platform>
<minversion>30369</minversion>
<summary lang="en">Download Logos / posters / banners / cleararts
/showthumbs for your favorites Tvshows</summary>
<summary lang="fr">téléchargez les Logos / posters / banners / cleararts
/showthumbs de vos séries préférées</summary>
+ <summary lang="es">Descarga los logos / posters / banners / cleararts
/showthumbs de tus series preferidas</summary>
<description lang="en">Download logos from www.lockstockmods.net
cleararts and showthumbs from www.xbmcstuff.com
Banners and posters from www.tvdb.com</description>
<description lang="fr">Téléchargez les logos depuis www.lockstockmods.net
les cleararts et les showthumbs depuis www.xbmcstuff.com
les Banners et les posters depuis www.tvdb.com</description>
+ <description lang="es">Descarga los Logos de www.lockstockmods.net
+ los Cleararts y Showthumbs de www.xbmcstuff.com
+ y los Banners y Posters from www.tvdb.com</description>
<disclaimer lang="en">Please contribute on www.xbmcstuff.com www.tvdb.com
www.lockstockmods.net</disclaimer>
<disclaimer lang="fr">Contribuez sur www.xbmcstuff.com www.tvdb.com
www.lockstockmods.net</disclaimer>
+ <disclaimer lang="es">Por favor, ayuda a www.xbmcstuff.com www.tvdb.com
www.lockstockmods.net</disclaimer>
</extension>
</addon>
diff --git a/script.logo-downloader/changelog.txt
b/script.logo-downloader/changelog.txt
index e597451..bd02f40 100644
--- a/script.logo-downloader/changelog.txt
+++ b/script.logo-downloader/changelog.txt
@@ -1,3 +1,12 @@
+v3.0.8
+- change script into program addon
+- added addon settings
+- script can now be run by user
+
+v3.0.7
+- fixed search would fail when tv show name contained brackets
+- fixed bulk mode search for clearart, characterart and showthumb
+
v3.0.6
- adjusted to latest json-rpc changes
- fixed copy image to the right thumbnail cache folder
diff --git a/script.logo-downloader/default.py
b/script.logo-downloader/default.py
index 3a8caef..58b1f79 100644
--- a/script.logo-downloader/default.py
+++ b/script.logo-downloader/default.py
@@ -18,11 +18,11 @@ __useragent__ = "Mozilla/5.0 (Windows; U; Windows NT
5.1; fr; rv:1.9.0.1) Gec
SOURCEPATH = __cwd__
RESOURCES_PATH = xbmc.translatePath( os.path.join( __cwd__, 'resources' ) )
+THUMBS_CACHE_PATH = os.path.join( xbmc.translatePath( "special://profile/" ),
"Thumbnails/Video" )
DIALOG_DOWNLOAD = xbmcgui.DialogProgress()
ACTION_PREVIOUS_MENU = ( 9, 10, 92, 216, 247, 257, 275, 61467, 61448, )
sys.path.append( os.path.join( RESOURCES_PATH, "lib" ) )
-from file_item import Thumbnails
-thumbnails = Thumbnails()
+
def log(msg):
xbmc.log( str( msg ),level=xbmc.LOGDEBUG )
@@ -56,7 +56,6 @@ def get_html_source( url , save=False):
class downloader:
def __init__(self):
- log( "### logo downloader initializing..." )
if not xbmcvfs.exists( xbmc.translatePath(
'special://profile/addon_data/%s/temp' % __addonid__ ) ):
os.makedirs( xbmc.translatePath(
'special://profile/addon_data/%s/temp' % __addonid__ ) )
self.clearart = False
@@ -65,6 +64,9 @@ class downloader:
self.show_thumb = False
self.banner = False
self.poster = False
+ self.default_banner = False
+ self.default_poster = False
+ self.default_show_thumb = False
self.mode = ""
self.error = ""
self.reinit()
@@ -79,7 +81,7 @@ class downloader:
except: log( "### no arg3" )
try: log( "### arg 4: %s" % sys.argv[4] )
except: log( "### no arg4" )
- try: log( "arg 5: %s" % sys.argv[5] )
+ try: log( "### arg 5: %s" % sys.argv[5] )
except: log( "### no arg5" )
try: log( "### arg 6: %s" % sys.argv[6] )
except: log( "### no arg6" )
@@ -88,36 +90,86 @@ class downloader:
try: log( "### arg 8: %s" % sys.argv[8] )
except: log( "### no arg8" )
- for item in sys.argv:
- match = re.search("mode=(.*)" , item)
- if match: self.mode = match.group(1)
- match = re.search("clearart=(.*)" , item)
- if match:
- if not match.group(1) == "False": self.clearart =
match.group(1)
- else: pass
- match = re.search("characterart=(.*)" , item)
- if match:
- if not match.group(1) == "False": self.characterart =
match.group(1)
- else: pass
- match = re.search("logo=(.*)" , item)
- if match:
- if not match.group(1) == "False": self.logo = match.group(1)
- else: pass
- match = re.search("showthumb=(.*)" , item)
- if match:
- if not match.group(1) == "False": self.show_thumb =
match.group(1)
- else: pass
- match = re.search("showname=" , item)
- if match: self.show_name = item.replace( "showname=" , "" )
- else: pass
- match = re.search("banner=(.*)" , item)
- if match:
- if not match.group(1) == "False": self.banner = match.group(1)
- else: pass
- match = re.search("poster=(.*)" , item)
- if match:
- if not match.group(1) == "False": self.poster = match.group(1)
+ if sys.argv == ['']:
+ log( "### script run by user" )
+ self.banner = __addon__.getSetting('banner')
+ if self.banner == "true":
+ self.banner = "banner.jpg"
+ else:
+ self.banner = False
+ self.characterart = __addon__.getSetting('characterart')
+ if self.characterart == "true":
+ self.characterart = "character.png"
+ else:
+ self.characterart = False
+ self.clearart = __addon__.getSetting('clearart')
+ if self.clearart == "true":
+ self.clearart = "clearart.png"
+ else:
+ self.clearart = False
+ self.logo = __addon__.getSetting('logo')
+ if self.logo == "true":
+ self.logo = "logo.png"
+ else:
+ self.logo = False
+ self.poster = __addon__.getSetting('poster')
+ if self.poster == "true":
+ self.poster = "poster.jpg"
+ else:
+ self.poster = False
+ self.show_thumb = __addon__.getSetting('show_thumb')
+ if self.show_thumb == "true":
+ self.show_thumb = "landscape.jpg"
+ else:
+ self.show_thumb = False
+ self.download_thumb = __addon__.getSetting('download_thumb')
+ if self.download_thumb == "true":
+ self.default_thumb = __addon__.getSetting('default_thumb')
+ if self.default_thumb == "Banner":
+ self.default_banner = True
+ self.banner = "banner.jpg"
+ elif self.default_thumb == "Poster":
+ self.default_poster = True
+ self.poster = "poster.jpg"
+ elif self.default_show_thumb == "ShowThumb":
+ self.default_show_thumb = True
+ self.show_thumb = "landscape.jpg"
+ self.mode = "bulk"
+ log( "### download_thumb:%s ###" % self.download_thumb )
+ log( "### default_thumb:%s ###" % self.default_thumb )
+
+ else:
+ log( "### script run by skin" )
+ for item in sys.argv:
+ match = re.search("mode=(.*)" , item)
+ if match: self.mode = match.group(1)
+ match = re.search("clearart=(.*)" , item)
+ if match:
+ if not match.group(1) == "False": self.clearart =
match.group(1)
+ else: pass
+ match = re.search("characterart=(.*)" , item)
+ if match:
+ if not match.group(1) == "False": self.characterart =
match.group(1)
+ else: pass
+ match = re.search("logo=(.*)" , item)
+ if match:
+ if not match.group(1) == "False": self.logo =
match.group(1)
+ else: pass
+ match = re.search("showthumb=(.*)" , item)
+ if match:
+ if not match.group(1) == "False": self.show_thumb =
match.group(1)
+ else: pass
+ match = re.search("showname=" , item)
+ if match: self.show_name = item.replace( "showname=" , "" )
else: pass
+ match = re.search("banner=(.*)" , item)
+ if match:
+ if not match.group(1) == "False": self.banner =
match.group(1)
+ else: pass
+ match = re.search("poster=(.*)" , item)
+ if match:
+ if not match.group(1) == "False": self.poster =
match.group(1)
+ else: pass
if self.mode == "solo":
log( "### Start Solo Mode" )
@@ -201,9 +253,11 @@ class downloader:
self.TV_listing()
processeditems = 0
+ log( "### banner:%s ###" % self.banner )
log( "### clearart:%s ###" % self.clearart )
log( "### characterart:%s ###" % self.characterart )
log( "### logo:%s ###" % self.logo )
+ log( "### poster:%s ###" % self.poster )
log( "### show_thumb:%s ###" % self.show_thumb )
for currentshow in self.TVlist:
@@ -245,15 +299,13 @@ class downloader:
self.image_url = False
self.filename = False
-# if self.clearart or self.show_thumb:
-# log( "### get xbmcstuff xml"
-# self.get_xbmcstuff_xml()
-
if self.clearart:
log( "### Search clearart for %s" % self.show_name )
if self.clearart == "True": self.filename = "clearart.png"
else: self.filename = self.clearart
if not xbmcvfs.exists( os.path.join( self.show_path ,
self.filename ) ):
+ log( "### get lockstock xml" )
+ self.get_lockstock_xml()
if self.search_clearart():
log( "### found clearart for %s" % self.show_name )
if self.download_image():
@@ -272,6 +324,8 @@ class downloader:
if self.characterart == "True": self.filename =
"character.png"
else: self.filename = self.characterart
if not xbmcvfs.exists( os.path.join( self.show_path ,
self.filename ) ):
+ log( "### get lockstock xml" )
+ self.get_lockstock_xml()
if self.search_characterart():
log( "### found characterart for %s" %
self.show_name )
if self.download_image():
@@ -290,6 +344,8 @@ class downloader:
if self.show_thumb == "True": self.filename = "folder.jpg"
else: self.filename = self.show_thumb
if not xbmcvfs.exists( os.path.join( self.show_path ,
self.filename ) ):
+ log( "### get lockstock xml" )
+ self.get_lockstock_xml()
if self.search_show_thumb():
log( "### found show thumb for %s" %
self.show_name )
if self.download_image():
@@ -313,7 +369,7 @@ class downloader:
else: self.filename = self.poster
if not xbmcvfs.exists( os.path.join( self.show_path ,
self.filename ) ):
if self.search_poster():
- log( "### found show thumb for %s" %
self.show_name )
+ log( "### found poster for %s" % self.show_name )
if self.download_image():
self.poster_download = self.poster_download +1
log( "### poster downloaded for %s" %
self.show_name )
@@ -331,7 +387,7 @@ class downloader:
else: self.filename = self.banner
if not xbmcvfs.exists( os.path.join( self.show_path ,
self.filename ) ):
if self.search_banner():
- log( "### found show thumb for %s" %
self.show_name )
+ log( "### found banner for %s" % self.show_name )
if self.download_image():
self.banner_download = self.banner_download +1
log( "### banner downloaded for %s" %
self.show_name )
@@ -423,7 +479,6 @@ class downloader:
except: log( "### xbmcstuff_xml:" )
def TV_listing(self):
- # json statement for tv shows
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetTVShows", "params": {"properties": ["file", "imdbnumber"],
"sort": { "method": "label" } }, "id": 1}')
json_response = re.compile( "{(.*?)}", re.DOTALL ).findall(json_query)
self.TVlist = []
@@ -453,7 +508,7 @@ class downloader:
findtvshowname = re.search( '"label": ?"(.*?)",["\n]', tvshowitem )
if findtvshowname:
tvshowname = (findtvshowname.group(1))
- tvshowmatch = re.search( '.*' + self.show_name + '.*',
tvshowname, re.I )
+ tvshowmatch = re.search( '.*' +
self.show_name.replace('(','[(]').replace(')','[)]').replace('+','[+]') + '.*',
tvshowname, re.I )
if tvshowmatch:
log( "### tv show: %s" % tvshowitem )
findpath = re.search( '"file": ?"(.*?)",["\n]', tvshowitem
)
@@ -505,9 +560,6 @@ class downloader:
self.lockstock_xml = get_html_source(
"http://fanart.tv/api/fanart.php?v=4&id=" + str( self.tvdbid ) )
log( "### lockstock: %s" % self.lockstock_xml )
-# def get_xbmcstuff_xml(self):
-# self.xbmcstuff_xml = get_html_source
("http://www.xbmcstuff.com/tv_scraper.php?&id_scraper=p7iuVTQXQWGyWXPS&size=big&thetvdb="
+ str( self.tvdbid ) )
-
def get_tvdb_xml(self):
self.tvdb_xml = get_html_source
("http://www.thetvdb.com/api/F90E687D789D7F7C/series/%s/banners.xml" % str(
self.tvdbid ) )
@@ -568,6 +620,11 @@ class downloader:
self.image_list.append("http://www.thetvdb.com/banners/" +
i)
if self.mode == "bulk" : self.image_url =
"http://www.thetvdb.com/banners/" + match[0]
return True
+ else:
+ log( "### No poster found !" )
+ if self.mode == "solo": xbmcgui.Dialog().ok(__language__(32116) ,
__language__(32135) )
+ self.image_list = False
+ return False
def search_banner( self ):
match =
re.findall("<BannerPath>(.*?)</BannerPath>\s+<BannerType>series</BannerType>" ,
self.tvdb_xml)
@@ -578,6 +635,11 @@ class downloader:
self.image_list.append("http://www.thetvdb.com/banners/" +
i)
if self.mode == "bulk" : self.image_url =
"http://www.thetvdb.com/banners/" + match[0]
return True
+ else:
+ log( "### No banner found !" )
+ if self.mode == "solo": xbmcgui.Dialog().ok(__language__(32116) ,
__language__(32134) )
+ self.image_list = False
+ return False
def choice_type(self):
select = xbmcgui.Dialog().select(__language__(32120) , self.type_list)
@@ -595,24 +657,14 @@ class downloader:
return True
def choose_image(self):
- #select = xbmcgui.Dialog().select(__language__(32123) ,
self.image_list)
log( "### image list: %s" % self.image_list )
self.image_url = MyDialog(self.image_list)
if self.image_url: return True
else: return False
-# if select == -1:
-# log( "### Canceled by user" )
-# xbmcgui.Dialog().ok(__language__(32121) , __language__(32122) )
-# self.image_url = False
-# return False
-# else:
-# self.image_url = self.image_list[select]
-# return True
def erase_current_cache(self):
try:
- if not self.filename == "folder.jpg": cached_thumb =
thumbnails.get_cached_video_thumb( os.path.join( self.show_path , self.filename
)).replace( "/Video" , "").replace("tbn" , "png")
- else: cached_thumb =
thumbnails.get_cached_video_thumb(self.show_path)
+ cached_thumb = self.get_cached_thumb(self.show_path, self.filename)
log( "### cache %s" % cached_thumb )
if xbmcvfs.exists( cached_thumb.replace("png" ,
"dds").replace("jpg" , "dds") ):
xbmcvfs.delete( cached_thumb.replace("png" ,
"dds").replace("jpg" , "dds") )
@@ -620,19 +672,33 @@ class downloader:
if copy:
xbmc.executebuiltin( 'XBMC.ReloadSkin()' )
xbmc.executebuiltin( "Notification(" + __language__(32103) +
"," + __language__(32104) + ")" )
- pass
else:
log( "### failed to copy to cached thumb" )
except :
print_exc()
log( "### cache erasing error" )
+ def get_cached_thumb( self, path, filename ):
+ if path.startswith( "stack://" ):
+ path = strPath[ 8 : ].split( " , " )[ 0 ]
+ if filename == "folder.jpg":
+ cachedthumb = xbmc.getCacheThumbName( path )
+ thumbpath = os.path.join( THUMBS_CACHE_PATH, cachedthumb[0],
cachedthumb )
+ else:
+ cachedthumb = xbmc.getCacheThumbName( os.path.join( path, filename
) )
+ if ".jpg" in filename:
+ cachedthumb = cachedthumb.replace("tbn" , "jpg")
+ elif ".png" in filename:
+ cachedthumb = cachedthumb.replace("tbn" , "png")
+ thumbpath = os.path.join( THUMBS_CACHE_PATH, cachedthumb[0],
cachedthumb ).replace( "/Video" , "")
+ return thumbpath
+
def download_image( self ):
DIALOG_DOWNLOAD.create( __language__(32107), __language__(32124) + ' '
+ self.show_name , __language__(32125) )
tmpdestination = xbmc.translatePath(
'special://profile/addon_data/%s/temp/%s' % ( __addonid__ , self.filename ) )
destination = os.path.join( self.show_path , self.filename )
- log( "### download :" + self.image_url )
- log( "### path: " + repr(destination).strip("'u") )
+ log( "### download: %s" % self.image_url )
+ log( "### path: %s" % repr(destination).strip("'u") )
try:
def _report_hook( count, blocksize, totalsize ):
@@ -659,6 +725,23 @@ class downloader:
xbmcvfs.delete(tmpdestination)
DIALOG_DOWNLOAD.close()
return False
+
+ if self.default_banner and self.filename == "banner.jpg":
+ copy_default = True
+ elif self.default_poster and self.filename == "poster.jpg":
+ copy_default = True
+ elif self.default_show_thumb and self.filename ==
"landscape.jpg":
+ copy_default = True
+ else:
+ copy_default = False
+ if copy_default:
+ destination = os.path.join( self.show_path , "folder.jpg" )
+ copy = xbmcvfs.copy(tmpdestination, destination)
+ if copy:
+ log( "### copy to default thumb successful" )
+ else:
+ log( "### copy to default thumb failed" )
+
xbmcvfs.delete(tmpdestination)
if self.mode == "solo": self.erase_current_cache()
return True
@@ -697,19 +780,12 @@ class MainGui( xbmcgui.WindowXMLDialog ):
self.setFocus(self.img_list)
def onAction(self, action):
- #Close the script
if action in ACTION_PREVIOUS_MENU:
self.close()
def onClick(self, controlID):
log( "### control: %s" % controlID )
- """
- Notice: onClick not onControl
- Notice: it gives the ID of the control not the control object
- """
- #List actions
if controlID == 6 or controlID == 3:
- #Return selected item
num = self.img_list.getSelectedPosition()
log( "### position: %s" % num )
self.selected_url = self.img_list.getSelectedItem().getLabel2()
diff --git a/script.logo-downloader/resources/language/English/strings.xml
b/script.logo-downloader/resources/language/English/strings.xml
index e3deedb..a1c8f76 100644
--- a/script.logo-downloader/resources/language/English/strings.xml
+++ b/script.logo-downloader/resources/language/English/strings.xml
@@ -33,5 +33,15 @@
<string id="32131">showthumb</string>
<string id="32132">banner</string>
<string id="32133">poster</string>
+ <string id="32134">No banner found!</string>
+ <string id="32135">No poster found!</string>
+ <string id="32201">Download Banner (banner.jpg)</string>
+ <string id="32202">Download CharacterArt (character.png)</string>
+ <string id="32203">Download ClearArt (clearart.png)</string>
+ <string id="32204">Download Logo (logo.png)</string>
+ <string id="32205">Download Poster (poster.jpg)</string>
+ <string id="32206">Download ShowThumb (landscape.jpg)</string>
+ <string id="32207">Replace default thumb (folder.jpg)</string>
+ <string id="32208">- With:</string>
</strings>
-----------------------------------------------------------------------
Summary of changes:
script.logo-downloader/addon.xml | 13 +-
script.logo-downloader/changelog.txt | 9 +
script.logo-downloader/default.py | 206 +++++++++++++------
script.logo-downloader/readme.txt | 25 ---
.../resources/language/English/strings.xml | 10 +
.../language/Portuguese (Brazil)/strings.xml | 30 +++
.../resources/language/Spanish/strings.xml | 36 ++++
script.logo-downloader/resources/lib/file_item.py | 98 ---------
script.logo-downloader/resources/settings.xml | 13 ++
9 files changed, 249 insertions(+), 191 deletions(-)
delete mode 100644 script.logo-downloader/readme.txt
create mode 100644 script.logo-downloader/resources/language/Portuguese
(Brazil)/strings.xml
create mode 100644
script.logo-downloader/resources/language/Spanish/strings.xml
delete mode 100644 script.logo-downloader/resources/lib/file_item.py
create mode 100644 script.logo-downloader/resources/settings.xml
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons