mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Code improvements for the indexer API handler and a few code cleanups as well.
This commit is contained in:
parent
00e29a1ef5
commit
f2bbe76271
@ -29,12 +29,13 @@ import urllib
|
|||||||
from threading import Lock
|
from threading import Lock
|
||||||
|
|
||||||
# apparently py2exe won't build these unless they're imported somewhere
|
# apparently py2exe won't build these unless they're imported somewhere
|
||||||
|
from sickbeard import indexers
|
||||||
|
from indexers import indexer_api, indexer_exceptions, indexer_config
|
||||||
from sickbeard import providers, metadata
|
from sickbeard import providers, metadata
|
||||||
from providers import ezrss, tvtorrents, btn, newznab, womble, thepiratebay, torrentleech, kat, publichd, iptorrents, omgwtfnzbs, scc, hdtorrents, torrentday, hdbits, nextgen
|
from providers import ezrss, tvtorrents, btn, newznab, womble, thepiratebay, torrentleech, kat, publichd, iptorrents, omgwtfnzbs, scc, hdtorrents, torrentday, hdbits, nextgen
|
||||||
from sickbeard.config import CheckSection, check_setting_int, check_setting_str, ConfigMigrator
|
from sickbeard.config import CheckSection, check_setting_int, check_setting_str, ConfigMigrator
|
||||||
|
|
||||||
from sickbeard import searchCurrent, searchBacklog, showUpdater, versionChecker, properFinder, autoPostProcesser, subtitles, traktWatchListChecker
|
from sickbeard import searchCurrent, searchBacklog, showUpdater, versionChecker, properFinder, autoPostProcesser, subtitles, traktWatchListChecker
|
||||||
from sickbeard import helpers, db, exceptions, show_queue, search_queue, scheduler
|
from sickbeard import helpers, db, exceptions, show_queue, search_queue, scheduler, show_name_helpers
|
||||||
from sickbeard import logger
|
from sickbeard import logger
|
||||||
from sickbeard import naming
|
from sickbeard import naming
|
||||||
|
|
||||||
@ -146,10 +147,6 @@ NAMING_CUSTOM_ABD = None
|
|||||||
NAMING_FORCE_FOLDERS = False
|
NAMING_FORCE_FOLDERS = False
|
||||||
NAMING_STRIP_YEAR = None
|
NAMING_STRIP_YEAR = None
|
||||||
|
|
||||||
TVDB_API_KEY = '9DAF49C96CBF8DAC'
|
|
||||||
TVDB_BASE_URL = None
|
|
||||||
INDEXER_API_PARMS = {}
|
|
||||||
|
|
||||||
USE_NZBS = None
|
USE_NZBS = None
|
||||||
USE_TORRENTS = None
|
USE_TORRENTS = None
|
||||||
|
|
||||||
@ -467,8 +464,8 @@ def initialize(consoleLogging=True):
|
|||||||
USE_PUSHALOT, PUSHALOT_NOTIFY_ONSNATCH, PUSHALOT_NOTIFY_ONDOWNLOAD, PUSHALOT_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHALOT_AUTHORIZATIONTOKEN, \
|
USE_PUSHALOT, PUSHALOT_NOTIFY_ONSNATCH, PUSHALOT_NOTIFY_ONDOWNLOAD, PUSHALOT_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHALOT_AUTHORIZATIONTOKEN, \
|
||||||
USE_PUSHBULLET, PUSHBULLET_NOTIFY_ONSNATCH, PUSHBULLET_NOTIFY_ONDOWNLOAD, PUSHBULLET_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHBULLET_API, PUSHBULLET_DEVICE, \
|
USE_PUSHBULLET, PUSHBULLET_NOTIFY_ONSNATCH, PUSHBULLET_NOTIFY_ONDOWNLOAD, PUSHBULLET_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHBULLET_API, PUSHBULLET_DEVICE, \
|
||||||
versionCheckScheduler, VERSION_NOTIFY, PROCESS_AUTOMATICALLY, UNPACK, \
|
versionCheckScheduler, VERSION_NOTIFY, PROCESS_AUTOMATICALLY, UNPACK, \
|
||||||
KEEP_PROCESSED_DIR, PROCESS_METHOD, TV_DOWNLOAD_DIR, TVDB_BASE_URL, MIN_SEARCH_FREQUENCY, \
|
KEEP_PROCESSED_DIR, PROCESS_METHOD, TV_DOWNLOAD_DIR, MIN_SEARCH_FREQUENCY, \
|
||||||
showQueueScheduler, searchQueueScheduler, ROOT_DIRS, CACHE_DIR, ACTUAL_CACHE_DIR, INDEXER_API_PARMS, \
|
showQueueScheduler, searchQueueScheduler, ROOT_DIRS, CACHE_DIR, ACTUAL_CACHE_DIR, \
|
||||||
NAMING_PATTERN, NAMING_MULTI_EP, NAMING_FORCE_FOLDERS, NAMING_ABD_PATTERN, NAMING_CUSTOM_ABD, NAMING_STRIP_YEAR, \
|
NAMING_PATTERN, NAMING_MULTI_EP, NAMING_FORCE_FOLDERS, NAMING_ABD_PATTERN, NAMING_CUSTOM_ABD, NAMING_STRIP_YEAR, \
|
||||||
RENAME_EPISODES, properFinderScheduler, PROVIDER_ORDER, autoPostProcesserScheduler, \
|
RENAME_EPISODES, properFinderScheduler, PROVIDER_ORDER, autoPostProcesserScheduler, \
|
||||||
WOMBLE, OMGWTFNZBS, OMGWTFNZBS_USERNAME, OMGWTFNZBS_APIKEY, providerList, newznabProviderList, torrentRssProviderList,\
|
WOMBLE, OMGWTFNZBS, OMGWTFNZBS_USERNAME, OMGWTFNZBS_APIKEY, providerList, newznabProviderList, torrentRssProviderList,\
|
||||||
@ -580,14 +577,6 @@ def initialize(consoleLogging=True):
|
|||||||
elif 'ftp' in proxies:
|
elif 'ftp' in proxies:
|
||||||
proxy_url = proxies['ftp']
|
proxy_url = proxies['ftp']
|
||||||
|
|
||||||
# Set our common indexer_api options here
|
|
||||||
INDEXER_API_PARMS = {'apikey': TVDB_API_KEY,
|
|
||||||
'language': 'en',
|
|
||||||
'useZip': True}
|
|
||||||
|
|
||||||
if CACHE_DIR:
|
|
||||||
INDEXER_API_PARMS['cache'] = os.path.join(CACHE_DIR, 'tvdb')
|
|
||||||
|
|
||||||
QUALITY_DEFAULT = check_setting_int(CFG, 'General', 'quality_default', SD)
|
QUALITY_DEFAULT = check_setting_int(CFG, 'General', 'quality_default', SD)
|
||||||
STATUS_DEFAULT = check_setting_int(CFG, 'General', 'status_default', SKIPPED)
|
STATUS_DEFAULT = check_setting_int(CFG, 'General', 'status_default', SKIPPED)
|
||||||
VERSION_NOTIFY = check_setting_int(CFG, 'General', 'version_notify', 1)
|
VERSION_NOTIFY = check_setting_int(CFG, 'General', 'version_notify', 1)
|
||||||
@ -602,8 +591,6 @@ def initialize(consoleLogging=True):
|
|||||||
NAMING_FORCE_FOLDERS = naming.check_force_season_folders()
|
NAMING_FORCE_FOLDERS = naming.check_force_season_folders()
|
||||||
NAMING_STRIP_YEAR = bool(check_setting_int(CFG, 'General', 'naming_strip_year', 0))
|
NAMING_STRIP_YEAR = bool(check_setting_int(CFG, 'General', 'naming_strip_year', 0))
|
||||||
|
|
||||||
TVDB_BASE_URL = 'http://thetvdb.com/api/' + TVDB_API_KEY
|
|
||||||
|
|
||||||
USE_NZBS = bool(check_setting_int(CFG, 'General', 'use_nzbs', 0))
|
USE_NZBS = bool(check_setting_int(CFG, 'General', 'use_nzbs', 0))
|
||||||
USE_TORRENTS = bool(check_setting_int(CFG, 'General', 'use_torrents', 1))
|
USE_TORRENTS = bool(check_setting_int(CFG, 'General', 'use_torrents', 1))
|
||||||
|
|
||||||
|
@ -351,11 +351,13 @@ def searchIndexersForShow(regShowName):
|
|||||||
for indexer in indexerStrings:
|
for indexer in indexerStrings:
|
||||||
logger.log(u"Trying to find the " + name + " on " + indexer, logger.DEBUG)
|
logger.log(u"Trying to find the " + name + " on " + indexer, logger.DEBUG)
|
||||||
|
|
||||||
# try each indexer till we find a match
|
|
||||||
sickbeard.INDEXER_API_PARMS['indexer'] = indexer
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
t = indexer_api.indexerApi(custom_ui=classes.ShowListUI, **sickbeard.INDEXER_API_PARMS)
|
lINDEXER_API_PARMS = {'indexer': indexer}
|
||||||
|
|
||||||
|
lINDEXER_API_PARMS['search_all_languages'] = True
|
||||||
|
lINDEXER_API_PARMS['custom_ui'] = classes.ShowListUI
|
||||||
|
|
||||||
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
showObj = t[name]
|
showObj = t[name]
|
||||||
return indexer
|
return indexer
|
||||||
except (indexer_exceptions.indexer_exception, IOError):
|
except (indexer_exceptions.indexer_exception, IOError):
|
||||||
@ -363,10 +365,13 @@ def searchIndexersForShow(regShowName):
|
|||||||
try:
|
try:
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
# There's gotta be a better way of doing this but we don't wanna
|
||||||
# change the language value elsewhere
|
# change the language value elsewhere
|
||||||
lINDEXER_API_PARMS = sickbeard.INDEXER_API_PARMS.copy()
|
|
||||||
|
lINDEXER_API_PARMS = {'indexer': indexer}
|
||||||
|
|
||||||
lINDEXER_API_PARMS['search_all_languages'] = True
|
lINDEXER_API_PARMS['search_all_languages'] = True
|
||||||
t = indexer_api.indexerApi(custom_ui=classes.ShowListUI, **lINDEXER_API_PARMS)
|
lINDEXER_API_PARMS['custom_ui'] = classes.ShowListUI
|
||||||
|
|
||||||
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
showObj = t[name]
|
showObj = t[name]
|
||||||
return indexer
|
return indexer
|
||||||
except (indexer_exceptions.indexer_exception, IOError):
|
except (indexer_exceptions.indexer_exception, IOError):
|
||||||
@ -954,23 +959,23 @@ def get_show_by_name(name, showList, useIndexer=False):
|
|||||||
return show
|
return show
|
||||||
|
|
||||||
if useIndexer:
|
if useIndexer:
|
||||||
showResult = None
|
|
||||||
for indexer in indexerStrings:
|
for indexer in indexerStrings:
|
||||||
# try each indexer till we find a match
|
|
||||||
sickbeard.INDEXER_API_PARMS['indexer'] = indexer
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
t = indexer_api.indexerApi(custom_ui=classes.ShowListUI, **sickbeard.INDEXER_API_PARMS)
|
lINDEXER_API_PARMS = {'indexer': indexer}
|
||||||
|
|
||||||
|
lINDEXER_API_PARMS['custom_ui'] = classes.ShowListUI
|
||||||
|
|
||||||
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
showObj = t[name]
|
showObj = t[name]
|
||||||
except (indexer_exceptions.indexer_exception, IOError):
|
except (indexer_exceptions.indexer_exception, IOError):
|
||||||
# if none found, search on all languages
|
# if none found, search on all languages
|
||||||
try:
|
try:
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
lINDEXER_API_PARMS = {'indexer': indexer}
|
||||||
# change the language value elsewhere
|
|
||||||
lINDEXER_API_PARMS = sickbeard.INDEXER_API_PARMS.copy()
|
|
||||||
|
|
||||||
lINDEXER_API_PARMS['search_all_languages'] = True
|
lINDEXER_API_PARMS['search_all_languages'] = True
|
||||||
t = indexer_api.indexerApi(custom_ui=classes.ShowListUI, **lINDEXER_API_PARMS)
|
lINDEXER_API_PARMS['custom_ui'] = classes.ShowListUI
|
||||||
|
|
||||||
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
showObj = t[name]
|
showObj = t[name]
|
||||||
except (indexer_exceptions.indexer_exception, IOError):
|
except (indexer_exceptions.indexer_exception, IOError):
|
||||||
pass
|
pass
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
# Author: Nic Wolfe <nic@wolfeden.ca>
|
||||||
|
# URL: http://code.google.com/p/sickbeard/
|
||||||
|
#
|
||||||
|
# This file is part of Sick Beard.
|
||||||
|
#
|
||||||
|
# Sick Beard is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# Sick Beard 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 General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
__all__ = ["indexer_api", "indexer_exceptions", "indexer_config"]
|
@ -15,7 +15,11 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
|
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
import os
|
||||||
|
|
||||||
|
import sickbeard
|
||||||
|
|
||||||
|
from indexer_config import *
|
||||||
from lib.tvdb_api.tvdb_api import Tvdb
|
from lib.tvdb_api.tvdb_api import Tvdb
|
||||||
from lib.tvrage_api.tvrage_api import TVRage
|
from lib.tvrage_api.tvrage_api import TVRage
|
||||||
|
|
||||||
@ -26,33 +30,18 @@ class indexerApi:
|
|||||||
return object.__new__(new_type)
|
return object.__new__(new_type)
|
||||||
|
|
||||||
def __init__(self, indexer=None, language=None, *args, **kwargs):
|
def __init__(self, indexer=None, language=None, *args, **kwargs):
|
||||||
|
self.name = indexer
|
||||||
|
self.config = INDEXER_CONFIG.copy()
|
||||||
|
|
||||||
|
# wrap the indexer API object and return it back
|
||||||
if indexer is not None:
|
if indexer is not None:
|
||||||
self.name = indexer
|
if sickbeard.CACHE_DIR:
|
||||||
self._wrapped = eval(indexer)(*args, **kwargs)
|
INDEXER_API_PARMS[indexer]['cache'] = os.path.join(sickbeard.CACHE_DIR, indexer)
|
||||||
else:
|
|
||||||
self.name = "Indexer"
|
|
||||||
|
|
||||||
self.config = {}
|
lINDEXER_API_PARMS = INDEXER_API_PARMS[indexer].copy()
|
||||||
|
lINDEXER_API_PARMS.update(**kwargs)
|
||||||
|
|
||||||
self.config['valid_languages'] = [
|
self._wrapped = eval(indexer)(*args, **lINDEXER_API_PARMS)
|
||||||
"da", "fi", "nl", "de", "it", "es", "fr","pl", "hu","el","tr",
|
|
||||||
"ru","he","ja","pt","zh","cs","sl", "hr","ko","en","sv","no"
|
|
||||||
]
|
|
||||||
|
|
||||||
self.config['langabbv_to_id'] = {'el': 20, 'en': 7, 'zh': 27,
|
|
||||||
'it': 15, 'cs': 28, 'es': 16, 'ru': 22, 'nl': 13, 'pt': 26, 'no': 9,
|
|
||||||
'tr': 21, 'pl': 18, 'fr': 17, 'hr': 31, 'de': 14, 'da': 10, 'fi': 11,
|
|
||||||
'hu': 19, 'ja': 25, 'he': 24, 'ko': 32, 'sv': 8, 'sl': 30}
|
|
||||||
|
|
||||||
if language is None:
|
|
||||||
self.config['language'] = 'en'
|
|
||||||
else:
|
|
||||||
if language not in self.config['valid_languages']:
|
|
||||||
raise ValueError("Invalid language %s, options are: %s" % (
|
|
||||||
language, self.config['valid_languages']
|
|
||||||
))
|
|
||||||
else:
|
|
||||||
self.config['language'] = language
|
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
return getattr(self._wrapped, attr)
|
return getattr(self._wrapped, attr)
|
||||||
|
29
sickbeard/indexers/indexer_config.py
Normal file
29
sickbeard/indexers/indexer_config.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
INDEXER_TVDB = 'Tvdb'
|
||||||
|
INDEXER_TVRAGE = 'TVRage'
|
||||||
|
|
||||||
|
INDEXER_API_KEY = {}
|
||||||
|
INDEXER_API_KEY[INDEXER_TVDB] = '9DAF49C96CBF8DAC'
|
||||||
|
INDEXER_API_KEY[INDEXER_TVRAGE] = 'Uhewg1Rr0o62fvZvUIZt'
|
||||||
|
|
||||||
|
INDEXER_BASEURL = {}
|
||||||
|
INDEXER_BASEURL[INDEXER_TVDB] = 'http://thetvdb.com/api/' + INDEXER_API_KEY[INDEXER_TVDB]
|
||||||
|
INDEXER_BASEURL[INDEXER_TVRAGE] = 'http://tvrage.com/feeds/' + INDEXER_API_KEY[INDEXER_TVRAGE]
|
||||||
|
|
||||||
|
INDEXER_API_PARMS = {}
|
||||||
|
INDEXER_API_PARMS[INDEXER_TVDB] = {'apikey': INDEXER_API_KEY[INDEXER_TVDB],
|
||||||
|
'language': 'en',
|
||||||
|
'useZip': True}
|
||||||
|
|
||||||
|
INDEXER_API_PARMS[INDEXER_TVRAGE] = {'apikey': INDEXER_API_KEY[INDEXER_TVRAGE],
|
||||||
|
'language': 'en'}
|
||||||
|
|
||||||
|
|
||||||
|
INDEXER_CONFIG = {}
|
||||||
|
INDEXER_CONFIG['valid_languages'] = [
|
||||||
|
"da", "fi", "nl", "de", "it", "es", "fr","pl", "hu","el","tr",
|
||||||
|
"ru","he","ja","pt","zh","cs","sl", "hr","ko","en","sv","no"]
|
||||||
|
|
||||||
|
INDEXER_CONFIG['langabbv_to_id'] = {'el': 20, 'en': 7, 'zh': 27,
|
||||||
|
'it': 15, 'cs': 28, 'es': 16, 'ru': 22, 'nl': 13, 'pt': 26, 'no': 9,
|
||||||
|
'tr': 21, 'pl': 18, 'fr': 17, 'hr': 31, 'de': 14, 'da': 10, 'fi': 11,
|
||||||
|
'hu': 19, 'ja': 25, 'he': 24, 'ko': 32, 'sv': 8, 'sl': 30}
|
@ -338,15 +338,18 @@ class GenericMetadata():
|
|||||||
try:
|
try:
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
# There's gotta be a better way of doing this but we don't wanna
|
||||||
# change the language value elsewhere
|
# change the language value elsewhere
|
||||||
lindexer_api_parms = sickbeard.INDEXER_API_PARMS.copy()
|
lINDEXER_API_PARMS = {'indexer': ep_obj.show.indexer}
|
||||||
|
|
||||||
|
lINDEXER_API_PARMS['actors'] = True
|
||||||
|
|
||||||
if indexer_lang and not indexer_lang == 'en':
|
if indexer_lang and not indexer_lang == 'en':
|
||||||
lindexer_api_parms['language'] = indexer_lang
|
lINDEXER_API_PARMS['language'] = indexer_lang
|
||||||
|
|
||||||
if ep_obj.show.dvdorder != 0:
|
if ep_obj.show.dvdorder != 0:
|
||||||
lindexer_api_parms['dvdorder'] = True
|
lINDEXER_API_PARMS['dvdorder'] = True
|
||||||
|
|
||||||
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
|
|
||||||
t = indexer_api.indexerApi(actors=True, **lindexer_api_parms)
|
|
||||||
indexer_show_obj = t[ep_obj.show.indexerid]
|
indexer_show_obj = t[ep_obj.show.indexerid]
|
||||||
except indexer_exceptions.indexer_shownotfound, e:
|
except indexer_exceptions.indexer_shownotfound, e:
|
||||||
raise exceptions.ShowNotFoundException(e.message)
|
raise exceptions.ShowNotFoundException(e.message)
|
||||||
@ -716,15 +719,17 @@ class GenericMetadata():
|
|||||||
try:
|
try:
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
# There's gotta be a better way of doing this but we don't wanna
|
||||||
# change the language value elsewhere
|
# change the language value elsewhere
|
||||||
lindexer_api_parms = sickbeard.INDEXER_API_PARMS.copy()
|
lINDEXER_API_PARMS = {'indexer': show_obj.indexer}
|
||||||
|
|
||||||
|
lINDEXER_API_PARMS['banners'] = True
|
||||||
|
|
||||||
if indexer_lang and not indexer_lang == 'en':
|
if indexer_lang and not indexer_lang == 'en':
|
||||||
lindexer_api_parms['language'] = indexer_lang
|
lINDEXER_API_PARMS['language'] = indexer_lang
|
||||||
|
|
||||||
if show_obj.dvdorder != 0:
|
if show_obj.dvdorder != 0:
|
||||||
lindexer_api_parms['dvdorder'] = True
|
lINDEXER_API_PARMS['dvdorder'] = True
|
||||||
|
|
||||||
t = indexer_api.indexerApi(banners=True, **lindexer_api_parms)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
indexer_show_obj = t[show_obj.indexerid]
|
indexer_show_obj = t[show_obj.indexerid]
|
||||||
except (indexer_exceptions.indexer_error, IOError), e:
|
except (indexer_exceptions.indexer_error, IOError), e:
|
||||||
logger.log(u"Unable to look up show on " + show_obj.indexer + ", not downloading images: " + ex(e), logger.ERROR)
|
logger.log(u"Unable to look up show on " + show_obj.indexer + ", not downloading images: " + ex(e), logger.ERROR)
|
||||||
@ -764,15 +769,17 @@ class GenericMetadata():
|
|||||||
try:
|
try:
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
# There's gotta be a better way of doing this but we don't wanna
|
||||||
# change the language value elsewhere
|
# change the language value elsewhere
|
||||||
lindexer_api_parms = sickbeard.INDEXER_API_PARMS.copy()
|
lINDEXER_API_PARMS = {'indexer': show_obj.indexer}
|
||||||
|
|
||||||
|
lINDEXER_API_PARMS['banners'] = True
|
||||||
|
|
||||||
if indexer_lang and not indexer_lang == 'en':
|
if indexer_lang and not indexer_lang == 'en':
|
||||||
lindexer_api_parms['language'] = indexer_lang
|
lINDEXER_API_PARMS['language'] = indexer_lang
|
||||||
|
|
||||||
if show_obj.dvdorder != 0:
|
if show_obj.dvdorder != 0:
|
||||||
lindexer_api_parms['dvdorder'] = True
|
lINDEXER_API_PARMS['dvdorder'] = True
|
||||||
|
|
||||||
t = indexer_api.indexerApi(banners=True, **lindexer_api_parms)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
indexer_show_obj = t[show_obj.indexerid]
|
indexer_show_obj = t[show_obj.indexerid]
|
||||||
except (indexer_exceptions.indexer_error, IOError), e:
|
except (indexer_exceptions.indexer_error, IOError), e:
|
||||||
logger.log(u"Unable to look up show on " + show_obj.indexer + ", not downloading images: " + ex(e), logger.ERROR)
|
logger.log(u"Unable to look up show on " + show_obj.indexer + ", not downloading images: " + ex(e), logger.ERROR)
|
||||||
@ -814,12 +821,14 @@ class GenericMetadata():
|
|||||||
try:
|
try:
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
# There's gotta be a better way of doing this but we don't wanna
|
||||||
# change the language value elsewhere
|
# change the language value elsewhere
|
||||||
lindexer_api_parms = sickbeard.INDEXER_API_PARMS.copy()
|
lINDEXER_API_PARMS = {'indexer': show_obj.indexer}
|
||||||
|
|
||||||
|
lINDEXER_API_PARMS['banners'] = True
|
||||||
|
|
||||||
if indexer_lang and not indexer_lang == 'en':
|
if indexer_lang and not indexer_lang == 'en':
|
||||||
lindexer_api_parms['language'] = indexer_lang
|
lINDEXER_API_PARMS['language'] = indexer_lang
|
||||||
|
|
||||||
t = indexer_api.indexerApi(banners=True, **lindexer_api_parms)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
indexer_show_obj = t[show_obj.indexerid]
|
indexer_show_obj = t[show_obj.indexerid]
|
||||||
except (indexer_exceptions.indexer_error, IOError), e:
|
except (indexer_exceptions.indexer_error, IOError), e:
|
||||||
logger.log(u"Unable to look up show on " + show_obj.indexer + ", not downloading images: " + ex(e), logger.ERROR)
|
logger.log(u"Unable to look up show on " + show_obj.indexer + ", not downloading images: " + ex(e), logger.ERROR)
|
||||||
|
@ -227,7 +227,9 @@ class MediaBrowserMetadata(generic.GenericMetadata):
|
|||||||
indexer_lang = show_obj.lang
|
indexer_lang = show_obj.lang
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
# There's gotta be a better way of doing this but we don't wanna
|
||||||
# change the language value elsewhere
|
# change the language value elsewhere
|
||||||
lINDEXER_API_PARMS = sickbeard.INDEXER_API_PARMS.copy()
|
lINDEXER_API_PARMS = {'indexer': show_obj.indexer}
|
||||||
|
|
||||||
|
lINDEXER_API_PARMS['actors'] = True
|
||||||
|
|
||||||
if indexer_lang and not indexer_lang == 'en':
|
if indexer_lang and not indexer_lang == 'en':
|
||||||
lINDEXER_API_PARMS['language'] = indexer_lang
|
lINDEXER_API_PARMS['language'] = indexer_lang
|
||||||
@ -235,7 +237,7 @@ class MediaBrowserMetadata(generic.GenericMetadata):
|
|||||||
if show_obj.dvdorder != 0:
|
if show_obj.dvdorder != 0:
|
||||||
lINDEXER_API_PARMS['dvdorder'] = True
|
lINDEXER_API_PARMS['dvdorder'] = True
|
||||||
|
|
||||||
t = indexer_api.indexerApi(actors=True, **lINDEXER_API_PARMS)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
|
|
||||||
tv_node = etree.Element("Series")
|
tv_node = etree.Element("Series")
|
||||||
|
|
||||||
@ -388,9 +390,9 @@ class MediaBrowserMetadata(generic.GenericMetadata):
|
|||||||
indexer_lang = ep_obj.show.lang
|
indexer_lang = ep_obj.show.lang
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
lINDEXER_API_PARMS = {'indexer': ep_obj.show.indexer}
|
||||||
# change the language value elsewhere
|
|
||||||
lINDEXER_API_PARMS = sickbeard.INDEXER_API_PARMS.copy()
|
lINDEXER_API_PARMS['actors'] = True
|
||||||
|
|
||||||
if indexer_lang and not indexer_lang == 'en':
|
if indexer_lang and not indexer_lang == 'en':
|
||||||
lINDEXER_API_PARMS['language'] = indexer_lang
|
lINDEXER_API_PARMS['language'] = indexer_lang
|
||||||
@ -398,7 +400,8 @@ class MediaBrowserMetadata(generic.GenericMetadata):
|
|||||||
if ep_obj.show.dvdorder != 0:
|
if ep_obj.show.dvdorder != 0:
|
||||||
lINDEXER_API_PARMS['dvdorder'] = True
|
lINDEXER_API_PARMS['dvdorder'] = True
|
||||||
|
|
||||||
t = indexer_api.indexerApi(actors=True, **lINDEXER_API_PARMS)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
|
|
||||||
myShow = t[ep_obj.show.indexerid]
|
myShow = t[ep_obj.show.indexerid]
|
||||||
except indexer_exceptions.indexer_shownotfound, e:
|
except indexer_exceptions.indexer_shownotfound, e:
|
||||||
raise exceptions.ShowNotFoundException(e.message)
|
raise exceptions.ShowNotFoundException(e.message)
|
||||||
|
@ -169,9 +169,9 @@ class TIVOMetadata(generic.GenericMetadata):
|
|||||||
indexer_lang = ep_obj.show.lang
|
indexer_lang = ep_obj.show.lang
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
lINDEXER_API_PARMS = {'indexer': ep_obj.show.indexer}
|
||||||
# change the language value elsewhere
|
|
||||||
lINDEXER_API_PARMS = sickbeard.INDEXER_API_PARMS.copy()
|
lINDEXER_API_PARMS['actors'] = True
|
||||||
|
|
||||||
if indexer_lang and not indexer_lang == 'en':
|
if indexer_lang and not indexer_lang == 'en':
|
||||||
lINDEXER_API_PARMS['language'] = indexer_lang
|
lINDEXER_API_PARMS['language'] = indexer_lang
|
||||||
@ -179,12 +179,12 @@ class TIVOMetadata(generic.GenericMetadata):
|
|||||||
if ep_obj.show.dvdorder != 0:
|
if ep_obj.show.dvdorder != 0:
|
||||||
lINDEXER_API_PARMS['dvdorder'] = True
|
lINDEXER_API_PARMS['dvdorder'] = True
|
||||||
|
|
||||||
t = indexer_api.indexerApi(actors=True, **lINDEXER_API_PARMS)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
myShow = t[ep_obj.show.indexerid]
|
myShow = t[ep_obj.show.indexerid]
|
||||||
except indexer_exceptions.indexer_shownotfound, e:
|
except indexer_exceptions.indexer_shownotfound, e:
|
||||||
raise exceptions.ShowNotFoundException(str(e))
|
raise exceptions.ShowNotFoundException(str(e))
|
||||||
except indexer_exceptions.indexer_error, e:
|
except indexer_exceptions.indexer_error, e:
|
||||||
logger.log(u"Unable to connect to " + self.indexer + " while creating meta files - skipping - " + str(e), logger.ERROR)
|
logger.log(u"Unable to connect to " + ep_obj.show.indexer + " while creating meta files - skipping - " + str(e), logger.ERROR)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
for curEpToWrite in eps_to_write:
|
for curEpToWrite in eps_to_write:
|
||||||
|
@ -177,9 +177,9 @@ class WDTVMetadata(generic.GenericMetadata):
|
|||||||
indexer_lang = ep_obj.show.lang
|
indexer_lang = ep_obj.show.lang
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
lINDEXER_API_PARMS = {'indexer': ep_obj.show.indexer}
|
||||||
# change the language value elsewhere
|
|
||||||
lINDEXER_API_PARMS = sickbeard.INDEXER_API_PARMS.copy()
|
lINDEXER_API_PARMS['actors'] = True
|
||||||
|
|
||||||
if indexer_lang and not indexer_lang == 'en':
|
if indexer_lang and not indexer_lang == 'en':
|
||||||
lINDEXER_API_PARMS['language'] = indexer_lang
|
lINDEXER_API_PARMS['language'] = indexer_lang
|
||||||
@ -187,7 +187,7 @@ class WDTVMetadata(generic.GenericMetadata):
|
|||||||
if ep_obj.show.dvdorder != 0:
|
if ep_obj.show.dvdorder != 0:
|
||||||
lINDEXER_API_PARMS['dvdorder'] = True
|
lINDEXER_API_PARMS['dvdorder'] = True
|
||||||
|
|
||||||
t = indexer_api.indexerApi(actors=True, **lINDEXER_API_PARMS)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
myShow = t[ep_obj.show.indexerid]
|
myShow = t[ep_obj.show.indexerid]
|
||||||
except indexer_exceptions.indexer_shownotfound, e:
|
except indexer_exceptions.indexer_shownotfound, e:
|
||||||
raise exceptions.ShowNotFoundException(e.message)
|
raise exceptions.ShowNotFoundException(e.message)
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
|
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import generic
|
import generic
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
import sickbeard
|
||||||
|
|
||||||
from sickbeard.indexers import indexer_api, indexer_exceptions
|
from sickbeard.indexers import indexer_api, indexer_exceptions
|
||||||
|
from sickbeard.indexers.indexer_config import INDEXER_BASEURL
|
||||||
|
|
||||||
import sickbeard
|
|
||||||
from sickbeard import logger, exceptions, helpers
|
from sickbeard import logger, exceptions, helpers
|
||||||
from sickbeard.exceptions import ex
|
from sickbeard.exceptions import ex
|
||||||
|
|
||||||
@ -100,17 +100,17 @@ class XBMC_12PlusMetadata(generic.GenericMetadata):
|
|||||||
show_ID = show_obj.indexerid
|
show_ID = show_obj.indexerid
|
||||||
|
|
||||||
indexer_lang = show_obj.lang
|
indexer_lang = show_obj.lang
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
lINDEXER_API_PARMS = {'indexer': show_obj.indexer}
|
||||||
# change the language value elsewhere
|
|
||||||
lindexer_api_parms = sickbeard.INDEXER_API_PARMS.copy()
|
lINDEXER_API_PARMS['actors'] = True
|
||||||
|
|
||||||
if indexer_lang and not indexer_lang == 'en':
|
if indexer_lang and not indexer_lang == 'en':
|
||||||
lindexer_api_parms['language'] = indexer_lang
|
lINDEXER_API_PARMS['language'] = indexer_lang
|
||||||
|
|
||||||
if show_obj.dvdorder != 0:
|
if show_obj.dvdorder != 0:
|
||||||
lindexer_api_parms['dvdorder'] = True
|
lINDEXER_API_PARMS['dvdorder'] = True
|
||||||
|
|
||||||
t = indexer_api.indexerApi(actors=True, **lindexer_api_parms)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
|
|
||||||
tv_node = etree.Element("tvshow")
|
tv_node = etree.Element("tvshow")
|
||||||
|
|
||||||
@ -153,8 +153,8 @@ class XBMC_12PlusMetadata(generic.GenericMetadata):
|
|||||||
episodeguide = etree.SubElement(tv_node, "episodeguide")
|
episodeguide = etree.SubElement(tv_node, "episodeguide")
|
||||||
episodeguideurl = etree.SubElement(episodeguide, "url")
|
episodeguideurl = etree.SubElement(episodeguide, "url")
|
||||||
episodeguideurl2 = etree.SubElement(tv_node, "episodeguideurl")
|
episodeguideurl2 = etree.SubElement(tv_node, "episodeguideurl")
|
||||||
if myShow["id"] != None:
|
if getattr(myShow, 'id', None) is not None:
|
||||||
showurl = sickbeard.TVDB_BASE_URL + '/series/' + myShow["id"] + '/all/en.zip'
|
showurl = INDEXER_BASEURL[show_obj.indexer] + '/series/' + myShow["id"] + '/all/en.zip'
|
||||||
episodeguideurl.text = showurl
|
episodeguideurl.text = showurl
|
||||||
episodeguideurl2.text = showurl
|
episodeguideurl2.text = showurl
|
||||||
|
|
||||||
@ -219,18 +219,19 @@ class XBMC_12PlusMetadata(generic.GenericMetadata):
|
|||||||
eps_to_write = [ep_obj] + ep_obj.relatedEps
|
eps_to_write = [ep_obj] + ep_obj.relatedEps
|
||||||
|
|
||||||
indexer_lang = ep_obj.show.lang
|
indexer_lang = ep_obj.show.lang
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
|
||||||
# change the language value elsewhere
|
lINDEXER_API_PARMS = {'indexer': ep_obj.show.indexer}
|
||||||
lindexer_api_parms = sickbeard.INDEXER_API_PARMS.copy()
|
|
||||||
|
lINDEXER_API_PARMS['actors'] = True
|
||||||
|
|
||||||
if indexer_lang and not indexer_lang == 'en':
|
if indexer_lang and not indexer_lang == 'en':
|
||||||
lindexer_api_parms['language'] = indexer_lang
|
lINDEXER_API_PARMS['language'] = indexer_lang
|
||||||
|
|
||||||
if ep_obj.show.dvdorder != 0:
|
if ep_obj.show.dvdorder != 0:
|
||||||
lindexer_api_parms['dvdorder'] = True
|
lINDEXER_API_PARMS['dvdorder'] = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
t = indexer_api.indexerApi(actors=True, **lindexer_api_parms)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
myShow = t[ep_obj.show.indexerid]
|
myShow = t[ep_obj.show.indexerid]
|
||||||
except indexer_exceptions.indexer_shownotfound, e:
|
except indexer_exceptions.indexer_shownotfound, e:
|
||||||
raise exceptions.ShowNotFoundException(e.message)
|
raise exceptions.ShowNotFoundException(e.message)
|
||||||
|
@ -24,9 +24,10 @@ import regexes
|
|||||||
|
|
||||||
import sickbeard
|
import sickbeard
|
||||||
|
|
||||||
from sickbeard import logger
|
from sickbeard import logger, classes
|
||||||
|
from sickbeard import scene_numbering, scene_exceptions
|
||||||
from sickbeard.indexers import indexer_api, indexer_exceptions
|
from sickbeard.indexers import indexer_api, indexer_exceptions
|
||||||
|
from sickbeard.common import indexerStrings
|
||||||
|
|
||||||
from time import strptime
|
from time import strptime
|
||||||
|
|
||||||
@ -285,31 +286,36 @@ class NameParser(object):
|
|||||||
# see if we can find the name with a TVDB lookup
|
# see if we can find the name with a TVDB lookup
|
||||||
if check_indexer:
|
if check_indexer:
|
||||||
for cur_name in name_list:
|
for cur_name in name_list:
|
||||||
try:
|
for indexer in indexerStrings:
|
||||||
t = indexer_api.indexerApi(custom_ui=sickbeard.classes.ShowListUI, **sickbeard.INDEXER_API_PARMS)
|
|
||||||
|
|
||||||
logger.log(u"Looking up name "+cur_name+u" on the Indexer", logger.DEBUG)
|
|
||||||
showObj = t[cur_name]
|
|
||||||
except (indexer_exceptions):
|
|
||||||
# if none found, search on all languages
|
|
||||||
try:
|
try:
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
lINDEXER_API_PARMS = {'indexer': indexer}
|
||||||
# change the language value elsewhere
|
|
||||||
lINDEXER_API_PARMS = sickbeard.INDEXER_API_PARMS.copy()
|
lINDEXER_API_PARMS['custom_ui'] = classes.ShowListUI
|
||||||
|
|
||||||
lINDEXER_API_PARMS['search_all_languages'] = True
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
t = indexer_api.indexerApi(custom_ui=sickbeard.classes.ShowListUI, **lINDEXER_API_PARMS)
|
|
||||||
|
logger.log(u"Looking up name "+cur_name+u" on the Indexer", logger.DEBUG)
|
||||||
logger.log(u"Looking up name "+cur_name+u" in all languages on the Indexer", logger.DEBUG)
|
|
||||||
showObj = t[cur_name]
|
showObj = t[cur_name]
|
||||||
except (indexer_exceptions.indexer_exception, IOError):
|
except (indexer_exceptions):
|
||||||
pass
|
# if none found, search on all languages
|
||||||
|
try:
|
||||||
continue
|
lINDEXER_API_PARMS = {'indexer': indexer}
|
||||||
except (IOError):
|
|
||||||
continue
|
lINDEXER_API_PARMS['custom_ui'] = classes.ShowListUI
|
||||||
|
lINDEXER_API_PARMS['search_all_languages'] = True
|
||||||
return showObj["id"]
|
|
||||||
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
|
|
||||||
|
logger.log(u"Looking up name "+cur_name+u" in all languages on the Indexer", logger.DEBUG)
|
||||||
|
showObj = t[cur_name]
|
||||||
|
except (indexer_exceptions.indexer_exception, IOError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
continue
|
||||||
|
except (IOError):
|
||||||
|
continue
|
||||||
|
|
||||||
|
return showObj["id"]
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -402,7 +408,7 @@ class ParseResult(object):
|
|||||||
new_episode_numbers = []
|
new_episode_numbers = []
|
||||||
new_season_numbers = []
|
new_season_numbers = []
|
||||||
for epNo in self.episode_numbers:
|
for epNo in self.episode_numbers:
|
||||||
(s, e) = sickbeard.scene_numbering.get_indexer_numbering(indexer_id, self.season_number, epNo)
|
(s, e) = scene_numbering.get_indexer_numbering(indexer_id, self.season_number, epNo)
|
||||||
new_episode_numbers.append(e)
|
new_episode_numbers.append(e)
|
||||||
new_season_numbers.append(s)
|
new_season_numbers.append(s)
|
||||||
|
|
||||||
|
@ -517,19 +517,23 @@ class PostProcessor(object):
|
|||||||
# see if we can find the name with a TVDB lookup
|
# see if we can find the name with a TVDB lookup
|
||||||
for cur_name in name_list:
|
for cur_name in name_list:
|
||||||
try:
|
try:
|
||||||
t = indexer_api.indexerApi(custom_ui=classes.ShowListUI, **sickbeard.INDEXER_API_PARMS)
|
lINDEXER_API_PARMS = {'indexer': self.indexer}
|
||||||
|
|
||||||
|
lINDEXER_API_PARMS['custom_ui'] = classes.ShowListUI
|
||||||
|
|
||||||
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
|
|
||||||
self._log(u"Looking up name " + cur_name + u" on " + self.indexer + "", logger.DEBUG)
|
self._log(u"Looking up name " + cur_name + u" on " + self.indexer + "", logger.DEBUG)
|
||||||
showObj = t[cur_name]
|
showObj = t[cur_name]
|
||||||
except (indexer_exceptions.indexer_exception, IOError):
|
except (indexer_exceptions.indexer_exception, IOError):
|
||||||
# if none found, search on all languages
|
# if none found, search on all languages
|
||||||
try:
|
try:
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
lINDEXER_API_PARMS = {'indexer': self.indexer}
|
||||||
# change the language value elsewhere
|
|
||||||
lINDEXER_API_PARMS = sickbeard.INDEXER_API_PARMS.copy()
|
|
||||||
|
|
||||||
lINDEXER_API_PARMS['search_all_languages'] = True
|
lINDEXER_API_PARMS['search_all_languages'] = True
|
||||||
t = indexer_api.indexerApi(custom_ui=classes.ShowListUI, **lINDEXER_API_PARMS)
|
lINDEXER_API_PARMS['custom_ui'] = classes.ShowListUI
|
||||||
|
|
||||||
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
|
|
||||||
self._log(u"Looking up name " + cur_name + u" in all languages on " + self.indexer + "", logger.DEBUG)
|
self._log(u"Looking up name " + cur_name + u" in all languages on " + self.indexer + "", logger.DEBUG)
|
||||||
showObj = t[cur_name]
|
showObj = t[cur_name]
|
||||||
@ -601,27 +605,25 @@ class PostProcessor(object):
|
|||||||
try:
|
try:
|
||||||
showObj = helpers.findCertainShow(sickbeard.showList, indexer_id)
|
showObj = helpers.findCertainShow(sickbeard.showList, indexer_id)
|
||||||
if(showObj != None):
|
if(showObj != None):
|
||||||
# correct the indexer with the proper one linked to the show
|
|
||||||
self.indexer = showObj.indexer
|
|
||||||
sickbeard.INDEXER_API_PARMS['indexer'] = self.indexer
|
|
||||||
|
|
||||||
# set the language of the show
|
# set the language of the show
|
||||||
indexer_lang = showObj.lang
|
indexer_lang = showObj.lang
|
||||||
|
self.indexer = showObj.indexer
|
||||||
except exceptions.MultipleShowObjectsException:
|
except exceptions.MultipleShowObjectsException:
|
||||||
raise #TODO: later I'll just log this, for now I want to know about it ASAP
|
raise #TODO: later I'll just log this, for now I want to know about it ASAP
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
lINDEXER_API_PARMS = {'indexer': self.indexer}
|
||||||
# change the language value elsewhere
|
|
||||||
lINDEXER_API_PARMS = sickbeard.INDEXER_API_PARMS.copy()
|
|
||||||
|
|
||||||
if indexer_lang and not indexer_lang == 'en':
|
if indexer_lang and not indexer_lang == 'en':
|
||||||
lINDEXER_API_PARMS['language'] = indexer_lang
|
lINDEXER_API_PARMS = {'language': indexer_lang}
|
||||||
|
|
||||||
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
|
|
||||||
epObj = t[indexer_id].airedOn(episodes[0])[0]
|
epObj = t[indexer_id].airedOn(episodes[0])[0]
|
||||||
|
|
||||||
season = int(epObj["seasonnumber"])
|
season = int(epObj["seasonnumber"])
|
||||||
episodes = [int(epObj["episodenumber"])]
|
episodes = [int(epObj["episodenumber"])]
|
||||||
|
|
||||||
self._log(u"Got season " + str(season) + " episodes " + str(episodes), logger.DEBUG)
|
self._log(u"Got season " + str(season) + " episodes " + str(episodes), logger.DEBUG)
|
||||||
except indexer_exceptions.indexer_episodenotfound, e:
|
except indexer_exceptions.indexer_episodenotfound, e:
|
||||||
self._log(u"Unable to find episode with date " + str(episodes[0]) + u" for show " + str(indexer_id) + u", skipping", logger.DEBUG)
|
self._log(u"Unable to find episode with date " + str(episodes[0]) + u" for show " + str(indexer_id) + u", skipping", logger.DEBUG)
|
||||||
@ -819,11 +821,11 @@ class PostProcessor(object):
|
|||||||
# reset per-file stuff
|
# reset per-file stuff
|
||||||
self.in_history = False
|
self.in_history = False
|
||||||
|
|
||||||
|
# try to find the file info
|
||||||
indexer_id = season = episodes = None
|
indexer_id = season = episodes = None
|
||||||
if 'auto' in self.indexer:
|
if 'auto' in self.indexer:
|
||||||
for indexer in indexerStrings:
|
for indexer in indexerStrings:
|
||||||
self.indexer = indexer
|
self.indexer = indexer
|
||||||
sickbeard.INDEXER_API_PARMS['indexer'] = self.indexer
|
|
||||||
|
|
||||||
# try to find the file info
|
# try to find the file info
|
||||||
(indexer_id, season, episodes) = self._find_info()
|
(indexer_id, season, episodes) = self._find_info()
|
||||||
@ -832,9 +834,6 @@ class PostProcessor(object):
|
|||||||
|
|
||||||
self._log(u"Can't find show on " + self.indexer + ", auto trying next indexer in list", logger.WARNING)
|
self._log(u"Can't find show on " + self.indexer + ", auto trying next indexer in list", logger.WARNING)
|
||||||
else:
|
else:
|
||||||
sickbeard.INDEXER_API_PARMS['indexer'] = self.indexer
|
|
||||||
|
|
||||||
# try to find the file info
|
|
||||||
(indexer_id, season, episodes) = self._find_info()
|
(indexer_id, season, episodes) = self._find_info()
|
||||||
|
|
||||||
if not indexer_id or season == None or not episodes:
|
if not indexer_id or season == None or not episodes:
|
||||||
|
@ -167,21 +167,18 @@ class ProperFinder():
|
|||||||
logger.log(u"This should never have happened, post a bug about this!", logger.ERROR)
|
logger.log(u"This should never have happened, post a bug about this!", logger.ERROR)
|
||||||
raise Exception("BAD STUFF HAPPENED")
|
raise Exception("BAD STUFF HAPPENED")
|
||||||
|
|
||||||
# correct the indexer with the proper one linked to the show
|
|
||||||
self.indexer = showObj.indexer
|
|
||||||
sickbeard.INDEXER_API_PARMS['indexer'] = self.indexer
|
|
||||||
|
|
||||||
indexer_lang = showObj.lang
|
indexer_lang = showObj.lang
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
|
||||||
# change the language value elsewhere
|
lINDEXER_API_PARMS = {'indexer': showObj.indexer}
|
||||||
lINDEXER_API_PARMS = sickbeard.INDEXER_API_PARMS.copy()
|
|
||||||
|
|
||||||
if indexer_lang and not indexer_lang == 'en':
|
if indexer_lang and not indexer_lang == 'en':
|
||||||
lINDEXER_API_PARMS['language'] = indexer_lang
|
lINDEXER_API_PARMS['language'] = indexer_lang
|
||||||
|
|
||||||
try:
|
try:
|
||||||
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
|
|
||||||
epObj = t[curProper.indexerid].airedOn(curProper.episode)[0]
|
epObj = t[curProper.indexerid].airedOn(curProper.episode)[0]
|
||||||
|
|
||||||
curProper.season = int(epObj["seasonnumber"])
|
curProper.season = int(epObj["seasonnumber"])
|
||||||
curProper.episodes = [int(epObj["episodenumber"])]
|
curProper.episodes = [int(epObj["episodenumber"])]
|
||||||
except indexer_exceptions.indexer_episodenotfound:
|
except indexer_exceptions.indexer_episodenotfound:
|
||||||
|
@ -231,14 +231,15 @@ class QueueItemAdd(ShowQueueItem):
|
|||||||
try:
|
try:
|
||||||
# make sure the indexer ids are valid
|
# make sure the indexer ids are valid
|
||||||
try:
|
try:
|
||||||
sickbeard.INDEXER_API_PARMS['indexer'] = self.indexer
|
|
||||||
lindexer_api_parms = sickbeard.INDEXER_API_PARMS.copy()
|
lINDEXER_API_PARMS = {'indexer': self.indexer}
|
||||||
|
|
||||||
if self.lang:
|
if self.lang:
|
||||||
lindexer_api_parms['language'] = self.lang
|
lINDEXER_API_PARMS['language'] = self.lang
|
||||||
|
|
||||||
logger.log(u"" + self.indexer + ": " + repr(lindexer_api_parms))
|
logger.log(u"" + self.indexer + ": " + repr(lINDEXER_API_PARMS))
|
||||||
|
|
||||||
t = indexer_api.indexerApi(**lindexer_api_parms)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
s = t[self.indexer_id]
|
s = t[self.indexer_id]
|
||||||
|
|
||||||
# this usually only happens if they have an NFO in their show dir which gave us a indexer ID that has no proper english version of the show
|
# this usually only happens if they have an NFO in their show dir which gave us a indexer ID that has no proper english version of the show
|
||||||
|
@ -58,8 +58,6 @@ class TVShow(object):
|
|||||||
|
|
||||||
def __init__(self, indexer, indexerid, lang=""):
|
def __init__(self, indexer, indexerid, lang=""):
|
||||||
|
|
||||||
sickbeard.INDEXER_API_PARMS['indexer'] = indexer
|
|
||||||
|
|
||||||
self.indexerid = indexerid
|
self.indexerid = indexerid
|
||||||
self.indexer = indexer
|
self.indexer = indexer
|
||||||
self.name = ""
|
self.name = ""
|
||||||
@ -351,15 +349,15 @@ class TVShow(object):
|
|||||||
|
|
||||||
scannedEps = {}
|
scannedEps = {}
|
||||||
|
|
||||||
lindexer_api_parms = sickbeard.INDEXER_API_PARMS.copy()
|
lINDEXER_API_PARMS = {'indexer': self.indexer}
|
||||||
|
|
||||||
if self.lang:
|
if self.lang:
|
||||||
lindexer_api_parms['language'] = self.lang
|
lINDEXER_API_PARMS['language'] = self.lang
|
||||||
|
|
||||||
if self.dvdorder != 0:
|
if self.dvdorder != 0:
|
||||||
lindexer_api_parms['dvdorder'] = True
|
lINDEXER_API_PARMS['dvdorder'] = True
|
||||||
|
|
||||||
t = indexer_api.indexerApi(**lindexer_api_parms)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
|
|
||||||
cachedShow = t[self.indexerid]
|
cachedShow = t[self.indexerid]
|
||||||
cachedSeasons = {}
|
cachedSeasons = {}
|
||||||
@ -400,21 +398,19 @@ class TVShow(object):
|
|||||||
|
|
||||||
def loadEpisodesFromIndexer(self, cache=True):
|
def loadEpisodesFromIndexer(self, cache=True):
|
||||||
|
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
lINDEXER_API_PARMS = {'indexer': self.indexer}
|
||||||
# change the cache value elsewhere
|
|
||||||
lindexer_api_parms = sickbeard.INDEXER_API_PARMS.copy()
|
|
||||||
|
|
||||||
if not cache:
|
if not cache:
|
||||||
lindexer_api_parms['cache'] = False
|
lINDEXER_API_PARMS['cache'] = False
|
||||||
|
|
||||||
if self.lang:
|
if self.lang:
|
||||||
lindexer_api_parms['language'] = self.lang
|
lINDEXER_API_PARMS['language'] = self.lang
|
||||||
|
|
||||||
if self.dvdorder != 0:
|
if self.dvdorder != 0:
|
||||||
lindexer_api_parms['dvdorder'] = True
|
lINDEXER_API_PARMS['dvdorder'] = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
t = indexer_api.indexerApi(**lindexer_api_parms)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
showObj = t[self.indexerid]
|
showObj = t[self.indexerid]
|
||||||
except indexer_exceptions.indexer_error:
|
except indexer_exceptions.indexer_error:
|
||||||
logger.log(u"" + self.indexer + " timed out, unable to update episodes from " + self.indexer, logger.ERROR)
|
logger.log(u"" + self.indexer + " timed out, unable to update episodes from " + self.indexer, logger.ERROR)
|
||||||
@ -505,17 +501,15 @@ class TVShow(object):
|
|||||||
# if we have an air-by-date show then get the real season/episode numbers
|
# if we have an air-by-date show then get the real season/episode numbers
|
||||||
if parse_result.air_by_date:
|
if parse_result.air_by_date:
|
||||||
try:
|
try:
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
lINDEXER_API_PARMS = {'indexer': self.indexer}
|
||||||
# change the cache value elsewhere
|
|
||||||
lindexer_api_parms = sickbeard.INDEXER_API_PARMS.copy()
|
|
||||||
|
|
||||||
if self.lang:
|
if self.lang:
|
||||||
lindexer_api_parms['language'] = self.lang
|
lINDEXER_API_PARMS['language'] = self.lang
|
||||||
|
|
||||||
if self.dvdorder != 0:
|
if self.dvdorder != 0:
|
||||||
lindexer_api_parms['dvdorder'] = True
|
lINDEXER_API_PARMS['dvdorder'] = True
|
||||||
|
|
||||||
t = indexer_api.indexerApi(**lindexer_api_parms)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
|
|
||||||
epObj = t[self.indexerid].airedOn(parse_result.air_date)[0]
|
epObj = t[self.indexerid].airedOn(parse_result.air_date)[0]
|
||||||
season = int(epObj["seasonnumber"])
|
season = int(epObj["seasonnumber"])
|
||||||
@ -698,18 +692,18 @@ class TVShow(object):
|
|||||||
# There's gotta be a better way of doing this but we don't wanna
|
# There's gotta be a better way of doing this but we don't wanna
|
||||||
# change the cache value elsewhere
|
# change the cache value elsewhere
|
||||||
if tvapi is None:
|
if tvapi is None:
|
||||||
lindexer_api_parms = sickbeard.INDEXER_API_PARMS.copy()
|
lINDEXER_API_PARMS = {'indexer': self.indexer}
|
||||||
|
|
||||||
if not cache:
|
if not cache:
|
||||||
lindexer_api_parms['cache'] = False
|
lINDEXER_API_PARMS['cache'] = False
|
||||||
|
|
||||||
if self.lang:
|
if self.lang:
|
||||||
lindexer_api_parms['language'] = self.lang
|
lINDEXER_API_PARMS['language'] = self.lang
|
||||||
|
|
||||||
if self.dvdorder != 0:
|
if self.dvdorder != 0:
|
||||||
lindexer_api_parms['dvdorder'] = True
|
lINDEXER_API_PARMS['dvdorder'] = True
|
||||||
|
|
||||||
t = indexer_api.indexerApi(**lindexer_api_parms)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
t = tvapi
|
t = tvapi
|
||||||
@ -1305,20 +1299,18 @@ class TVEpisode(object):
|
|||||||
try:
|
try:
|
||||||
if cachedSeason is None:
|
if cachedSeason is None:
|
||||||
if tvapi is None:
|
if tvapi is None:
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
lINDEXER_API_PARMS = {'indexer': self.indexer}
|
||||||
# change the cache value elsewhere
|
|
||||||
lindexer_api_parms = sickbeard.INDEXER_API_PARMS.copy()
|
|
||||||
|
|
||||||
if not cache:
|
if not cache:
|
||||||
lindexer_api_parms['cache'] = False
|
lINDEXER_API_PARMS['cache'] = False
|
||||||
|
|
||||||
if indexer_lang:
|
if indexer_lang:
|
||||||
lindexer_api_parms['language'] = indexer_lang
|
lINDEXER_API_PARMS['language'] = indexer_lang
|
||||||
|
|
||||||
if self.show.dvdorder != 0:
|
if self.show.dvdorder != 0:
|
||||||
lindexer_api_parms['dvdorder'] = True
|
lINDEXER_API_PARMS['dvdorder'] = True
|
||||||
|
|
||||||
t = indexer_api.indexerApi(**lindexer_api_parms)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
else:
|
else:
|
||||||
t = tvapi
|
t = tvapi
|
||||||
myEp = t[self.show.indexerid][season][episode]
|
myEp = t[self.show.indexerid][season][episode]
|
||||||
|
@ -236,10 +236,6 @@ class TVCache():
|
|||||||
except (MultipleShowObjectsException):
|
except (MultipleShowObjectsException):
|
||||||
showObj = None
|
showObj = None
|
||||||
if showObj:
|
if showObj:
|
||||||
# correct the indexer with the proper one linked to the show
|
|
||||||
self.indexer = showObj.indexer
|
|
||||||
sickbeard.INDEXER_API_PARMS['indexer'] = self.indexer
|
|
||||||
|
|
||||||
indexer_lang = showObj.lang
|
indexer_lang = showObj.lang
|
||||||
|
|
||||||
# if they're both empty then fill out as much info as possible by searching the show name
|
# if they're both empty then fill out as much info as possible by searching the show name
|
||||||
@ -290,10 +286,7 @@ class TVCache():
|
|||||||
except (MultipleShowObjectsException):
|
except (MultipleShowObjectsException):
|
||||||
showObj = None
|
showObj = None
|
||||||
if showObj:
|
if showObj:
|
||||||
# correct the indexer with the proper one linked to the show
|
self.indexer = showObj.inexer
|
||||||
self.indexer = showObj.indexer
|
|
||||||
sickbeard.INDEXER_API_PARMS['indexer'] = self.indexer
|
|
||||||
|
|
||||||
indexer_lang = showObj.lang
|
indexer_lang = showObj.lang
|
||||||
|
|
||||||
# if we weren't provided with season/episode information then get it from the name that we parsed
|
# if we weren't provided with season/episode information then get it from the name that we parsed
|
||||||
@ -305,14 +298,13 @@ class TVCache():
|
|||||||
# if we have an air-by-date show then get the real season/episode numbers
|
# if we have an air-by-date show then get the real season/episode numbers
|
||||||
if parse_result.air_by_date and indexer_id:
|
if parse_result.air_by_date and indexer_id:
|
||||||
try:
|
try:
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
lINDEXER_API_PARMS = {'indexer': self.indexer}
|
||||||
# change the language value elsewhere
|
|
||||||
lINDEXER_API_PARMS = sickbeard.INDEXER_API_PARMS.copy()
|
|
||||||
|
|
||||||
if not (indexer_lang == "" or indexer_lang == "en" or indexer_lang == None):
|
if not (indexer_lang == "" or indexer_lang == "en" or indexer_lang == None):
|
||||||
lINDEXER_API_PARMS['language'] = indexer_lang
|
lINDEXER_API_PARMS['language'] = indexer_lang
|
||||||
|
|
||||||
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
t = indexer_api.indexerApi(**lINDEXER_API_PARMS)
|
||||||
|
|
||||||
epObj = t[indexer_id].airedOn(parse_result.air_date)[0]
|
epObj = t[indexer_id].airedOn(parse_result.air_date)[0]
|
||||||
season = int(epObj["seasonnumber"])
|
season = int(epObj["seasonnumber"])
|
||||||
episodes = [int(epObj["episodenumber"])]
|
episodes = [int(epObj["episodenumber"])]
|
||||||
|
@ -37,6 +37,7 @@ from sickbeard import search_queue
|
|||||||
from sickbeard.common import SNATCHED, SNATCHED_PROPER, DOWNLOADED, SKIPPED, UNAIRED, IGNORED, ARCHIVED, WANTED, UNKNOWN
|
from sickbeard.common import SNATCHED, SNATCHED_PROPER, DOWNLOADED, SKIPPED, UNAIRED, IGNORED, ARCHIVED, WANTED, UNKNOWN
|
||||||
from common import Quality, qualityPresetStrings, statusStrings
|
from common import Quality, qualityPresetStrings, statusStrings
|
||||||
from sickbeard import image_cache
|
from sickbeard import image_cache
|
||||||
|
from sickbeard.common import indexerStrings
|
||||||
|
|
||||||
from sickbeard.indexers import indexer_api, indexer_exceptions
|
from sickbeard.indexers import indexer_api, indexer_exceptions
|
||||||
try:
|
try:
|
||||||
@ -1515,6 +1516,8 @@ class CMD_SickBeardSearchTVDB(ApiCall):
|
|||||||
self.name, args = self.check_params(args, kwargs, "name", None, False, "string", [])
|
self.name, args = self.check_params(args, kwargs, "name", None, False, "string", [])
|
||||||
self.indexerid, args = self.check_params(args, kwargs, "indexerid", None, False, "int", [])
|
self.indexerid, args = self.check_params(args, kwargs, "indexerid", None, False, "int", [])
|
||||||
self.lang, args = self.check_params(args, kwargs, "lang", "en", False, "string", self.valid_languages.keys())
|
self.lang, args = self.check_params(args, kwargs, "lang", "en", False, "string", self.valid_languages.keys())
|
||||||
|
self.indexer, args = self.check_params(args, kwargs, "indexer", None, False, "string", [])
|
||||||
|
|
||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
@ -1546,9 +1549,7 @@ class CMD_SickBeardSearchTVDB(ApiCall):
|
|||||||
return _responds(RESULT_SUCCESS, {"results": results, "langid": lang_id})
|
return _responds(RESULT_SUCCESS, {"results": results, "langid": lang_id})
|
||||||
|
|
||||||
elif self.indexerid:
|
elif self.indexerid:
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
lINDEXER_API_PARMS = {'indexer': self.indexer}
|
||||||
# change the language value elsewhere
|
|
||||||
lINDEXER_API_PARMS = sickbeard.INDEXER_API_PARMS.copy()
|
|
||||||
|
|
||||||
lang_id = self.valid_languages[self.lang]
|
lang_id = self.valid_languages[self.lang]
|
||||||
if self.lang and not self.lang == 'en':
|
if self.lang and not self.lang == 'en':
|
||||||
|
@ -2840,10 +2840,6 @@ class Home:
|
|||||||
air_by_date = config.checkbox_to_value(air_by_date)
|
air_by_date = config.checkbox_to_value(air_by_date)
|
||||||
subtitles = config.checkbox_to_value(subtitles)
|
subtitles = config.checkbox_to_value(subtitles)
|
||||||
|
|
||||||
# correct the indexer with the proper one linked to the show
|
|
||||||
self.indexer = showObj.indexer
|
|
||||||
sickbeard.INDEXER_API_PARMS['indexer'] = self.indexer
|
|
||||||
|
|
||||||
indexer_lang = showObj.lang
|
indexer_lang = showObj.lang
|
||||||
|
|
||||||
# if we changed the language then kick off an update
|
# if we changed the language then kick off an update
|
||||||
|
Loading…
Reference in New Issue
Block a user