diff --git a/couchpotato/core/downloaders/nzbget.py b/couchpotato/core/downloaders/nzbget.py index b46de778..54725bd5 100644 --- a/couchpotato/core/downloaders/nzbget.py +++ b/couchpotato/core/downloaders/nzbget.py @@ -163,12 +163,12 @@ class NZBGet(DownloaderBase): nzb_id = nzb['NZBID'] if nzb_id in ids: - log.debug('Found %s in NZBGet history. ParStatus: %s, ScriptStatus: %s, Log: %s', (nzb['NZBFilename'] , nzb['ParStatus'], nzb['ScriptStatus'] , nzb['Log'])) + log.debug('Found %s in NZBGet history. TotalStatus: %s, ParStatus: %s, ScriptStatus: %s, Log: %s', (nzb['NZBFilename'] , nzb['Status'], nzb['ParStatus'], nzb['ScriptStatus'] , nzb['Log'])) release_downloads.append({ 'id': nzb_id, 'name': nzb['NZBFilename'], - 'status': 'completed' if nzb['ParStatus'] in ['SUCCESS', 'NONE'] and nzb['ScriptStatus'] in ['SUCCESS', 'NONE'] else 'failed', - 'original_status': nzb['ParStatus'] + ', ' + nzb['ScriptStatus'], + 'status': 'completed' if 'SUCCESS' in nzb['Status'] else 'failed', + 'original_status': nzb['Status'], 'timeleft': str(timedelta(seconds = 0)), 'folder': sp(nzb['DestDir']) }) diff --git a/couchpotato/core/media/_base/providers/torrent/hdbits.py b/couchpotato/core/media/_base/providers/torrent/hdbits.py index ebf2899b..f29fd157 100644 --- a/couchpotato/core/media/_base/providers/torrent/hdbits.py +++ b/couchpotato/core/media/_base/providers/torrent/hdbits.py @@ -29,6 +29,9 @@ class Base(TorrentProvider): } post_data.update(params) + if self.conf('internal_only'): + post_data.update({'origin': [1]}) + try: result = self.getJsonData(self.urls['api'], data = json.dumps(post_data)) @@ -110,6 +113,14 @@ config = [{ 'default': 0, 'description': 'Starting score for each release found via this provider.', }, + { + 'name': 'internal_only', + 'advanced': True, + 'label': 'Internal Only', + 'type': 'bool', + 'default': False, + 'description': 'Only download releases marked as HDBits internal' + } ], }, ], diff --git a/couchpotato/core/media/_base/providers/torrent/kickasstorrents.py b/couchpotato/core/media/_base/providers/torrent/kickasstorrents.py index d6e3ee72..fb58814d 100644 --- a/couchpotato/core/media/_base/providers/torrent/kickasstorrents.py +++ b/couchpotato/core/media/_base/providers/torrent/kickasstorrents.py @@ -30,7 +30,7 @@ class Base(TorrentMagnetProvider): cat_backup_id = None proxy_list = [ - 'https://kickass.to', + 'https://kickass.so', 'http://kickass.pw', 'http://kickassto.come.in', 'http://katproxy.ws', diff --git a/couchpotato/core/media/_base/providers/torrent/yify.py b/couchpotato/core/media/_base/providers/torrent/yify.py index 0daf20a0..725aabbc 100644 --- a/couchpotato/core/media/_base/providers/torrent/yify.py +++ b/couchpotato/core/media/_base/providers/torrent/yify.py @@ -12,17 +12,16 @@ class Base(TorrentMagnetProvider): urls = { 'test': '%s/api', - 'search': '%s/api/list.json?keywords=%s&quality=%s', + 'search': '%s/api/list.json?keywords=%s', 'detail': '%s/api/movie.json?id=%s' } http_time_between_calls = 1 # seconds proxy_list = [ - 'http://yify.unlocktorrent.com', - 'http://yify-torrents.com.come.in', - 'http://yts.re', - 'http://yts.im' + 'https://yts.re', + 'http://ytsproxy.come.in', + 'http://yts.im', 'http://yify-torrents.im', ] @@ -39,7 +38,7 @@ class Base(TorrentMagnetProvider): if not domain: return - search_url = self.urls['search'] % (domain, getIdentifier(movie), quality['identifier']) + search_url = self.urls['search'] % (domain, getIdentifier(movie)) data = self.getJsonData(search_url) diff --git a/couchpotato/core/media/movie/_base/main.py b/couchpotato/core/media/movie/_base/main.py index 1b0881b5..48a66b05 100755 --- a/couchpotato/core/media/movie/_base/main.py +++ b/couchpotato/core/media/movie/_base/main.py @@ -65,7 +65,7 @@ class MovieBase(MovieTypeBase): return False elif not params.get('info'): try: - is_movie = fireEvent('movie.is_movie', identifier = params.get('identifier'), single = True) + is_movie = fireEvent('movie.is_movie', identifier = params.get('identifier'), adding = True, single = True) if not is_movie: msg = 'Can\'t add movie, seems to be a TV show.' log.error(msg) diff --git a/couchpotato/core/media/movie/providers/info/couchpotatoapi.py b/couchpotato/core/media/movie/providers/info/couchpotatoapi.py index 51afbaef..92b3fb3f 100644 --- a/couchpotato/core/media/movie/providers/info/couchpotatoapi.py +++ b/couchpotato/core/media/movie/providers/info/couchpotatoapi.py @@ -69,12 +69,15 @@ class CouchPotatoApi(MovieProvider): name_enc = base64.b64encode(ss(name)) return self.getJsonData(self.urls['validate'] % name_enc, headers = self.getRequestHeaders()) - def isMovie(self, identifier = None): + def isMovie(self, identifier = None, adding = False): if not identifier: return - data = self.getJsonData(self.urls['is_movie'] % identifier, headers = self.getRequestHeaders()) + url = self.urls['is_movie'] % identifier + url += '?adding=1' if adding else '' + + data = self.getJsonData(url, headers = self.getRequestHeaders()) if data: return data.get('is_movie', True) diff --git a/couchpotato/core/plugins/subtitle.py b/couchpotato/core/plugins/subtitle.py index fdb640b1..1766088e 100644 --- a/couchpotato/core/plugins/subtitle.py +++ b/couchpotato/core/plugins/subtitle.py @@ -16,7 +16,7 @@ autoload = 'Subtitle' class Subtitle(Plugin): - services = ['opensubtitles', 'thesubdb', 'subswiki', 'podnapisi'] + services = ['opensubtitles', 'thesubdb', 'subswiki', 'podnapisi', 'subscenter'] def __init__(self): addEvent('renamer.before', self.searchSingle) diff --git a/couchpotato/static/scripts/page/settings.js b/couchpotato/static/scripts/page/settings.js index b5aae3d1..9d083a1f 100644 --- a/couchpotato/static/scripts/page/settings.js +++ b/couchpotato/static/scripts/page/settings.js @@ -886,6 +886,9 @@ Option.Directory = new Class({ 'text': 'Selected folder is empty' }).inject(self.dir_list) + //fix for webkit type browsers to refresh the dom for the file browser + //http://stackoverflow.com/questions/3485365/how-can-i-force-webkit-to-redraw-repaint-to-propagate-style-changes + self.dir_list.setStyle('webkitTransform', 'scale(1)'); self.caretAtEnd(); }, diff --git a/init/ubuntu b/init/ubuntu index 8c5d556a..a21e2d34 100755 --- a/init/ubuntu +++ b/init/ubuntu @@ -33,8 +33,8 @@ DESC=CouchPotato ## ## CP_USER= #$RUN_AS, username to run couchpotato under, the default is couchpotato ## CP_HOME= #$APP_PATH, the location of couchpotato.py, the default is /opt/couchpotato -## CP_DATA= #$DATA_DIR, the location of couchpotato.db, cache, logs, the default is /var/couchpotato -## CP_PIDFILE= #$PID_FILE, the location of couchpotato.pid, the default is /var/run/couchpotato.pid +## CP_DATA= #$DATA_DIR, the location of couchpotato.db, cache, logs, the default is /var/opt/couchpotato +## CP_PIDFILE= #$PID_FILE, the location of couchpotato.pid, the default is /var/run/couchpotato/couchpotato.pid ## PYTHON_BIN= #$DAEMON, the location of the python binary, the default is /usr/bin/python ## CP_OPTS= #$EXTRA_DAEMON_OPTS, extra cli option for couchpotato, i.e. " --config_file=/home/couchpotato/couchpotato.ini" ## SSD_OPTS= #$EXTRA_SSD_OPTS, extra start-stop-daemon option like " --group=users" @@ -51,10 +51,10 @@ RUN_AS=${CP_USER-couchpotato} APP_PATH=${CP_HOME-/opt/couchpotato/} # Data directory where couchpotato.db, cache and logs are stored -DATA_DIR=${CP_DATA-/var/couchpotato} +DATA_DIR=${CP_DATA-/var/opt/couchpotato} # Path to store PID file -PID_FILE=${CP_PIDFILE-/var/run/couchpotato.pid} +PID_FILE=${CP_PIDFILE-/var/run/couchpotato/couchpotato.pid} # path to python bin DAEMON=${PYTHON_BIN-/usr/bin/python} diff --git a/libs/subliminal/core.py b/libs/subliminal/core.py index 537fa655..66619683 100755 --- a/libs/subliminal/core.py +++ b/libs/subliminal/core.py @@ -32,7 +32,7 @@ __all__ = ['SERVICES', 'LANGUAGE_INDEX', 'SERVICE_INDEX', 'SERVICE_CONFIDENCE', 'create_list_tasks', 'create_download_tasks', 'consume_task', 'matching_confidence', 'key_subtitles', 'group_by_video'] logger = logging.getLogger(__name__) -SERVICES = ['opensubtitles', 'bierdopje', 'subswiki', 'subtitulos', 'thesubdb', 'addic7ed', 'tvsubtitles'] +SERVICES = ['opensubtitles', 'bierdopje', 'subswiki', 'subtitulos', 'thesubdb', 'addic7ed', 'tvsubtitles', 'subscenter'] LANGUAGE_INDEX, SERVICE_INDEX, SERVICE_CONFIDENCE, MATCHING_CONFIDENCE = range(4) diff --git a/libs/subliminal/services/subscenter.py b/libs/subliminal/services/subscenter.py new file mode 100644 index 00000000..6eeafa27 --- /dev/null +++ b/libs/subliminal/services/subscenter.py @@ -0,0 +1,100 @@ +# -*- coding: utf-8 -*- +# Copyright 2012 Ofir Brukner +# +# This file is part of subliminal. +# +# subliminal is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# subliminal is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with subliminal. If not, see . +import logging +import re +import json +from . import ServiceBase +from ..exceptions import ServiceError +from ..language import language_set +from ..subtitles import get_subtitle_path, ResultSubtitle +from ..videos import Episode, Movie +from ..utils import to_unicode, get_keywords + + +logger = logging.getLogger(__name__) + + +class Subscenter(ServiceBase): + server_url = 'http://subscenter.cinemast.com/he/' + api_based = False + languages = language_set(['he', 'en']) + videos = [Episode, Movie] + require_video = False + required_features = ['permissive'] + + @staticmethod + def slugify(string): + new_string = string.replace(' ', '-').replace("'", '').replace(':', '').lower() + # We remove multiple spaces by using this regular expression. + return re.sub('-+', '-', new_string) + + def list_checked(self, video, languages): + series = None + season = None + episode = None + title = video.title + if isinstance(video, Episode): + series = video.series + season = video.season + episode = video.episode + return self.query(video.path or video.release, languages, get_keywords(video.guess), series, season, + episode, title) + + def query(self, filepath, languages=None, keywords=None, series=None, season=None, episode=None, title=None): + logger.debug(u'Getting subtitles for %s season %d episode %d with languages %r' % (series, season, episode, languages)) + # Converts the title to Subscenter format by replacing whitespaces and removing specific chars. + if series and season and episode: + # Search for a TV show. + kind = 'episode' + slugified_series = self.slugify(series) + url = self.server_url + 'cinemast/data/series/sb/' + slugified_series + '/' + str(season) + '/' + \ + str(episode) + '/' + elif title: + # Search for a movie. + kind = 'movie' + slugified_title = self.slugify(title) + url = self.server_url + 'cinemast/data/movie/sb/' + slugified_title + '/' + else: + raise ServiceError('One or more parameters are missing') + logger.debug('Searching subtitles %r', {'title': title, 'season': season, 'episode': episode}) + response = self.session.get(url) + if response.status_code != 200: + raise ServiceError('Request failed with status code %d' % response.status_code) + + subtitles = [] + response_json = json.loads(response.content) + for lang, lang_json in response_json.items(): + lang_obj = self.get_language(lang) + if lang_obj in self.languages and lang_obj in languages: + for group_data in lang_json.values(): + for quality in group_data.values(): + for sub in quality.values(): + release = sub.get('subtitle_version') + sub_path = get_subtitle_path(filepath, lang_obj, self.config.multi) + link = self.server_url + 'subtitle/download/' + lang + '/' + str(sub.get('id')) + \ + '/?v=' + release + '&key=' + str(sub.get('key')) + subtitles.append(ResultSubtitle(sub_path, lang_obj, self.__class__.__name__.lower(), + link, release=to_unicode(release))) + return subtitles + + def download(self, subtitle): + self.download_zip_file(subtitle.link, subtitle.path) + return subtitle + + +Service = Subscenter \ No newline at end of file diff --git a/libs/synchronousdeluge/transfer.py b/libs/synchronousdeluge/transfer.py index 979ffb16..472bb125 100644 --- a/libs/synchronousdeluge/transfer.py +++ b/libs/synchronousdeluge/transfer.py @@ -19,7 +19,7 @@ class DelugeTransfer(object): self.disconnect() self.sock = socket.create_connection(hostport) - self.conn = ssl.wrap_socket(self.sock, None, None, False, ssl.CERT_NONE, ssl.PROTOCOL_SSLv3) + self.conn = ssl.wrap_socket(self.sock, None, None, False, ssl.CERT_NONE, ssl.PROTOCOL_TLSv1) self.connected = True def disconnect(self):