[RELEASE] Movie Set Artwork Automator

  Thread Rating:
  • 3 Votes - 4.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
EtgarDizz Offline
Member
Posts: 80
Joined: Jul 2013
Reputation: 1
Post: #346
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.
(This post was last modified: 2014-10-12 10:40 by EtgarDizz.)
find quote
EtgarDizz Offline
Member
Posts: 80
Joined: Jul 2013
Reputation: 1
Post: #347
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?
(This post was last modified: 2014-10-12 21:13 by EtgarDizz.)
find quote
andyd Online
Senior Member
Posts: 261
Joined: Nov 2004
Reputation: 0
Post: #348
(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?
find quote
EtgarDizz Offline
Member
Posts: 80
Joined: Jul 2013
Reputation: 1
Post: #349
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.movi...MDBartwork
find quote
andyd Online
Senior Member
Posts: 261
Joined: Nov 2004
Reputation: 0
Post: #350
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
find quote
Milhouse Offline
Team-Kodi Member
Posts: 4,175
Joined: Jan 2011
Reputation: 94
Post: #351
Any reason you can't upgrade to Gotham? Frodo isn't going to get much love going forward.

Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
find quote
andyd Online
Senior Member
Posts: 261
Joined: Nov 2004
Reputation: 0
Post: #352
Me? I'm using the latest XBMC version available
find quote
Milhouse Offline
Team-Kodi Member
Posts: 4,175
Joined: Jan 2011
Reputation: 94
Post: #353
(Yesterday 20:08)andyd Wrote:  Me? I'm using the latest XBMC version available

Sorry, thought you were asking about Frodo earlier.

Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
find quote
andyd Online
Senior Member
Posts: 261
Joined: Nov 2004
Reputation: 0
Post: #354
No worries and thanks!
find quote
Edworld Offline
Junior Member
Posts: 24
Joined: Sep 2014
Reputation: 0
Post: #355
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?
find quote
AnthonyJS02 Offline
Senior Member
Posts: 202
Joined: Jan 2013
Reputation: 0
Post: #356
(Today 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.

HTPC Basement: i3 3225, Asrock z77 pro4m, 8gb Crucial DDR3 1600, Samsung 840 120gb SSD, Silverstone GD05B Case

HTPC Livingroom: WIP

Server: UnRaid: Intel G550, Asrock B75 pro3m, 4gb ram, Parity Drive 3tb WD Red, Data 2 x 2tb WD Red, Cache 1tb WD Blue, Fractal Design XL R2 Case
(This post was last modified: Today 03:42 by AnthonyJS02.)
find quote
Edworld Offline
Junior Member
Posts: 24
Joined: Sep 2014
Reputation: 0
Post: #357
@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
find quote
andyd Online
Senior Member
Posts: 261
Joined: Nov 2004
Reputation: 0
Post: #358
(Yesterday 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.
find quote
Post Reply