From d0da98a86b4762af0302f8c298c38b67831b4b42 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 6 Nov 2011 23:55:16 +0100 Subject: [PATCH] Thumbnail fix for searcher --- couchpotato/core/helpers/variable.py | 10 ++++------ couchpotato/core/plugins/movie/main.py | 2 +- couchpotato/core/plugins/movie/static/movie.css | 3 +++ couchpotato/core/providers/metadata/xbmc/main.py | 1 - couchpotato/core/providers/movie/themoviedb/main.py | 6 +++--- couchpotato/static/scripts/page/about.js | 2 +- libs/themoviedb/tmdb.py | 10 ++++++++-- 7 files changed, 20 insertions(+), 14 deletions(-) diff --git a/couchpotato/core/helpers/variable.py b/couchpotato/core/helpers/variable.py index 7645e80b..3e78cde5 100644 --- a/couchpotato/core/helpers/variable.py +++ b/couchpotato/core/helpers/variable.py @@ -5,13 +5,11 @@ import re def getDataDir(): - # Windows - try: - from win32com.shell import shellcon, shell - return os.path.join(shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0), 'CouchPotato') + dir = os.path.expanduser("~") - except ImportError: - dir = os.path.expanduser("~") + # Windows + if os.name == 'nt': + return os.path.join(dir, 'CouchPotato') # OSX if 'darwin' in platform.platform().lower(): diff --git a/couchpotato/core/plugins/movie/main.py b/couchpotato/core/plugins/movie/main.py index 1b57135c..d4faf68f 100644 --- a/couchpotato/core/plugins/movie/main.py +++ b/couchpotato/core/plugins/movie/main.py @@ -85,7 +85,7 @@ class MoviePlugin(Plugin): params = getParams() cache_key = '%s/%s' % (__name__, urlencode(params)) - movies = None#Env.get('cache').get(cache_key) + movies = Env.get('cache').get(cache_key) if not movies: movies = fireEvent('movie.search', q = params.get('q'), merge = True) diff --git a/couchpotato/core/plugins/movie/static/movie.css b/couchpotato/core/plugins/movie/static/movie.css index 067ebfd7..0bff19f1 100644 --- a/couchpotato/core/plugins/movie/static/movie.css +++ b/couchpotato/core/plugins/movie/static/movie.css @@ -53,6 +53,9 @@ -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.35); line-height: 0; } + .movies .data .poster img, .options .poster img { + width: 100%; + } .movies .info { float: right; diff --git a/couchpotato/core/providers/metadata/xbmc/main.py b/couchpotato/core/providers/metadata/xbmc/main.py index 3fb321c7..0f83e7b3 100644 --- a/couchpotato/core/providers/metadata/xbmc/main.py +++ b/couchpotato/core/providers/metadata/xbmc/main.py @@ -1,4 +1,3 @@ -from couchpotato.core.event import fireEvent from couchpotato.core.helpers.encoding import toUnicode from couchpotato.core.providers.metadata.base import MetaDataBase from xml.etree.ElementTree import Element, SubElement, tostring diff --git a/couchpotato/core/providers/movie/themoviedb/main.py b/couchpotato/core/providers/movie/themoviedb/main.py index aaad0db5..f44cba59 100644 --- a/couchpotato/core/providers/movie/themoviedb/main.py +++ b/couchpotato/core/providers/movie/themoviedb/main.py @@ -175,13 +175,13 @@ class TheMovieDb(MovieProvider): def getImage(self, movie, type = 'poster', size = 'thumb'): - image = '' + image_url = '' for image in movie.get('images', []): if(image.get('type') == type) and image.get(size): - image = image.get(size) + image_url = image.get(size) break - return image + return image_url def getCategory(self, movie, type = 'genre'): diff --git a/couchpotato/static/scripts/page/about.js b/couchpotato/static/scripts/page/about.js index b07d88b6..c6e334d1 100644 --- a/couchpotato/static/scripts/page/about.js +++ b/couchpotato/static/scripts/page/about.js @@ -69,7 +69,7 @@ var AboutSettingTab = new Class({ ), new Element('div.donate', { 'html': - 'Or, buy me an instant (24 pack) Pepsi, for while I\'m coding ;)' + + 'Or, buy me a (24 pack) Pepsi, for while I\'m coding ;)' + '
' + '' + '' + diff --git a/libs/themoviedb/tmdb.py b/libs/themoviedb/tmdb.py index 7df6e70d..0ad16264 100644 --- a/libs/themoviedb/tmdb.py +++ b/libs/themoviedb/tmdb.py @@ -193,10 +193,13 @@ class ImagesList(list): size = image_et.get("size") url = image_et.get("url") cur = self.find_by('id', _id) + if len(cur) == 0: nimg = Image(_id = _id, _type = _type, size = size, url = url) self.append(nimg) - elif len(cur) == 1: + cur = self.find_by('id', _id) + + if len(cur) == 1: cur[0][size] = url else: raise ValueError("Found more than one poster with id %s, this should never happen" % (_id)) @@ -261,6 +264,9 @@ class MovieDb: cur_images.set(subitem) else: cur_movie[item.tag] = item.text + + print cur_images.posters + cur_movie['images'] = cur_images return cur_movie @@ -423,7 +429,7 @@ class tmdb: # Shortcuts for imdb lookup method # using: # movie = tmdb.imdb("Sin City") -# print movie.getRating -> 7.0 +# print movie.getRating -> 7.0 class imdb: def __init__(self, id = 0, title = False): # get first movie if result=0