Merge branch 'refs/heads/develop'

This commit is contained in:
Ruud
2013-05-19 01:19:53 +02:00
16 changed files with 109 additions and 26 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ class Updater(Plugin):
self.autoUpdate() # Check after enabling self.autoUpdate() # Check after enabling
def autoUpdate(self): 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(): if self.updater.doUpdate():
# Notify before restarting # Notify before restarting
@@ -22,6 +22,13 @@ config = [{
'description': 'Default should be on localhost', 'description': 'Default should be on localhost',
'advanced': True, 'advanced': True,
}, },
{
'name': 'on_snatch',
'default': 0,
'type': 'bool',
'advanced': True,
'description': 'Also send message when movie is snatched.',
},
], ],
} }
], ],
@@ -31,6 +31,13 @@ config = [{
'default': '', 'default': '',
'type': 'password', 'type': 'password',
}, },
{
'name': 'on_snatch',
'default': 0,
'type': 'bool',
'advanced': True,
'description': 'Also send message when movie is snatched.',
},
], ],
} }
], ],
+12 -5
View File
@@ -63,7 +63,8 @@ var MovieList = new Class({
self.movies.each(function(movie){ self.movies.each(function(movie){
if(movie.get('id') == notification.data.id){ if(movie.get('id') == notification.data.id){
movie.destroy(); 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){ if(self.options.add_new && !self.movies_added[notification.data.id] && notification.data.status.identifier == self.options.status){
window.scroll(0,0); window.scroll(0,0);
self.createMovie(notification.data, 'top'); self.createMovie(notification.data, 'top');
self.setCounter(self.counter_count+1);
self.checkIfEmpty(); self.checkIfEmpty();
} }
@@ -126,6 +128,7 @@ var MovieList = new Class({
if(!self.navigation_counter) return; if(!self.navigation_counter) return;
self.counter_count = count;
self.navigation_counter.set('text', (count || 0) + ' movies'); self.navigation_counter.set('text', (count || 0) + ' movies');
if (self.empty_message) { if (self.empty_message) {
@@ -236,7 +239,11 @@ var MovieList = new Class({
self.changeView(el.get('data-view')); self.changeView(el.get('data-view'));
this.addClass(a); 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){ self.movies.each(function(movie){
if (movie.isSelected()){ if (movie.isSelected()){
$(movie).destroy() $(movie).destroy()
erase_movies.include(movie) erase_movies.include(movie);
} }
}); });
erase_movies.each(function(movie){ erase_movies.each(function(movie){
self.movies.erase(movie); self.movies.erase(movie);
movie.destroy();
movie.destroy() self.setCounter(self.counter_count-1);
}); });
self.calculateSelected(); self.calculateSelected();
@@ -268,6 +268,11 @@
top: 0; top: 0;
margin: 0; margin: 0;
} }
.touch_enabled .movies.list_list .info .title {
display: inline-block;
padding-right: 55px;
}
.movies .info .title span { .movies .info .title span {
display: inline-block; display: inline-block;
text-overflow: ellipsis; text-overflow: ellipsis;
@@ -339,6 +344,10 @@
right: auto; right: auto;
color: #FFF; color: #FFF;
} }
.touch_enabled .movies.list_list .movie .info .year {
font-size: 1em;
}
.movies .info .description { .movies .info .description {
top: 30px; top: 30px;
@@ -367,6 +376,13 @@
display: none; 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) { @media all and (max-width: 480px) {
.movies .data .quality { .movies .data .quality {
display: none; display: none;
@@ -439,7 +455,8 @@
} }
} }
.movies .movie:hover .data .actions { .movies .movie:hover .data .actions,
.touch_enabled .movies .movie .data .actions {
opacity: 1; opacity: 1;
display: inline-block; display: inline-block;
} }
@@ -486,7 +503,8 @@
} }
.movies.list_list .movie:not(.details_view):hover .actions, .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; margin: 0;
background: #4e5969; background: #4e5969;
top: 2px; top: 2px;
@@ -504,8 +522,6 @@
left: 120px; left: 120px;
right: 0; right: 0;
} }
.movies .delete_container .cancel {
}
.movies .delete_container .or { .movies .delete_container .or {
padding: 10px; padding: 10px;
} }
@@ -676,6 +692,9 @@
height: 100%; height: 100%;
top: 0; top: 0;
} }
.touch_enabled .movies .movie .trynext {
display: none;
}
@media all and (max-width: 480px) { @media all and (max-width: 480px) {
.movies .movie .trynext { .movies .movie .trynext {
@@ -686,7 +705,8 @@
.wanted .movies .movie .trynext { .wanted .movies .movie .trynext {
padding-right: 30px; padding-right: 30px;
} }
.movies .movie:hover .trynext { .movies .movie:hover .trynext,
.touch_enabled .movies.details_list .movie .trynext {
opacity: 1; opacity: 1;
} }
@@ -717,7 +737,8 @@
.movies .movie .trynext a:last-child { .movies .movie .trynext a:last-child {
margin: 0; margin: 0;
} }
.movies .movie .trynext a:hover { .movies .movie .trynext a:hover,
.touch_enabled .movies .movie .trynext a {
background-color: #369545; background-color: #369545;
} }
-1
View File
@@ -164,7 +164,6 @@ class QualityPlugin(Plugin):
if cached and extra is {}: return cached if cached and extra is {}: return cached
for cur_file in files: 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()) words = re.split('\W+', cur_file.lower())
for quality in self.all(): for quality in self.all():
+1
View File
@@ -204,6 +204,7 @@ class Renamer(Plugin):
cd = 1 if multiple else 0 cd = 1 if multiple else 0
for current_file in sorted(list(group['files'][file_type])): for current_file in sorted(list(group['files'][file_type])):
current_file = toUnicode(current_file)
# Original filename # Original filename
replacements['original'] = os.path.splitext(os.path.basename(current_file))[0] replacements['original'] = os.path.splitext(os.path.basename(current_file))[0]
+1 -1
View File
@@ -62,7 +62,7 @@ class Provider(Plugin):
cache_key = '%s%s' % (md5(url), md5('%s' % kwargs.get('params', {}))) cache_key = '%s%s' % (md5(url), md5('%s' % kwargs.get('params', {})))
data = self.getCache(cache_key, url, **kwargs) data = self.getCache(cache_key, url, **kwargs)
if data: if data and len(data) > 0:
try: try:
data = XMLTree.fromstring(data) data = XMLTree.fromstring(data)
return self.getElements(data, item_path) return self.getElements(data, item_path)
@@ -4,6 +4,7 @@ from couchpotato.core.helpers.variable import mergeDicts, randomString
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin from couchpotato.core.plugins.base import Plugin
from couchpotato.core.settings.model import Library from couchpotato.core.settings.model import Library
import copy
import traceback import traceback
log = CPLog(__name__) log = CPLog(__name__)
@@ -11,6 +12,25 @@ log = CPLog(__name__)
class MovieResultModifier(Plugin): 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): def __init__(self):
addEvent('result.modify.movie.search', self.combineOnIMDB) addEvent('result.modify.movie.search', self.combineOnIMDB)
addEvent('result.modify.movie.info', self.checkLibrary) addEvent('result.modify.movie.info', self.checkLibrary)
@@ -67,6 +87,9 @@ class MovieResultModifier(Plugin):
return temp return temp
def checkLibrary(self, result): def checkLibrary(self, result):
result = mergeDicts(copy.deepcopy(self.default_info), copy.deepcopy(result))
if result and result.get('imdb'): if result and result.get('imdb'):
return mergeDicts(result, self.getLibraryTags(result['imdb'])) return mergeDicts(result, self.getLibraryTags(result['imdb']))
return result return result
@@ -70,7 +70,8 @@ class CouchPotatoApi(MovieProvider):
return return
result = self.getJsonData(self.urls['info'] % identifier, headers = self.getRequestHeaders()) 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 {} return {}
@@ -86,7 +86,7 @@ class OMDBAPI(MovieProvider):
movie_data = { movie_data = {
'via_imdb': True, 'via_imdb': True,
'titles': [movie.get('Title')] if movie.get('Title') else [], 'titles': [movie.get('Title')] if movie.get('Title') else [],
'original_title': movie.get('Title', ''), 'original_title': movie.get('Title'),
'images': { 'images': {
'poster': [movie.get('Poster', '')] if movie.get('Poster') and len(movie.get('Poster', '')) > 4 else [], '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', '')), 'imdb': str(movie.get('imdbID', '')),
'runtime': self.runtimeToMinutes(movie.get('Runtime', '')), 'runtime': self.runtimeToMinutes(movie.get('Runtime', '')),
'released': movie.get('Released', ''), 'released': movie.get('Released'),
'year': year if isinstance(year, (int)) else None, 'year': year if isinstance(year, (int)) else None,
'plot': movie.get('Plot', ''), 'plot': movie.get('Plot'),
'genres': splitString(movie.get('Genre', '')), 'genres': splitString(movie.get('Genre', '')),
'directors': splitString(movie.get('Director', '')), 'directors': splitString(movie.get('Director', '')),
'writers': splitString(movie.get('Writer', '')), 'writers': splitString(movie.get('Writer', '')),
'actors': splitString(movie.get('Actors', '')), 'actors': splitString(movie.get('Actors', '')),
} }
movie_data = dict((k, v) for k, v in movie_data.iteritems() if v)
except: except:
log.error('Failed parsing IMDB API json: %s', traceback.format_exc()) log.error('Failed parsing IMDB API json: %s', traceback.format_exc())
@@ -170,11 +170,12 @@ class TheMovieDb(MovieProvider):
'runtime': movie.get('runtime'), 'runtime': movie.get('runtime'),
'released': movie.get('released'), 'released': movie.get('released'),
'year': year, 'year': year,
'plot': movie.get('overview', ''), 'plot': movie.get('overview'),
'tagline': '',
'genres': genres, 'genres': genres,
} }
movie_data = dict((k, v) for k, v in movie_data.iteritems() if v)
# Add alternative names # Add alternative names
for alt in ['original_name', 'alternative_name']: for alt in ['original_name', 'alternative_name']:
alt_name = toUnicode(movie.get(alt)) alt_name = toUnicode(movie.get(alt))
@@ -3,7 +3,6 @@ from couchpotato.core.helpers.variable import tryInt
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
from couchpotato.core.providers.nzb.base import NZBProvider from couchpotato.core.providers.nzb.base import NZBProvider
from couchpotato.environment import Env from couchpotato.environment import Env
from dateutil.parser import parse
import json import json
import traceback import traceback
@@ -53,7 +53,7 @@ class ThePirateBay(TorrentMagnetProvider):
while page < total_pages: 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 page += 1
data = self.getHTMLData(search_url) data = self.getHTMLData(search_url)
@@ -30,6 +30,12 @@ var CouchPotato = new Class({
History.addEvent('change', self.openPage.bind(self)); 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^=/]:not([target]))', self.pushState.bind(self));
self.c.addEvent('click:relay(a[href^=http])', self.openDerefered.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){ getOption: function(name){
+14 -4
View File
@@ -35,11 +35,21 @@ input:focus, textarea:focus {
outline: none; outline: none;
} }
input:-moz-placeholder, textarea:-moz-placeholder { ::-moz-placeholder {
color: rgba(255, 255, 255, 0.6); color: rgba(255, 255, 255, 0.5);
font-style: italic;
} }
::-webkit-input-placeholder, ::-webkit-textarea-placeholder { input:-moz-placeholder {
color: rgba(255, 255, 255, 0.6); 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 { a img {