diff --git a/gui/slick/views/config_general.mako b/gui/slick/views/config_general.mako index 1de330c00fdc3982ba8a7fb8442411afe4cb1749..7a5b492446a74d65297035addf6b9d99254eda65 100644 --- a/gui/slick/views/config_general.mako +++ b/gui/slick/views/config_general.mako @@ -593,6 +593,17 @@ </label> </div> + <div class="field-pair"> + <label for="calendar_icons"> + <span class="component-title">Google Calendar Icons</span> + <span class="component-desc"> + <input type="checkbox" name="calendar_icons" id="calendar_icons" ${('', 'checked="checked"')[bool(sickbeard.CALENDAR_ICONS)]}/> + <p>show an icon next to exported calendar events in Google Calendar.</p> + </span> + + </label> + </div> + <div class="field-pair"> <label> <span class="component-title">Proxy host</span> diff --git a/gui/slick/views/config_providers.mako b/gui/slick/views/config_providers.mako index 41f3664ff5af6c894e619348561e7f8af93cbcf9..6836522a734992c953e81462ed9b1ae555ed0333 100644 --- a/gui/slick/views/config_providers.mako +++ b/gui/slick/views/config_providers.mako @@ -467,18 +467,6 @@ $('#config-components').tabs(); </div> % endif - % if hasattr(curTorrentProvider, 'append_identifier'): - <div class="field-pair"> - <label for="${curTorrentProvider.getID()}_append_identifier"> - <span class="component-title">Append identifier:</span> - <span class="component-desc"> - <input type="text" name="${curTorrentProvider.getID()}_append_identifier" id="${curTorrentProvider.getID()}_append_identifier" value="${curTorrentProvider.append_identifier}" class="form-control input-sm input350" /> - <p>Append an identifier to every episode snatched by this provider. Usefull in combination with "Required Words" on show configuration if you want to download certain shows only from this provider.</p> - </span> - </label> - </div> - % endif - % if hasattr(curTorrentProvider, 'sorting'): <div class="field-pair"> <label for="${curTorrentProvider.getID()}_sorting"> diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index a8ce4e7bd3a966198acf57d8ca248f729b560b51..18f99b6bb0e21e0c79210015e488d36f6a502bdc 100644 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -546,6 +546,7 @@ IGNORED_SUBS_LIST = "dk,fin,heb,kor,nor,nordic,pl,swe" SYNC_FILES = "!sync,lftp-pget-status,part,bts,!qb" CALENDAR_UNPROTECTED = False +CALENDAR_ICONS = False NO_RESTART = False TMDB_API_KEY = 'edc5f123313769de83a71e157758030b' @@ -610,7 +611,7 @@ def initialize(consoleLogging=True): NEWZBIN, NEWZBIN_USERNAME, NEWZBIN_PASSWORD, GIT_PATH, MOVE_ASSOCIATED_FILES, SYNC_FILES, POSTPONE_IF_SYNC_FILES, dailySearchScheduler, NFO_RENAME, \ GUI_NAME, HOME_LAYOUT, HISTORY_LAYOUT, DISPLAY_SHOW_SPECIALS, COMING_EPS_LAYOUT, COMING_EPS_SORT, COMING_EPS_DISPLAY_PAUSED, COMING_EPS_MISSED_RANGE, FUZZY_DATING, TRIM_ZERO, DATE_PRESET, TIME_PRESET, TIME_PRESET_W_SECONDS, THEME_NAME, FILTER_ROW, \ POSTER_SORTBY, POSTER_SORTDIR, HISTORY_LIMIT, CREATE_MISSING_SHOW_DIRS, ADD_SHOWS_WO_DIR, \ - METADATA_WDTV, METADATA_TIVO, METADATA_MEDE8ER, IGNORE_WORDS, IGNORED_SUBS_LIST, REQUIRE_WORDS, CALENDAR_UNPROTECTED, NO_RESTART, \ + METADATA_WDTV, METADATA_TIVO, METADATA_MEDE8ER, IGNORE_WORDS, IGNORED_SUBS_LIST, REQUIRE_WORDS, CALENDAR_UNPROTECTED, CALENDAR_ICONS, NO_RESTART, \ USE_SUBTITLES, SUBTITLES_LANGUAGES, SUBTITLES_DIR, SUBTITLES_SERVICES_LIST, SUBTITLES_SERVICES_ENABLED, SUBTITLES_HISTORY, SUBTITLES_FINDER_FREQUENCY, SUBTITLES_MULTI, EMBEDDED_SUBTITLES_ALL, SUBTITLES_EXTRA_SCRIPTS, subtitlesFinderScheduler, \ SUBTITLES_HEARING_IMPAIRED, ADDIC7ED_USER, ADDIC7ED_PASS, LEGENDASTV_USER, LEGENDASTV_PASS, OPENSUBTITLES_USER, OPENSUBTITLES_PASS, \ USE_FAILED_DOWNLOADS, DELETE_FAILED, ANON_REDIRECT, LOCALHOST_IP, DEBUG, DEFAULT_PAGE, PROXY_SETTING, PROXY_INDEXERS, \ @@ -1168,6 +1169,7 @@ def initialize(consoleLogging=True): IGNORED_SUBS_LIST = check_setting_str(CFG, 'General', 'ignored_subs_list', IGNORED_SUBS_LIST) CALENDAR_UNPROTECTED = bool(check_setting_int(CFG, 'General', 'calendar_unprotected', 0)) + CALENDAR_ICONS = bool(check_setting_int(CFG, 'General', 'calendar_icons', 0)) NO_RESTART = bool(check_setting_int(CFG, 'General', 'no_restart', 0)) @@ -1264,11 +1266,7 @@ def initialize(consoleLogging=True): if hasattr(curTorrentProvider, 'onlyspasearch'): curTorrentProvider.onlyspasearch = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(), - curTorrentProvider.getID() + '_onlyspasearch', 1)) - - if hasattr(curTorrentProvider, 'append_identifier'): - curTorrentProvider.append_identifier = check_setting_str(CFG, curTorrentProvider.getID().upper(), - curTorrentProvider.getID() + '_append_identifier', '[' + curTorrentProvider.name + ']') + curTorrentProvider.getID() + '_onlyspasearch', 0)) if hasattr(curTorrentProvider, 'sorting'): curTorrentProvider.sorting = check_setting_str(CFG, curTorrentProvider.getID().upper(), @@ -1777,6 +1775,7 @@ def save_config(): new_config['General']['require_words'] = REQUIRE_WORDS new_config['General']['ignored_subs_list'] = IGNORED_SUBS_LIST new_config['General']['calendar_unprotected'] = int(CALENDAR_UNPROTECTED) + new_config['General']['calendar_icons'] = int(CALENDAR_ICONS) new_config['General']['no_restart'] = int(NO_RESTART) new_config['General']['developer'] = int(DEVELOPER) new_config['General']['display_all_seasons'] = int(DISPLAY_ALL_SEASONS) @@ -1824,9 +1823,6 @@ def save_config(): if hasattr(curTorrentProvider, 'onlyspasearch'): new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_onlyspasearch'] = int( curTorrentProvider.onlyspasearch) - if hasattr(curTorrentProvider, 'append_identifier'): - new_config[curTorrentProvider.getID().upper()][ - curTorrentProvider.getID() + '_append_identifier'] = curTorrentProvider.append_identifier if hasattr(curTorrentProvider, 'sorting'): new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_sorting'] = curTorrentProvider.sorting if hasattr(curTorrentProvider, 'ratio'): diff --git a/sickbeard/providers/kat.py b/sickbeard/providers/kat.py old mode 100644 new mode 100755 index b2140dfe9b41af242de28358067543b5a0212dc3..c8e2490d6ca9cbcfd5648288cdc89ec6ccf92589 --- a/sickbeard/providers/kat.py +++ b/sickbeard/providers/kat.py @@ -20,7 +20,6 @@ import traceback -import datetime from urllib import urlencode import xmltodict @@ -50,8 +49,7 @@ class KATProvider(generic.TorrentProvider): self.urls = { 'base_url': 'https://kat.cr/', - 'search': 'https://kat.cr/usearch/', - 'rss': 'https://kat.cr/tv/', + 'search': 'https://kat.cr/%s/', } self.url = self.urls['base_url'] @@ -72,17 +70,23 @@ class KATProvider(generic.TorrentProvider): results = [] items = {'Season': [], 'Episode': [], 'RSS': []} + # select the correct category + anime = (self.show and self.show.anime) or (epObj and epObj.show and epObj.show.anime) or False + self.search_params['category'] = ('tv', 'anime')[anime] + for mode in search_strings.keys(): logger.log(u"Search Mode: %s" % mode, logger.DEBUG) for search_string in search_strings[mode]: - self.search_params.update({'q': search_string.encode('utf-8'), 'field': ('seeders', 'time_add')[mode == 'RSS']}) + self.search_params['q'] = search_string.encode('utf-8') if mode != 'RSS' else '' + self.search_params['field'] = 'seeders' if mode != 'RSS' else 'time_add' if mode != 'RSS': logger.log(u"Search string: %s" % search_string, logger.DEBUG) + url_fmt_string = 'usearch' if mode != 'RSS' else search_string try: - searchURL = self.urls[('search', 'rss')[mode == 'RSS']] + '?' + urlencode(self.search_params) + searchURL = self.urls['search'] % url_fmt_string + '?' + urlencode(self.search_params) logger.log(u"Search URL: %s" % searchURL, logger.DEBUG) data = self.getURL(searchURL) #data = self.getURL(self.urls[('search', 'rss')[mode == 'RSS']], params=self.search_params) @@ -96,7 +100,7 @@ class KATProvider(generic.TorrentProvider): try: data = xmltodict.parse(HTMLParser.HTMLParser().unescape(data.encode('utf-8')).replace('&', '&')) - except ExpatError as e: + except ExpatError: logger.log(u"Failed parsing provider. Traceback: %r\n%r" % (traceback.format_exc(), data), logger.ERROR) continue @@ -131,11 +135,6 @@ class KATProvider(generic.TorrentProvider): except (AttributeError, TypeError, KeyError): continue - try: - pubdate = datetime.datetime.strptime(item['pubDate'], '%a, %d %b %Y %H:%M:%S +0000') - except Exception: - pubdate = datetime.datetime.today() - if not all([title, download_url]): continue @@ -150,7 +149,7 @@ class KATProvider(generic.TorrentProvider): logger.log(u"Found result " + title + " but that doesn't seem like a verified result so I'm ignoring it", logger.DEBUG) continue - item = title, download_url, size, seeders, leechers + item = title, download_url, size, seeders, leechers, info_hash if mode != 'RSS': logger.log(u"Found result: %s " % title, logger.DEBUG) @@ -179,7 +178,7 @@ class KATCache(tvcache.TVCache): self.minTime = 20 def _getRSSData(self): - search_params = {'RSS': ['']} + search_params = {'RSS': ['tv', 'anime']} return {'entries': self.provider._doSearch(search_params)} provider = KATProvider() diff --git a/sickbeard/providers/newpct.py b/sickbeard/providers/newpct.py index 15e8447f7b8079c721f851dd658085e14ed14fe7..89f0563c3df866bf28146b5bf6d457a1758b171b 100644 --- a/sickbeard/providers/newpct.py +++ b/sickbeard/providers/newpct.py @@ -35,7 +35,6 @@ class newpctProvider(generic.TorrentProvider): self.supportsBacklog = True self.onlyspasearch = None - self.append_identifier = None self.cache = newpctCache(self) self.urls = { @@ -173,9 +172,6 @@ class newpctProvider(generic.TorrentProvider): title = title.replace('[BluRay MicroHD]', '[1080p BlueRay x264]') title = title.replace('[MicroHD 1080p]', '[1080p BlueRay x264]') - #Append identifier - title = title + self.append_identifier - return title diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index c92d85cf008d889f582002f7df11e31009a9f15d..69689ea9c99ccb82635df2ef16098847402e7af6 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -558,6 +558,9 @@ class CalendarHandler(BaseHandler): ical += 'DTEND:' + air_date_time_end.strftime( "%Y%m%d") + 'T' + air_date_time_end.strftime( "%H%M%S") + 'Z\r\n' + if sickbeard.CALENDAR_ICONS: + ical += 'X-GOOGLE-CALENDAR-CONTENT-ICON:https://lh3.googleusercontent.com/-Vp_3ZosvTgg/VjiFu5BzQqI/AAAAAAAA_TY/3ZL_1bC0Pgw/s16-Ic42/SickRage.png\r\n' + ical += 'X-GOOGLE-CALENDAR-CONTENT-DISPLAY:CHIP\r\n' ical += u'SUMMARY: {0} - {1}x{2} - {3}\r\n'.format( show['show_name'], episode['season'], episode['episode'], episode['name'] ) @@ -3638,7 +3641,7 @@ class ConfigGeneral(Config): web_password=None, version_notify=None, enable_https=None, https_cert=None, https_key=None, handle_reverse_proxy=None, sort_article=None, auto_update=None, notify_on_update=None, proxy_setting=None, proxy_indexers=None, anon_redirect=None, git_path=None, git_remote=None, - calendar_unprotected=None, debug=None, ssl_verify=None, no_restart=None, coming_eps_missed_range=None, + calendar_unprotected=None, calendar_icons=None, debug=None, ssl_verify=None, no_restart=None, coming_eps_missed_range=None, filter_row=None, fuzzy_dating=None, trim_zero=None, date_preset=None, date_preset_na=None, time_preset=None, indexer_timeout=None, download_url=None, rootDir=None, theme_name=None, default_page=None, git_reset=None, git_username=None, git_password=None, git_autoissues=None, display_all_seasons=None): @@ -3677,6 +3680,7 @@ class ConfigGeneral(Config): sickbeard.GIT_PATH = git_path sickbeard.GIT_REMOTE = git_remote sickbeard.CALENDAR_UNPROTECTED = config.checkbox_to_value(calendar_unprotected) + sickbeard.CALENDAR_ICONS = config.checkbox_to_value(calendar_icons) sickbeard.NO_RESTART = config.checkbox_to_value(no_restart) sickbeard.DEBUG = config.checkbox_to_value(debug) sickbeard.SSL_VERIFY = config.checkbox_to_value(ssl_verify) @@ -3712,9 +3716,7 @@ class ConfigGeneral(Config): sickbeard.TIME_PRESET_W_SECONDS = time_preset sickbeard.TIME_PRESET = sickbeard.TIME_PRESET_W_SECONDS.replace(u":%S", u"") - #Force all users to use local - #sickbeard.TIMEZONE_DISPLAY = timezone_display - sickbeard.TIMEZONE_DISPLAY = 'local' + sickbeard.TIMEZONE_DISPLAY = timezone_display if not config.change_LOG_DIR(log_dir, web_log): @@ -4484,12 +4486,6 @@ class ConfigProviders(Config): except: curTorrentProvider.onlyspasearch = 0 - if hasattr(curTorrentProvider, 'append_identifier'): - try: - curTorrentProvider.append_identifier = str(kwargs[curTorrentProvider.getID() + '_append_identifier']).strip() - except: - curTorrentProvider.append_identifier = None - if hasattr(curTorrentProvider, 'sorting'): try: curTorrentProvider.sorting = str(kwargs[curTorrentProvider.getID() + '_sorting']).strip()