Update subliminal
This commit is contained in:
1 parent
79e842951e
commit
d3f5f1408e
18 files changed
+1235
-238
No files matched your search
@@ -16,10 +16,9 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with subliminal. If not, see <http://www.gnu.org/licenses/>.
|
||||
from . import ServiceBase
|
||||
from ..language import language_set
|
||||
from ..subtitles import get_subtitle_path, ResultSubtitle
|
||||
from ..videos import Episode, Movie, UnknownVideo
|
||||
from guessit.language import lang_set
|
||||
import guessit
|
||||
import logging
|
||||
|
||||
|
||||
@@ -27,13 +26,13 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TheSubDB(ServiceBase):
|
||||
server_url = 'http://api.thesubdb.com/' # for testing purpose, use http://sandbox.thesubdb.com/ instead
|
||||
user_agent = 'SubDB/1.0 (subliminal/0.6; https://github.com/Diaoul/subliminal)' # defined by the API
|
||||
server_url = 'http://api.thesubdb.com'
|
||||
user_agent = 'SubDB/1.0 (subliminal/0.6; https://github.com/Diaoul/subliminal)'
|
||||
api_based = True
|
||||
languages = lang_set(['af', 'cs', 'da', 'de', 'en', 'es', 'fi',
|
||||
'fr', 'hu', 'id', 'it', 'la', 'nl', 'no',
|
||||
'oc', 'pl', 'pt', 'ro', 'ru', 'sl', 'sr',
|
||||
'sv', 'tr'], strict=True) # list available with the API at http://sandbox.thesubdb.com/?action=languages
|
||||
# Source: http://api.thesubdb.com/?action=languages
|
||||
languages = language_set(['af', 'cs', 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'id', 'it',
|
||||
'la', 'nl', 'no', 'oc', 'pl', 'pt', 'ro', 'ru', 'sl', 'sr', 'sv',
|
||||
'tr'])
|
||||
videos = [Movie, Episode, UnknownVideo]
|
||||
require_video = True
|
||||
|
||||
@@ -48,7 +47,7 @@ class TheSubDB(ServiceBase):
|
||||
if r.status_code != 200:
|
||||
logger.error(u'Request %s returned status code %d' % (r.url, r.status_code))
|
||||
return []
|
||||
available_languages = set(guessit.Language(l) for l in r.content.split(','))
|
||||
available_languages = language_set(r.content.split(','))
|
||||
languages &= available_languages
|
||||
if not languages:
|
||||
logger.debug(u'Could not find subtitles for hash %s with languages %r (only %r available)' % (moviehash, languages, available_languages))
|
||||
|
||||
Reference in new issue
Block a user