diff --git a/couchpotato/core/_base/updater/main.py b/couchpotato/core/_base/updater/main.py index 44ceebdd..88d22816 100644 --- a/couchpotato/core/_base/updater/main.py +++ b/couchpotato/core/_base/updater/main.py @@ -62,7 +62,7 @@ class Updater(Plugin): self.autoUpdate() # Check after enabling def autoUpdate(self): - if self.check() and self.conf('automatic') and not self.updater.update_failed: + if self.isEnabled() and self.check() and self.conf('automatic') and not self.updater.update_failed: if self.updater.doUpdate(): # Notify before restarting diff --git a/couchpotato/core/notifications/plex/__init__.py b/couchpotato/core/notifications/plex/__init__.py index 8d89a40f..c00ea6d4 100644 --- a/couchpotato/core/notifications/plex/__init__.py +++ b/couchpotato/core/notifications/plex/__init__.py @@ -22,6 +22,13 @@ config = [{ 'description': 'Default should be on localhost', 'advanced': True, }, + { + 'name': 'on_snatch', + 'default': 0, + 'type': 'bool', + 'advanced': True, + 'description': 'Also send message when movie is snatched.', + }, ], } ], diff --git a/couchpotato/core/notifications/xbmc/__init__.py b/couchpotato/core/notifications/xbmc/__init__.py index 0753c82a..a4808458 100644 --- a/couchpotato/core/notifications/xbmc/__init__.py +++ b/couchpotato/core/notifications/xbmc/__init__.py @@ -31,6 +31,13 @@ config = [{ 'default': '', 'type': 'password', }, + { + 'name': 'on_snatch', + 'default': 0, + 'type': 'bool', + 'advanced': True, + 'description': 'Also send message when movie is snatched.', + }, ], } ], diff --git a/couchpotato/core/plugins/movie/static/list.js b/couchpotato/core/plugins/movie/static/list.js index 28195543..1b11fab5 100644 --- a/couchpotato/core/plugins/movie/static/list.js +++ b/couchpotato/core/plugins/movie/static/list.js @@ -63,7 +63,8 @@ var MovieList = new Class({ self.movies.each(function(movie){ if(movie.get('id') == notification.data.id){ movie.destroy(); - delete self.movies_added[notification.data.id] + delete self.movies_added[notification.data.id]; + self.setCounter(self.counter_count-1); } }) } @@ -77,6 +78,7 @@ var MovieList = new Class({ if(self.options.add_new && !self.movies_added[notification.data.id] && notification.data.status.identifier == self.options.status){ window.scroll(0,0); self.createMovie(notification.data, 'top'); + self.setCounter(self.counter_count+1); self.checkIfEmpty(); } @@ -126,6 +128,7 @@ var MovieList = new Class({ if(!self.navigation_counter) return; + self.counter_count = count; self.navigation_counter.set('text', (count || 0) + ' movies'); if (self.empty_message) { @@ -236,7 +239,11 @@ var MovieList = new Class({ self.changeView(el.get('data-view')); this.addClass(a); - el.inject(el.getParent(), 'top') + el.inject(el.getParent(), 'top'); + el.getSiblings().hide() + setTimeout(function(){ + el.getSiblings().setStyle('display', null); + }, 100) } } }), @@ -373,14 +380,14 @@ var MovieList = new Class({ self.movies.each(function(movie){ if (movie.isSelected()){ $(movie).destroy() - erase_movies.include(movie) + erase_movies.include(movie); } }); erase_movies.each(function(movie){ self.movies.erase(movie); - - movie.destroy() + movie.destroy(); + self.setCounter(self.counter_count-1); }); self.calculateSelected(); diff --git a/couchpotato/core/plugins/movie/static/movie.css b/couchpotato/core/plugins/movie/static/movie.css index 37cdcdf4..8327d294 100644 --- a/couchpotato/core/plugins/movie/static/movie.css +++ b/couchpotato/core/plugins/movie/static/movie.css @@ -268,6 +268,11 @@ top: 0; margin: 0; } + .touch_enabled .movies.list_list .info .title { + display: inline-block; + padding-right: 55px; + } + .movies .info .title span { display: inline-block; text-overflow: ellipsis; @@ -339,6 +344,10 @@ right: auto; color: #FFF; } + + .touch_enabled .movies.list_list .movie .info .year { + font-size: 1em; + } .movies .info .description { top: 30px; @@ -367,6 +376,13 @@ display: none; } + .touch_enabled .movies.list_list .movie .data .quality { + position: relative; + display: inline-block; + margin: 0; + top: -4px; + } + @media all and (max-width: 480px) { .movies .data .quality { display: none; @@ -439,7 +455,8 @@ } } - .movies .movie:hover .data .actions { + .movies .movie:hover .data .actions, + .touch_enabled .movies .movie .data .actions { opacity: 1; display: inline-block; } @@ -486,7 +503,8 @@ } .movies.list_list .movie:not(.details_view):hover .actions, - .movies.mass_edit_list .movie:hover .actions { + .movies.mass_edit_list .movie:hover .actions, + .touch_enabled .movies.list_list .movie:not(.details_view) .actions { margin: 0; background: #4e5969; top: 2px; @@ -504,8 +522,6 @@ left: 120px; right: 0; } - .movies .delete_container .cancel { - } .movies .delete_container .or { padding: 10px; } @@ -676,6 +692,9 @@ height: 100%; top: 0; } + .touch_enabled .movies .movie .trynext { + display: none; + } @media all and (max-width: 480px) { .movies .movie .trynext { @@ -686,7 +705,8 @@ .wanted .movies .movie .trynext { padding-right: 30px; } - .movies .movie:hover .trynext { + .movies .movie:hover .trynext, + .touch_enabled .movies.details_list .movie .trynext { opacity: 1; } @@ -717,7 +737,8 @@ .movies .movie .trynext a:last-child { margin: 0; } - .movies .movie .trynext a:hover { + .movies .movie .trynext a:hover, + .touch_enabled .movies .movie .trynext a { background-color: #369545; } diff --git a/couchpotato/core/plugins/quality/main.py b/couchpotato/core/plugins/quality/main.py index 60853763..f300e592 100644 --- a/couchpotato/core/plugins/quality/main.py +++ b/couchpotato/core/plugins/quality/main.py @@ -164,7 +164,6 @@ class QualityPlugin(Plugin): if cached and extra is {}: return cached for cur_file in files: - size = (os.path.getsize(cur_file) / 1024 / 1024) if os.path.isfile(cur_file) else 0 words = re.split('\W+', cur_file.lower()) for quality in self.all(): diff --git a/couchpotato/core/plugins/renamer/main.py b/couchpotato/core/plugins/renamer/main.py index 30a57a7b..dd0ea46b 100644 --- a/couchpotato/core/plugins/renamer/main.py +++ b/couchpotato/core/plugins/renamer/main.py @@ -204,6 +204,7 @@ class Renamer(Plugin): cd = 1 if multiple else 0 for current_file in sorted(list(group['files'][file_type])): + current_file = toUnicode(current_file) # Original filename replacements['original'] = os.path.splitext(os.path.basename(current_file))[0] diff --git a/couchpotato/core/providers/base.py b/couchpotato/core/providers/base.py index 809ec616..72bf42a6 100644 --- a/couchpotato/core/providers/base.py +++ b/couchpotato/core/providers/base.py @@ -62,7 +62,7 @@ class Provider(Plugin): cache_key = '%s%s' % (md5(url), md5('%s' % kwargs.get('params', {}))) data = self.getCache(cache_key, url, **kwargs) - if data: + if data and len(data) > 0: try: data = XMLTree.fromstring(data) return self.getElements(data, item_path) diff --git a/couchpotato/core/providers/movie/_modifier/main.py b/couchpotato/core/providers/movie/_modifier/main.py index 12d1e325..148d9035 100644 --- a/couchpotato/core/providers/movie/_modifier/main.py +++ b/couchpotato/core/providers/movie/_modifier/main.py @@ -4,6 +4,7 @@ from couchpotato.core.helpers.variable import mergeDicts, randomString from couchpotato.core.logger import CPLog from couchpotato.core.plugins.base import Plugin from couchpotato.core.settings.model import Library +import copy import traceback log = CPLog(__name__) @@ -11,6 +12,25 @@ log = CPLog(__name__) class MovieResultModifier(Plugin): + default_info = { + 'tmdb_id': 0, + 'titles': [], + 'original_title': '', + 'year': 0, + 'images': { + 'poster': [], + 'backdrop': [], + 'poster_original': [], + 'backdrop_original': [] + }, + 'runtime': 0, + 'plot': '', + 'tagline': '', + 'imdb': '', + 'genres': [], + 'release_date': {} + } + def __init__(self): addEvent('result.modify.movie.search', self.combineOnIMDB) addEvent('result.modify.movie.info', self.checkLibrary) @@ -67,6 +87,9 @@ class MovieResultModifier(Plugin): return temp def checkLibrary(self, result): + + result = mergeDicts(copy.deepcopy(self.default_info), copy.deepcopy(result)) + if result and result.get('imdb'): return mergeDicts(result, self.getLibraryTags(result['imdb'])) return result diff --git a/couchpotato/core/providers/movie/couchpotatoapi/main.py b/couchpotato/core/providers/movie/couchpotatoapi/main.py index 3646d1f0..24a4be7b 100644 --- a/couchpotato/core/providers/movie/couchpotatoapi/main.py +++ b/couchpotato/core/providers/movie/couchpotatoapi/main.py @@ -70,7 +70,8 @@ class CouchPotatoApi(MovieProvider): return result = self.getJsonData(self.urls['info'] % identifier, headers = self.getRequestHeaders()) - if result: return result + if result: + return dict((k, v) for k, v in result.iteritems() if v) return {} diff --git a/couchpotato/core/providers/movie/omdbapi/main.py b/couchpotato/core/providers/movie/omdbapi/main.py index cdfece0a..89990747 100644 --- a/couchpotato/core/providers/movie/omdbapi/main.py +++ b/couchpotato/core/providers/movie/omdbapi/main.py @@ -86,7 +86,7 @@ class OMDBAPI(MovieProvider): movie_data = { 'via_imdb': True, 'titles': [movie.get('Title')] if movie.get('Title') else [], - 'original_title': movie.get('Title', ''), + 'original_title': movie.get('Title'), 'images': { 'poster': [movie.get('Poster', '')] if movie.get('Poster') and len(movie.get('Poster', '')) > 4 else [], }, @@ -96,14 +96,15 @@ class OMDBAPI(MovieProvider): }, 'imdb': str(movie.get('imdbID', '')), 'runtime': self.runtimeToMinutes(movie.get('Runtime', '')), - 'released': movie.get('Released', ''), + 'released': movie.get('Released'), 'year': year if isinstance(year, (int)) else None, - 'plot': movie.get('Plot', ''), + 'plot': movie.get('Plot'), 'genres': splitString(movie.get('Genre', '')), 'directors': splitString(movie.get('Director', '')), 'writers': splitString(movie.get('Writer', '')), 'actors': splitString(movie.get('Actors', '')), } + movie_data = dict((k, v) for k, v in movie_data.iteritems() if v) except: log.error('Failed parsing IMDB API json: %s', traceback.format_exc()) diff --git a/couchpotato/core/providers/movie/themoviedb/main.py b/couchpotato/core/providers/movie/themoviedb/main.py index 0554a901..43eb22b3 100644 --- a/couchpotato/core/providers/movie/themoviedb/main.py +++ b/couchpotato/core/providers/movie/themoviedb/main.py @@ -170,11 +170,12 @@ class TheMovieDb(MovieProvider): 'runtime': movie.get('runtime'), 'released': movie.get('released'), 'year': year, - 'plot': movie.get('overview', ''), - 'tagline': '', + 'plot': movie.get('overview'), 'genres': genres, } + movie_data = dict((k, v) for k, v in movie_data.iteritems() if v) + # Add alternative names for alt in ['original_name', 'alternative_name']: alt_name = toUnicode(movie.get(alt)) diff --git a/couchpotato/core/providers/nzb/ftdworld/main.py b/couchpotato/core/providers/nzb/ftdworld/main.py index bd2a3ee2..caecadad 100644 --- a/couchpotato/core/providers/nzb/ftdworld/main.py +++ b/couchpotato/core/providers/nzb/ftdworld/main.py @@ -3,7 +3,6 @@ from couchpotato.core.helpers.variable import tryInt from couchpotato.core.logger import CPLog from couchpotato.core.providers.nzb.base import NZBProvider from couchpotato.environment import Env -from dateutil.parser import parse import json import traceback diff --git a/couchpotato/core/providers/torrent/thepiratebay/main.py b/couchpotato/core/providers/torrent/thepiratebay/main.py index db63a231..10608157 100644 --- a/couchpotato/core/providers/torrent/thepiratebay/main.py +++ b/couchpotato/core/providers/torrent/thepiratebay/main.py @@ -53,7 +53,7 @@ class ThePirateBay(TorrentMagnetProvider): while page < total_pages: - search_url = self.urls['search'] % (self.getDomain(), tryUrlencode('"%s %s"' % (title, movie['library']['year'])), page, self.getCatId(quality['identifier'])[0]) + search_url = self.urls['search'] % (self.getDomain(), tryUrlencode('"%s" %s' % (title, movie['library']['year'])), page, self.getCatId(quality['identifier'])[0]) page += 1 data = self.getHTMLData(search_url) diff --git a/couchpotato/static/scripts/couchpotato.js b/couchpotato/static/scripts/couchpotato.js index 25bddb4e..8e6ccede 100644 --- a/couchpotato/static/scripts/couchpotato.js +++ b/couchpotato/static/scripts/couchpotato.js @@ -30,6 +30,12 @@ var CouchPotato = new Class({ History.addEvent('change', self.openPage.bind(self)); self.c.addEvent('click:relay(a[href^=/]:not([target]))', self.pushState.bind(self)); self.c.addEvent('click:relay(a[href^=http])', self.openDerefered.bind(self)); + + // Check if device is touchenabled + self.touch_device = 'ontouchstart' in document.documentElement; + if(self.touch_device) + self.c.addClass('touch_enabled'); + }, getOption: function(name){ diff --git a/couchpotato/static/style/main.css b/couchpotato/static/style/main.css index 39aa2693..97983130 100644 --- a/couchpotato/static/style/main.css +++ b/couchpotato/static/style/main.css @@ -35,11 +35,21 @@ input:focus, textarea:focus { outline: none; } -input:-moz-placeholder, textarea:-moz-placeholder { - color: rgba(255, 255, 255, 0.6); +::-moz-placeholder { + color: rgba(255, 255, 255, 0.5); + font-style: italic; } -::-webkit-input-placeholder, ::-webkit-textarea-placeholder { - color: rgba(255, 255, 255, 0.6); +input:-moz-placeholder { + color: rgba(255, 255, 255, 0.5); + font-style: italic; +} +::-webkit-input-placeholder { + color: rgba(255, 255, 255, 0.5); + font-style: italic; +} +:-ms-input-placeholder { + color: rgba(255, 255, 255, 0.5) !important; + font-style: italic; } a img {