Merge branch 'develop'

This commit is contained in:
Ruud
2014-12-01 12:58:18 +01:00
12 changed files with 136 additions and 20 deletions

View File

@@ -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'])
})

View File

@@ -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'
}
],
},
],

View File

@@ -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',

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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();
},

View File

@@ -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}

View File

@@ -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)

View File

@@ -0,0 +1,100 @@
# -*- coding: utf-8 -*-
# Copyright 2012 Ofir Brukner <ofirbrukner@gmail.com>
#
# 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 <http://www.gnu.org/licenses/>.
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

View File

@@ -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):