Kodi Community Forum
[RELEASE] Movie Set Artwork Automator - 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] Movie Set Artwork Automator (/showthread.php?tid=153502)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38


RE: [RELEASE] Movie Set Artwork Automator - EtgarDizz - 2014-10-10

I know you specifically wrote this add-on is not a scraper, but... It just screams for that option.
It would be so great to be able to scrape the art. You're already inside the individual sets' folders, why not use the folder titles for a search on TMDB?

I've written a small python script (not really a python programmer so keep that in mind).
Would you be interested in incorporating it into your script? you just need to call this piece of code once you got the movie set title:

PHP Code:
import reurlliburllib2
from BeautifulSoup import BeautifulSoup

baseurl 
'http://www.themoviedb.org'

movie_set_name 'X-Men Collection' # this will be replaced by the script

query baseurl '/search/movie_collection?query=' urllib.quote_plusmovie_set_name )
search BeautifulSoup(urllib2.urlopenquery ).read())
search_result search.find('ul''search_results')

if 
len(search_result.findAll('li')) == 1:
  
link search_result.a['href']
  
collection BeautifulSoup(urllib2.urlopenbaseurl link ).read())
  
title collection.h2.a.string
  poster 
collection.find('a''poster').find('img''shadow')['src']
  
fanart collection.find('div'id='backdrops').img['src']

  
poster re.sub('/w[0-9]+/''/original/'poster)
  
fanart re.sub('/w[0-9]+/''/original/'fanart)

  print 
poster # this links to the artwork! download, rename to poster.jpg and update DB
  
print fanart # this links to the artwork! download, rename to fanart.jpg and update DB

else:
  print 
'Error while matching collection.' 

I'm not affraid to admit I'm a little OCD myself Smile
But I let XBMC do all the scraping for me, so this would be awesome.

Would love to hear your thoughts on this.


RE: [RELEASE] Movie Set Artwork Automator - EtgarDizz - 2014-10-12

Hi there,
Kept reading the script and TMDB specs - turns out a better implementation would be using the API Smile
I added this file (download.py)

PHP Code:
import urlliburllib2json
import xbmc
xbmcaddon
from log import log
from database import ARTWORK_TYPE_POSTER
ARTWORK_TYPE_FANART

__addon__     
xbmcaddon.Addon"script.moviesetart" )
download_path xbmc.translatePath__addon__.getSetting"download_folder_path" ) ).decode('utf-8')

apiurl 'http://api.themoviedb.org/3/'
apikey '4be68d7eab1fbd1b6fd8a3b80a65a95e'
base_image_url None

def _download_getjson
urlparams=(), queryparams={} ):
  
url apiurl url params '?' _download_format_query(queryparams)
  
request urllib2.Request(url)
  
request.add_header('Accept''application/json')
  
data json.loads(urllib2.urlopen(request).read())
  return 
data

def _download_base_url
():
  global 
base_image_url
  
if not base_image_url:
    
config _download_getjson'configuration' )
    
base_image_url config['images']['base_url'] + 'original'
  
return base_image_url

def _download_format_query
queryparams ):
  
query = ['api_key=' apikey]
  for 
keyvalue in queryparams.items():
    
query.appendkey '=' urllib.quote_plus(value) )
  return 
'&'.join([ str(i) for i in query ])

def downloadmoviesetartwork_type_filenames ):
  
log'downloader: Searching for collection: ' movieset['label'] )
  
baseurl _download_base_url()
  
artwork = {}
  
  
search _download_getjson'search/collection'queryparams={'query'movieset['label']} )
  if 
search['total_results'] == 1:
    
data search['results'][0]
    
    
'''
    Might be a nice implementation later -
    present a choice to the user
    
    data = _download_getjson( '
collection/%s/images', data['id'] )
    '''
    
    
if data['poster_path']:
      
artwork[ARTWORK_TYPE_POSTER] = baseurl data['poster_path']
    if 
data['backdrop_path']:
      
artwork[ARTWORK_TYPE_FANART] = baseurl data['backdrop_path']
  else:
    
log'downloader: Error while matching collection: ' movieset['label'] )
    return 
0
  
  
if bool(artwork):
    for 
artwork_typeartwork_link in artwork.items():
      
log'downloader: Found type ' artwork_type ' link: ' artwork_link )
    return 
artwork
  
else:
    
log'downloader: No artwork in collection: ' movieset['label'] )
    return 


You would call download() to get the object of downloaded files, and use that to update the DB.
Actually, this works already, without downloading the files!... not quite sure how, but looks like once the update is made in the DB, the images are downloaded by XBMC the first time they are requested by the gui (in movie lists).

Thoughts?


RE: [RELEASE] Movie Set Artwork Automator - andyd - 2014-10-19

(2014-02-09, 00:50)Milhouse Wrote: Edit the database version in script.moviesetart.frodo/lib/database.py:
Code:
DATABASE_VERSION_GOTHAM = "78"

Hi. Is someone able to refresh my memory on what needs to change here?

Do we remove the Frodo line entirely?

Does this line need to change as well?

result["name"] = "MyVideos%s" % DATABASE_VERSION_FRODO

It would be great if this was added to the original post. I can't figure out why the addin stopped actually making updates. Even though it seems like it was successful in scanning ( mentions finding 18 sets and updating for 15 ) nothing actually happens.

If I'm using SQL to link multiple clients, can this mess things up?


RE: [RELEASE] Movie Set Artwork Automator - EtgarDizz - 2014-10-19

Since there's no link for code, I uploaded to GitHub and branched out.
Welcome to download and try with the new TMDB-download feature (make sure to use the new branch).
@trentf & all: feedback is welcome!

