You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.4 KiB

Support for downloading extra artwork from Fanart.tv (resolves #1023). New image types include: * clearart * discart * extrathumbs * extrafanart * logo * banner * landscape (16:9 Thumb) There are a couple things that should be noted: 1. Only English images will be downloaded. 2. The fanart image is now downloaded from Fanart.tv if it can find one, otherwise it uses TMDB like it used to. This is because the images on Fanart.tv tend to be higher resolutions & quality. 3. Since multiple extrathumbs and extrafanarts are downloaded into a subdirectory, subdirectories are now supported for metadata file names. The subdirectories will be automatically created if they don't exist. 4. Bluray discart will always be preferred over DVD. Ideally, it would prefer DVD versions for SD quality movies, but I couldn't find an easy way to determine the quality from within the plugin. I suspect major changes would be needed to the plugin system in general in order to get this to work. If a user cares about the distinction, the best work-around is to not download these in Couchpotato and run the Artwork Downloader addon from within XBMC. 5. A maximum of 4 extrathumbs and 20 extrafanarts will be downloaded. Squashed commit of the following: commit b113a4def197a9ca8545bde9f5081c0591b93b36 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Thu Apr 24 14:24:12 2014 -0500 Bug-fix and code cleanup. Fixed a bug where the movie.info event would crash if there aren't any pictures to scrape in fanart.tv. commit adf7a4675d472e9e95a316c6cccc681a52804f13 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 16:15:03 2014 -0500 Added support for extrafanart. Also, the main fanart will be taken from fanart.tv unless one does not exist. commit 1791e46c8602f40bb56fe0cf7ecb0607f35b4b12 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 15:13:14 2014 -0500 Couchpotato now downloads extrathumbs from the extra tmdb backdrops if they exist. This commit made some major changes to the core image creation functionality that makes writing multiple images to folders possible. commit c0858807873749dbc928c0260037138f51f894ca Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 12:18:53 2014 -0500 Bug Fix & Implemented functionality to select bluray or dvd disc images. Currently, only blurays will be selected, unless there are no blurays. However, if a mechanism for determining the quality of the release is implemented, it would be simple to make this selection based on the quality. commit 786751371d243f53d0f5c6f2c38d92288d8608ba Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 10:59:25 2014 -0500 Fixed a bug where non-HD clearart and logos couldn't be downloaded. commit feda8df483d13b5a5df3a869f25de8f2c7e6ffe3 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 10:12:31 2014 -0500 Fixed some problems that were missed with the previous merge. commit 5ddab6c40e69a5accc6c0336cd7485920ff82d8f Merge: 7273abf ff46aa0 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 10:02:11 2014 -0500 Merge branch 'develop' into fanarttv Conflicts: couchpotato/core/media/movie/providers/info/themoviedb.py couchpotato/core/providers/metadata/xbmc/__init__.py commit 7273abf827735cf245711c3d3199a6a173a964aa Author: dan <dan@DBoehm-Arch.danboehm> Date: Thu Feb 27 13:29:57 2014 -0600 Downloads extra artwork from fanart.tv Downloads occur with correct filenaming when XBMC metadata is generated, but the image URLs are selected when the movie.info event is called. commit 9080d9d749c7e1ddbdc78f7b37a3c5f83195d580 Author: dan <dan@DBoehm-Arch.danboehm> Date: Wed Feb 26 16:31:37 2014 -0600 Added basic functionality for fanarttv provider. This should be mostly done and is based on the tvdb provider. commit 1b39b246c2a9d65f9ef86c4e150a12d893e362c0 Author: dan <dan@DBoehm-Arch.danboehm> Date: Wed Feb 26 14:50:17 2014 -0600 Updated fanarttv library with the correct package hierarchy (libs.fanarttv). commit 8abb7c8f8ad3347900debb9f6a6d5a7acb7df396 Author: dan <dan@DBoehm-Arch.danboehm> Date: Wed Feb 26 13:12:48 2014 -0600 Added fanart.tv API python library (lib.fanarttv). The upstream for this library is at https://github.com/z4r/python-fanart.
11 years ago
import libs.requests as requests
import libs.fanarttv as fanart
from libs.fanarttv.errors import RequestFanartError, ResponseFanartError
class Request(object):
def __init__(self, apikey, id, ws, type=None, sort=None, limit=None):
self._apikey = apikey
self._id = id
self._ws = ws
self._type = type or fanart.TYPE.ALL
self._sort = sort or fanart.SORT.POPULAR
self._limit = limit or fanart.LIMIT.ALL
self.validate()
self._response = None
def validate(self):
for attribute_name in ('ws', 'type', 'sort', 'limit'):
attribute = getattr(self, '_' + attribute_name)
choices = getattr(fanart, attribute_name.upper() + '_LIST')
if attribute not in choices:
raise RequestFanartError('Not allowed {0}: {1} [{2}]'.format(attribute_name, attribute, ', '.join(choices)))
def __str__(self):
return '/'.join(map(str, [
fanart.BASEURL,
self._ws,
self._apikey,
self._id,
fanart.FORMAT.JSON,
self._type,
self._sort,
self._limit,
]))
def response(self):
try:
response = requests.get(str(self))
rjson = response.json()
if not isinstance(rjson, dict):
raise Exception(response.text)
return rjson
except Exception as e:
raise ResponseFanartError(str(e))