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

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

[RELEASE] Logo Downloader Script - ppic - 2010-06-01


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
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

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

- 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.

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

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

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

- correct type of image selection.
- add scan canceling

- 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
- informations to integrate added:
# for automatically download the script from xbmc, include this in your addon.xml:

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

# for solo mode (usually used from videoinfodialog) , $INFO[ListItem.TVShowTitle] is required.
# exemple to launch:

# for bulk mode, no particular info needed, just need a button to launch from where you want.
# exemple to launch:
# you can replace boolean by skin settings to activate / deactivate images types.

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

- 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;
        <control type="button" id="101">
            <description>Get Logo</description>
            <onclick>RunScript("Path to the script",$INFO[ListItem.FileNameAndPath])</onclick>
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 -


Enjoy !

- Sranshaft - 2010-06-01

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

- ppic - 2010-06-01

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

- mcborzu - 2010-06-01

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

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

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

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


- mcborzu - 2010-06-01

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

Quote: <id>tt1219024</id>

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

- ppic - 2010-06-01

change that entire function:

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"
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

have you been able to test it ?

- mcborzu - 2010-06-01

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

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

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

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

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