TODO: improve the selectlist in dialog_msg, to display icon images.
That way the user could preview the collection in the collection selection dialog. Also will be used to add ability to choose the downloaded artwork.

https://github.com/amitkeret/script.moviesetart.frodo/commits/20141013-amitk-downloadTMDBartwork


RE: [RELEASE] Movie Set Artwork Automator - andyd - 2014-10-19

Not sure if your post was in response to mine but I deleted the OP addon and installed this - same issue.

I've also tried changing the jpg name from poster.jpg to the movie set name - poster ( eg. The Godfather Trilogy - poster.jpg )

And it seems to also have the same default setting using Frodo


RE: [RELEASE] Movie Set Artwork Automator - Milhouse - 2014-10-19

Any reason you can't upgrade to Gotham? Frodo isn't going to get much love going forward.


RE: [RELEASE] Movie Set Artwork Automator - andyd - 2014-10-19

Me? I'm using the latest XBMC version available


Re: RE: [RELEASE] Movie Set Artwork Automator - Milhouse - 2014-10-19

(2014-10-19, 20:08)andyd Wrote: Me? I'm using the latest XBMC version available

Sorry, thought you were asking about Frodo earlier.


RE: [RELEASE] Movie Set Artwork Automator - andyd - 2014-10-20

No worries and thanks!


RE: [RELEASE] Movie Set Artwork Automator - Edworld - 2014-10-20

I spent some quality time making this work and just couldn't do it.

Each of my movies has its own folder with the following structure:

E:movies(bluray)\toy story\toy story.mkv (there is no artwork in this folder)
E:movies(bluray)\toy story2\toy story2.mkv (there is no artwork in this folder)
E:movies(bluray)\toy story3\toy story3.mkv (there is no artwork in this folder)

I created a new folder for movie set art work automator and copies the posters with the following structure:

D:artwork\toy story-poster.jpg
D:artwork\toy story2-poster.jpg
D:artwork\toy story3-poster.jpg

Movie set automator goes to: D:Artwork

Any ideas on what I'm doing wrong?


RE: [RELEASE] Movie Set Artwork Automator - AnthonyJS02 - 2014-10-20

(2014-10-20, 02:45)Edworld Wrote: I spent some quality time making this work and just couldn't do it.

Each of my movies has its own folder with the following structure:

E:movies(bluray)\toy story\toy story.mkv (there is no artwork in this folder)
E:movies(bluray)\toy story2\toy story2.mkv (there is no artwork in this folder)
E:movies(bluray)\toy story3\toy story3.mkv (there is no artwork in this folder)

I created a new folder for movie set art work automator and copies the posters with the following structure:

D:artwork\toy story-poster.jpg
D:artwork\toy story2-poster.jpg
D:artwork\toy story3-poster.jpg

Movie set automator goes to: D:Artwork

Any ideas on what I'm doing wrong?




This is for sets not individual movies. You want artwork downloader.


RE: [RELEASE] Movie Set Artwork Automator - Edworld - 2014-10-20

@AnthonyJS02

I already downloaded the artwork for the movie sets and save does jpg's in the artwork folder using the file names below:

D:artwork\toy story-poster.jpg
D:artwork\toy story2-poster.jpg
D:artwork\toy story3-poster.jpg

I run movieset automator and doesn't do anything


Re: RE: [RELEASE] Movie Set Artwork Automator - andyd - 2014-10-20

(2014-10-19, 18:28)andyd Wrote:
(2014-02-09, 00:50)Milhouse Wrote: Edit the database version in script.moviesetart.frodo/lib/database.py:
Code:
DATABASE_VERSION_GOTHAM = "78"

Hi. Is someone able to refresh my memory on what needs to change here?

Do we remove the Frodo line entirely?

Does this line need to change as well?

result["name"] = "MyVideos%s" % DATABASE_VERSION_FRODO

It would be great if this was added to the original post. I can't figure out why the addin stopped actually making updates. Even though it seems like it was successful in scanning ( mentions finding 18 sets and updating for 15 ) nothing actually happens.

If I'm using SQL to link multiple clients, can this mess things up?

You can ignore me for now. Looks like this might have been due to my mistakes.


RE: [RELEASE] Movie Set Artwork Automator - wgstarks - 2014-10-20

(2014-10-20, 04:25)Edworld Wrote: @AnthonyJS02

I already downloaded the artwork for the movie sets and save does jpg's in the artwork folder using the file names below:

D:artwork\toy story-poster.jpg
D:artwork\toy story2-poster.jpg
D:artwork\toy story3-poster.jpg

I run movieset automator and doesn't do anything

I don't believe your file structure is valid. You can either place all the video folders and the set art in a parent folder that is named to match the set name or you can use a custom folder for your set art and include the set name in the file name for the art. The first post in this thread has more complete instructions and examples. This script will only set artwork for movie sets. If you want artwork for individual movies you need Artwork Downloader.


RE: [RELEASE] Movie Set Artwork Automator - Ic3y - 2014-10-20

(2014-10-20, 04:25)Edworld Wrote: @AnthonyJS02

I already downloaded the artwork for the movie sets and save does jpg's in the artwork folder using the file names below:

D:artwork\toy story-poster.jpg
D:artwork\toy story2-poster.jpg
D:artwork\toy story3-poster.jpg

I run movieset automator and doesn't do anything

As mentioned before if you are looking to apply artwork for individual movies, you use Artwork Downloader addon.

If you are trying to apply artwork for the Toy Story Set or Collection, you need to download the art manually, place it in your D:\Artwork folder and name it: "Toy Story Collection-poster.jpg", then run the Movie Set Artwork Automator addon.

Good luck !