Kodi Community Forum
[RELEASE] Logo Downloader Script - Printable Version

+- Kodi Community Forum (http://forum.kodi.tv)
+-- Forum: Help and Support (/forumdisplay.php?fid=33)
+--- Forum: Add-ons Help and Support (/forumdisplay.php?fid=27)
+---- Forum: Program Add-ons (/forumdisplay.php?fid=151)
+---- Thread: [RELEASE] Logo Downloader Script (/showthread.php?tid=74912)



[RELEASE] Logo Downloader Script - ppic - 2010-06-01 02:48

THIS ADDON IS DEPRECATED.
PLEASE USE ARTWORK DOWNLOADER INSTEAD



Here it is !
This script allow you to download (awaiting for a better way) logo art that has been introduced with the Night skin but now they're spreading away Big Grin
Thanks to McBorzu !

v3.0.8 (pre-eden!)
- change script into program addon
- added addon settings
- script can now be run by user

v3.0.7 (pre-eden!)
- fixed search would fail when tv show name contained brackets
- fixed bulk mode search for clearart, characterart and showthumb

v3.0.6 (pre-eden!)
- adjusted to latest json-rpc changes
- fixed copy image to the right thumbnail cache folder
- delete cached dds version of image
- ommit select dialog when searching for only one type of images
- show notification instead of ok dialog when image is downloaded

v3.0.5 (pre-eden!)
- localized some hardcoded strings
- updated code for v4 of the fanart.tv api
- added support for characterart
Code:
<onclick>XBMC.RunScript(script.logo-downloader,mode=bulk,clearart=True,characterart=True,logo=True,showthumb=landsca​pe.jpg,poster=poster.jpg,banner=banner.jpg)</onclick>
v3.0.4 (pre-eden!)
- fixed json query when compactoutput was set to false

v3.0.3 (pre-eden!)
- do not use the xbmc temp dir

v3.0.2 (pre-eden!)
- added some logging
- code cleanup

v3.0.1 (pre-eden!)
- fixed deprecation warning

v3.0.0 (pre-eden!)
- updated code for eden

v2.3.0
- move to new fanart.tv API, also switch clearart and showthumb to download from fanart.tv
- add readme file (indications to integrate it)

v2.2.0
- add poster and banner (from http://www.tvdb.com) support (with custom naming) on bulk mode.
- add poster and banner (from http://www.tvdb.com) support (with custom naming) on solo mode.
example:
Code:
<onclick>XBMC.RunScript(script.logo-downloader,mode=bulk,clearart=True,logo=True,showthumb=landscape.jpg,poster=post​er.jpg,banner=banner.jpg)</onclick>

v2.1.4
- add custom naming. pass name in parameter instead of True / False

v2.1.3
- corrections for users with python 2.5 - thanks to Anssi(xbmc.org)

v2.1.2
- correction for nvfo change, now search for <tvdbid> and <id>.
- add "no tvdb id found"


v2.1.1
- correct type of image selection.
- add scan canceling

v2.0.0
- added xbmcstuff.com as source
- added show thumb and clearart support (cache replace too)
- rewritting the code
- debug condition fit with the xbmc one, debug log appear if xbmc debug level == 2
TO SKINNERS :
- informations to integrate added:
# HOW TO USE / INTEGRATE IN SKIN
#
# for automatically download the script from xbmc, include this in your addon.xml:

Code:
<requires>
<import addon="script.logo-downloader" version="2.0.0"/>
</requires>

# for solo mode (usually used from videoinfodialog) , $INFO[ListItem.TVShowTitle] is required.
# exemple to launch:
Code:
<onclick>XBMC.RunScript(script.logo-downloader,mode=solo,logo=True,clearart=True,showthumb=True,showname=$INFO[ListItem.TVShowTitle])</onclick>

# for bulk mode, no particular info needed, just need a button to launch from where you want.
# exemple to launch:
Code:
<onclick>XBMC.RunScript(script.logo-downloader,mode=bulk,clearart=True,logo=True,showthumb=True)</onclick>
# you can replace boolean by skin settings to activate / deactivate images types.

v1.4.0
- refetch a single logo now replace cache (will reload skin to take change immediately).

v1.3.5
- change sqlite to http api to hit bd.


v 1.3 OUT:
- update to download from new repo: (http://www.lockstockmods.net/clearart/)


v 1.2.3 OUT:
- better search
- now merge compatible
- be careful ! script directory name has changed !
- TO SKINNERS : adding solo mod ! now can be included in skin on video info view by adding a button like that;
Code:
        <control type="button" id="101">
            <description>Get Logo</description>
            <onclick>RunScript("Path to the script",$INFO[ListItem.FileNameAndPath])</onclick>
            <label>"Label"</label>
        </control>
Already available in Night , Minimedia by Waffa and transparency
Thanks to their coder


V1.1 out:
- do not erase logo.png if already exist -
- count percentage of your librairy completed with logo -
- now should support all librairy sources -

[Image: ppic.png]



Enjoy !







- Sranshaft - 2010-06-01 03:09

Very nice! One question: how does this take into account tv shows that might have multiple versions available?


- ppic - 2010-06-01 03:11

yes, i forgot to says, it will pick one, the last one in list i believe


- mcborzu - 2010-06-01 03:13

getting this error from the link

Quote:Parse error: syntax error, unexpected '{', expecting ')' in /home/shaitan/www/passion-xbmc/Sources/Subs.php on line 1038



- ppic - 2010-06-01 03:17

edited with alternative link, my bad it's the site maintenance this night lol!

if someone can make a nice logo for the script, i will be happy to add it Big Grin


- mcborzu - 2010-06-01 03:38

I'm getting no matches - when I turn I debugging it seems to be trying to match it with the IMDB id?

Quote:Checking 100 TV Show: Modern Family: tt1442437
no matches

Get that type of message for each show?


- ppic - 2010-06-01 04:18

ok you seems to use tvdb id in your librairy ?

maybe you are using nfo containing imdb id ?

ok, i'll post tomorow, i really need to sleep now ...

code is already in place, juste forgot to activate it Sad

sorry


- mcborzu - 2010-06-01 04:23

Oh no worries, yea I use Media Companion and it puts out this in my .nfo:

Quote: <id>tt1219024</id>
<tvdbid>83462</tvdbid>

I do select thetvdb as my scrapper but I dont know how all that internal XBMC stuff works...


- ppic - 2010-06-01 04:29

change that entire function:

Code:
def get_nfo_id( path ):
    nfo= os.path.join(path , "tvshow.nfo")
    print nfo
    nfo_read = file(repr(nfo).strip("u'\""), "r" ).read()
    tvdb_id = re.findall( "<tvdbid>(\d{1,10})</tvdbid>", nfo_read )
    print "thetvdb id: %s" % tvdb_id[0]
    return tvdb_id[0]

and change that part of code above "DIALOG_PROGRESS.close"
Code:
if TVshow_list and base_info:
    total_tvshow = len(TVshow_list)
    tvcount = 0
    total_logo = 0
    
    for TVshow in TVshow_list:
        if TVshow["id"][0:1] == "tt" : tvid = get_nfo_id( TVshow["path"] )
        else : tvid = TVshow["id"]
        tvcount = tvcount + 1
        ratio =  int (float( tvcount  * 100 ) / total_tvshow )
        print "### Checking %s TVshow: %s  id: %s" % ( ratio , translate_string( TVshow["name"] ) , tvid )
        DIALOG_PROGRESS.update( ratio , "Searching: %s " %  translate_string( TVshow["name"] ) , tvid )
        if ( DIALOG_PROGRESS.iscanceled() ): break
        logo_url = get_logo( tvid )
        if logo_url:
            succes = download_logo( logo_url , TVshow["path"] , ratio , TVshow["name"] )
            if succes:
                total_logo = total_logo + 1
                print "### Logo downloaded Successfully !!!"
            else: print "### Logo download Failed !!!"


now, i go to bed Wink


- ppic - 2010-06-01 16:59

have you been able to test it ?


- mcborzu - 2010-06-01 17:09

Unless I copied the code wrong I still got the same result. When I get back from work I try deleting the imdb id from my .nfo's and see if that works...


- Waffa - 2010-06-01 17:12

Thank u for the script, just got home from work will test script later and probably going to add a button to infoscreen to run your script. Wink


- ppic - 2010-06-01 17:24

no no mcborzu, it won't change !

the imdbid is in db, doesn't change if you delete it from nfo, my routine should work with a little bit change, i think the error is related to the "tt" string test as i haven't tested it while falling asleep on my keyboard, let me test it after my work, i'll post an update Wink


- ppic - 2010-06-01 17:27

Waffa Wrote:Thank u for the script, just got home from work will test script later and probably going to add a button to infoscreen to run your script. Wink

i haven't made it able to be launched for each series as the script will be abandonned when other repository will be available, but if you really want, I should be able to do a trick for you Wink

will be needed to launch : tvshow id ( tvdbid in db or in nfo ) and tvshowpath
are you able to have them when pushing the button on skin side?


- Waffa - 2010-06-01 18:08

The button would be in DialogVideoInfo.xml so yep, have id and path.