|
|
|
# Author: Nic Wolfe <nic@wolfeden.ca>
|
|
|
|
# URL: http://code.google.com/p/sickbeard/
|
|
|
|
#
|
|
|
|
# This file is part of SickGear.
|
|
|
|
#
|
|
|
|
# SickGear 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.
|
|
|
|
#
|
|
|
|
# SickGear 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 SickGear. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
import datetime
|
|
|
|
import os
|
|
|
|
import traceback
|
|
|
|
|
|
|
|
import exceptions_helper
|
|
|
|
from exceptions_helper import ex
|
|
|
|
# noinspection PyPep8Naming
|
|
|
|
import encodingKludge as ek
|
|
|
|
|
|
|
|
import sickbeard
|
|
|
|
from . import db, logger, network_timezones, properFinder, ui
|
|
|
|
|
|
|
|
# noinspection PyUnreachableCode
|
|
|
|
if False:
|
|
|
|
from sickbeard.tv import TVShow
|
|
|
|
|
|
|
|
|
|
|
|
def clean_ignore_require_words():
|
|
|
|
"""
|
|
|
|
removes duplicate ignore/require words from shows and global lists
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
for s in sickbeard.showList: # type: TVShow
|
|
|
|
# test before set to prevent dirty setter from setting unchanged shows to dirty
|
|
|
|
if s.rls_ignore_words - sickbeard.IGNORE_WORDS != s.rls_ignore_words:
|
|
|
|
s.rls_ignore_words -= sickbeard.IGNORE_WORDS
|
|
|
|
if 0 == len(s.rls_ignore_words):
|
|
|
|
s.rls_ignore_words_regex = False
|
|
|
|
if s.rls_require_words - sickbeard.REQUIRE_WORDS != s.rls_require_words:
|
|
|
|
s.rls_require_words -= sickbeard.REQUIRE_WORDS
|
|
|
|
if 0 == len(s.rls_require_words):
|
|
|
|
s.rls_require_words_regex = False
|
|
|
|
if s.rls_global_exclude_ignore & sickbeard.IGNORE_WORDS != s.rls_global_exclude_ignore:
|
|
|
|
s.rls_global_exclude_ignore &= sickbeard.IGNORE_WORDS
|
|
|
|
if s.rls_global_exclude_require & sickbeard.REQUIRE_WORDS != s.rls_global_exclude_require:
|
|
|
|
s.rls_global_exclude_require &= sickbeard.REQUIRE_WORDS
|
|
|
|
if s.dirty:
|
|
|
|
s.save_to_db()
|
|
|
|
except (BaseException, Exception):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class ShowUpdater(object):
|
|
|
|
def __init__(self):
|
|
|
|
self.amActive = False
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
|
|
|
|
self.amActive = True
|
|
|
|
|
|
|
|
try:
|
|
|
|
update_datetime = datetime.datetime.now()
|
|
|
|
update_date = update_datetime.date()
|
|
|
|
|
|
|
|
# backup db's
|
|
|
|
if sickbeard.db.db_supports_backup and 0 < sickbeard.BACKUP_DB_MAX_COUNT:
|
|
|
|
logger.log('backing up all db\'s')
|
|
|
|
try:
|
|
|
|
sickbeard.db.backup_all_dbs(sickbeard.BACKUP_DB_PATH or
|
|
|
|
ek.ek(os.path.join, sickbeard.DATA_DIR, 'backup'))
|
|
|
|
except (BaseException, Exception):
|
|
|
|
logger.log('backup db error', logger.ERROR)
|
|
|
|
|
|
|
|
# refresh network timezones
|
|
|
|
try:
|
|
|
|
network_timezones.update_network_dict()
|
|
|
|
except (BaseException, Exception):
|
|
|
|
logger.log('network timezone update error', logger.ERROR)
|
|
|
|
logger.log(traceback.format_exc(), logger.ERROR)
|
|
|
|
|
|
|
|
# refresh webdl types
|
|
|
|
try:
|
|
|
|
properFinder.load_webdl_types()
|
|
|
|
except (BaseException, Exception):
|
|
|
|
logger.log('error loading webdl_types', logger.DEBUG)
|
|
|
|
|
|
|
|
# update xem id lists
|
|
|
|
try:
|
|
|
|
sickbeard.scene_exceptions.get_xem_ids()
|
|
|
|
except (BaseException, Exception):
|
|
|
|
logger.log('xem id list update error', logger.ERROR)
|
|
|
|
logger.log(traceback.format_exc(), logger.ERROR)
|
|
|
|
|
|
|
|
# update scene exceptions
|
|
|
|
try:
|
|
|
|
sickbeard.scene_exceptions.retrieve_exceptions()
|
|
|
|
except (BaseException, Exception):
|
|
|
|
logger.log('scene exceptions update error', logger.ERROR)
|
|
|
|
logger.log(traceback.format_exc(), logger.ERROR)
|
|
|
|
|
|
|
|
# clear the data of unused providers
|
|
|
|
try:
|
|
|
|
sickbeard.helpers.clear_unused_providers()
|
|
|
|
except (BaseException, Exception):
|
|
|
|
logger.log('unused provider cleanup error', logger.ERROR)
|
|
|
|
logger.log(traceback.format_exc(), logger.ERROR)
|
|
|
|
|
|
|
|
# cleanup image cache
|
|
|
|
try:
|
|
|
|
sickbeard.helpers.cleanup_cache()
|
|
|
|
except (BaseException, Exception):
|
|
|
|
logger.log('image cache cleanup error', logger.ERROR)
|
|
|
|
logger.log(traceback.format_exc(), logger.ERROR)
|
|
|
|
|
Add support for multiple TV info sources.
Changelog
---------
Change improve loading speed of shows at startup.
Change improve main execution loop speed.
Add force cast update to view show page.
Add person view.
Add character view.
Add characters, person to clean-up cache (30 days).
Add reload person, character images every 7 days.
Add suppress UI notification for scheduled people updates during show updates and during switching ids.
Add resume support of switched shows after restart that switched id but not finished updating.
Add failed TV info switches to show tasks page.
Add remove item from queue and clear queue test buttons to mange/show-tasks and manage/search-tasks.
Change improve show update logic.
Add to view-show page a notification message if a show fails to switch.
Add check for existing show with new id pair before switching.
Change prioritize first episode start year over the start year set at the tv info source.
Change delete non existing episodes when switching indexer.
Change "exists in db" link on search results page to support any info source.
Add TMDB person pics as fallback.
Add use person fallback for character images.
Add logic to add start, end year in case of multiple characters per person.
Change improve speed getting list in the import view.
Add abort people cast update when show is deleted, also remove show from any queued show item or search item
Support list of names to search for in show search.
Change assist user search terms when the actual title of a show is unknown.
Add support URLs in search.
Change remove year from search term ... year is still used for relevancy order.
Add updating show.nfo when a cast changes.
Change use longest biography available for output.
Add UI requests of details for feb 28 will also return feb 29 in years without feb 29.
Add fetch extra data fallback from TMDB for persons.
technical commit messages (combined commits)
--------------------------------------------
Add tmdb get_trending, get_popular, get_top_rated, discover to tvinfoapi.
Add home/get_persons ajax endpoint, currently supports: birthday, deathday, names.
Change daily-schedule to new get_episode_time - More TODO
Change view-show to use get_episode_time.
Add get show updates list in show updater.
Add get_episode_time to network_timezones.
Add airtime for episode and show to get_episode_time.
Small ep obj load performance improvement.
Add handle special episodes and assign numbers based on airdate.
Add handle tvmaze specials without airdate.
Change during switch tv info source, specials are removed from db because of non-existing generic numbering.
Change add first/latest regular episode, use first_aired_regular_episode in all places that have airdate of first episode.
Add IMDb to person interface.
Add akas to person.
Add IMDb bio parser.
Add TMDB api for people.
Add character role start/end year to IMDb api and tv character.
Fix updating characters with multiple persons, by limiting to one.
Add cache to imdb_api.py.
Add cache to tmdb_api: get_person, _search_person.
Add cache to trakt get_person, _search_person cache.
Improve main execution loop speed https://stackify.com/20-simple-python-performance-tuning-tips/ point: 12
Add network to episode for tvdb_api (from show data).
Add fallback for network/timezone for tv episode to tv show.
Add skip retrieve_exceptions for tv info sources that don't have 'scene_url'.
Change move network load before show load to make sure the tvshow obj timezone can be set (startup).
Add datetime.time to/from integer to sbdatetime (hour, minute only).
Add load all indexer mapping at once from db during startup.
Add load the failed count during startup.
Change move sanitize_filename to sg_helpers.
Change move download_file to sg_helpers.
Add list_tables, list_indexes to db.py.
Add multi db column add function.
Restore backup tables during upgrade.
Use lib.tvinfo_base import everywhere.
Add new properties to tvepisode.
Add show_updates to indexer endpoint.
Add new db schema.
Add Character and Persons tables.
Add tvmaze_api lib.
Add pytvmaze lib.
Add debug __repr__ to people/show queue.
Add crew to show tvinfo_base.
Drop backup tables for now.
Don't save switch refresh, update show queue items (since they are sub queues of switch).
Remove show from switched_shows in case it is in it when deleting the show.
Use switch queue for manual switch
Load/save updated time for person/Character.
Add show_queue table.
Add _get_item_sql, _delete_item_from_db_sql to search search_queue.
Add people_queue type.
Add people scheduler.
Add people queue.
Add tvinfo source switch queue item.
Alternate naming for person/character images.
Add load and save image/thumb urls for persons.
Add load character pics.
Add save images for characters.
Add save image urls for characters to db.
Change limit for person searches to 100 instead of 10 default.
Add person verification.
Add people_url and character_url to sources that support them.
Add save castlist changes.
Add remove old characters from castlist.
Change optimize find_show_by_id.
Change improve debug info for person, character obj.
Add db_support_upsert support flag in db.py.
Add cast list objs and load from db.
Add parse and add additional images to TVInfo.
Add optional loading of images and actors/crew.
Fix _make_timestamp in py2.
Save and load _src_update_time.
Change use update time for show updates.
Add _set_network optimization.
Add src_update_timestamp to tvshow tbl.
Add updated_timestamp to TVInfoShow.
Add _indexer_update_time TVShow obj.
Add support to search for external ids on TV info sources: [TVINFO_TVDB, TVINFO_IMDb, TVINFO_TMDB, TVINFO_TRAKT].
Change show tasks page, keep remove button for failed switches always visible.
Add use get_url for tvmaze_api interface (to support failure handling), without changing original lib.
Add missing settings in switch show.
Add new switch error: TVSWITCH_ID_CONFLICT: 'new id conflicts with existing show'.
Add messages for manual switch id.
Add connection skip handling.
Add get_url failure handling to Trakt lib.
Add real search_person to tvinfo interface.
Change move TMDB api key to tmdb_api.
Add get_url usage via tmdb_api.
Change join/split of akas/join and sql group_concat to `;;;` to prevent issues with names that may contain comma (`,`).
Add Trakt api specific failure times.
Add warning about reassigning MEMCACHE
Add calc_age to sg_helpers for person page to remove dupe code.
Add return age in ajax for persons.
Change format dates on person page to honour config/General.
Add convert_to_inch_fraction_html to sg_helpers.
Change direct assign method instead of wrapper (faster).
Change force disk_pickle_protocol=2 for py2 compatibility in tvinfo cache.
Add episode rename info during switch.
Add save deleted episodes when switching tvinfo source.
Add get_switch_changed page.
Add force=True to QueueItemRefresh during switch of tvinfo to force rewriting of metadata.
Add filter character dupes in tvdb_api only take images for unique character, role combos on tvdb.
Fix humanize lib in py27.
Add diskcache to tvinfo_base.
Add doc files for diskcache lib.
Add clean tvinfo to show_updater.
Add switch_ep_errors table to sickbeard.db
Add debug log message when extra data is fetched for a person.
Change make character loading more efficient.
Add placeholder image for characters and persons.
Change start, end year moved to new extra table to support multiple person per character.
Change replace start_year, end_year with persons_years in Character class.
Add new table character_person_years, change table structure characters.
Add check if show is found for switch pages.
Add missing scheduled to cache.db people queue table.
Change trakt show search now will ignore failure handling, to make sure it's always tried when searching for shows.
Change add/improve tvmaze id cross search.
Change improve search, if only ids are given, resulting seriesnames on source will be used as text search on following tvinfo sources.
Add new parameter: prefer_person to imagecache/character endpoint.
Add if prefer_person is set and person_id is set to valid person and the character has more then 1 person assigned the character image will not be returned, instead the actors image or the placeholder.
Add only take external ids if character is confirmed in logic.
Add match name instead of person id for checking same person in show when adding cast for sources without person id (tvdb)
Add cache tmdb genres directly in dict for performance.
4 years ago
|
|
|
# check tvinfo cache
|
|
|
|
try:
|
|
|
|
for i in sickbeard.TVInfoAPI().all_sources:
|
|
|
|
sickbeard.TVInfoAPI(i).setup().check_cache()
|
|
|
|
except (BaseException, Exception):
|
|
|
|
logger.log('tvinfo cache check error', logger.ERROR)
|
|
|
|
logger.log(traceback.format_exc(), logger.ERROR)
|
|
|
|
|
|
|
|
# cleanup tvinfo cache
|
|
|
|
try:
|
|
|
|
for i in sickbeard.TVInfoAPI().all_sources:
|
|
|
|
sickbeard.TVInfoAPI(i).setup().clean_cache()
|
|
|
|
except (BaseException, Exception):
|
|
|
|
logger.log('tvinfo cache cleanup error', logger.ERROR)
|
|
|
|
logger.log(traceback.format_exc(), logger.ERROR)
|
|
|
|
|
|
|
|
# cleanup ignore and require lists
|
|
|
|
try:
|
|
|
|
clean_ignore_require_words()
|
|
|
|
except Exception:
|
|
|
|
logger.log('ignore, require words cleanup error', logger.ERROR)
|
|
|
|
logger.log(traceback.format_exc(), logger.ERROR)
|
|
|
|
|
|
|
|
# cleanup manual search history
|
|
|
|
sickbeard.search_queue.remove_old_fifo(sickbeard.search_queue.MANUAL_SEARCH_HISTORY)
|
|
|
|
|
|
|
|
# add missing mapped ids
|
|
|
|
if not sickbeard.background_mapping_task.is_alive():
|
|
|
|
logger.log(u'Updating the TV info mappings')
|
|
|
|
import threading
|
|
|
|
try:
|
|
|
|
sickbeard.background_mapping_task = threading.Thread(
|
|
|
|
name='MAPPINGSUPDATER', target=sickbeard.indexermapper.load_mapped_ids, kwargs={'update': True})
|
|
|
|
sickbeard.background_mapping_task.start()
|
|
|
|
except (BaseException, Exception):
|
|
|
|
logger.log('missing mapped ids update error', logger.ERROR)
|
|
|
|
logger.log(traceback.format_exc(), logger.ERROR)
|
|
|
|
|
|
|
|
logger.log(u'Doing full update on all shows')
|
|
|
|
|
|
|
|
# clean out cache directory, remove everything > 12 hours old
|
|
|
|
try:
|
|
|
|
sickbeard.helpers.clear_cache()
|
|
|
|
except (BaseException, Exception):
|
|
|
|
logger.log('cache dir cleanup error', logger.ERROR)
|
|
|
|
logger.log(traceback.format_exc(), logger.ERROR)
|
|
|
|
|
|
|
|
# select 10 'Ended' tv_shows updated more than 90 days ago
|
|
|
|
# and all shows not updated more then 180 days ago to include in this update
|
|
|
|
stale_should_update = []
|
|
|
|
stale_update_date = (update_date - datetime.timedelta(days=90)).toordinal()
|
|
|
|
stale_update_date_max = (update_date - datetime.timedelta(days=180)).toordinal()
|
|
|
|
|
|
|
|
# last_update_date <= 90 days, sorted ASC because dates are ordinal
|
|
|
|
from sickbeard.tv import TVidProdid
|
|
|
|
my_db = db.DBConnection()
|
|
|
|
# noinspection SqlRedundantOrderingDirection
|
|
|
|
mass_sql_result = my_db.mass_action([
|
|
|
|
['SELECT indexer || ? || indexer_id AS tvid_prodid'
|
|
|
|
' FROM tv_shows'
|
|
|
|
' WHERE last_update_indexer <= ?'
|
|
|
|
' AND last_update_indexer >= ?'
|
|
|
|
' ORDER BY last_update_indexer ASC LIMIT 10;',
|
|
|
|
[TVidProdid.glue, stale_update_date, stale_update_date_max]],
|
|
|
|
['SELECT indexer || ? || indexer_id AS tvid_prodid'
|
|
|
|
' FROM tv_shows'
|
|
|
|
' WHERE last_update_indexer < ?;',
|
|
|
|
[TVidProdid.glue, stale_update_date_max]]])
|
|
|
|
|
|
|
|
for sql_result in mass_sql_result:
|
|
|
|
for cur_result in sql_result:
|
|
|
|
stale_should_update.append(cur_result['tvid_prodid'])
|
|
|
|
|
|
|
|
# start update process
|
Add support for multiple TV info sources.
Changelog
---------
Change improve loading speed of shows at startup.
Change improve main execution loop speed.
Add force cast update to view show page.
Add person view.
Add character view.
Add characters, person to clean-up cache (30 days).
Add reload person, character images every 7 days.
Add suppress UI notification for scheduled people updates during show updates and during switching ids.
Add resume support of switched shows after restart that switched id but not finished updating.
Add failed TV info switches to show tasks page.
Add remove item from queue and clear queue test buttons to mange/show-tasks and manage/search-tasks.
Change improve show update logic.
Add to view-show page a notification message if a show fails to switch.
Add check for existing show with new id pair before switching.
Change prioritize first episode start year over the start year set at the tv info source.
Change delete non existing episodes when switching indexer.
Change "exists in db" link on search results page to support any info source.
Add TMDB person pics as fallback.
Add use person fallback for character images.
Add logic to add start, end year in case of multiple characters per person.
Change improve speed getting list in the import view.
Add abort people cast update when show is deleted, also remove show from any queued show item or search item
Support list of names to search for in show search.
Change assist user search terms when the actual title of a show is unknown.
Add support URLs in search.
Change remove year from search term ... year is still used for relevancy order.
Add updating show.nfo when a cast changes.
Change use longest biography available for output.
Add UI requests of details for feb 28 will also return feb 29 in years without feb 29.
Add fetch extra data fallback from TMDB for persons.
technical commit messages (combined commits)
--------------------------------------------
Add tmdb get_trending, get_popular, get_top_rated, discover to tvinfoapi.
Add home/get_persons ajax endpoint, currently supports: birthday, deathday, names.
Change daily-schedule to new get_episode_time - More TODO
Change view-show to use get_episode_time.
Add get show updates list in show updater.
Add get_episode_time to network_timezones.
Add airtime for episode and show to get_episode_time.
Small ep obj load performance improvement.
Add handle special episodes and assign numbers based on airdate.
Add handle tvmaze specials without airdate.
Change during switch tv info source, specials are removed from db because of non-existing generic numbering.
Change add first/latest regular episode, use first_aired_regular_episode in all places that have airdate of first episode.
Add IMDb to person interface.
Add akas to person.
Add IMDb bio parser.
Add TMDB api for people.
Add character role start/end year to IMDb api and tv character.
Fix updating characters with multiple persons, by limiting to one.
Add cache to imdb_api.py.
Add cache to tmdb_api: get_person, _search_person.
Add cache to trakt get_person, _search_person cache.
Improve main execution loop speed https://stackify.com/20-simple-python-performance-tuning-tips/ point: 12
Add network to episode for tvdb_api (from show data).
Add fallback for network/timezone for tv episode to tv show.
Add skip retrieve_exceptions for tv info sources that don't have 'scene_url'.
Change move network load before show load to make sure the tvshow obj timezone can be set (startup).
Add datetime.time to/from integer to sbdatetime (hour, minute only).
Add load all indexer mapping at once from db during startup.
Add load the failed count during startup.
Change move sanitize_filename to sg_helpers.
Change move download_file to sg_helpers.
Add list_tables, list_indexes to db.py.
Add multi db column add function.
Restore backup tables during upgrade.
Use lib.tvinfo_base import everywhere.
Add new properties to tvepisode.
Add show_updates to indexer endpoint.
Add new db schema.
Add Character and Persons tables.
Add tvmaze_api lib.
Add pytvmaze lib.
Add debug __repr__ to people/show queue.
Add crew to show tvinfo_base.
Drop backup tables for now.
Don't save switch refresh, update show queue items (since they are sub queues of switch).
Remove show from switched_shows in case it is in it when deleting the show.
Use switch queue for manual switch
Load/save updated time for person/Character.
Add show_queue table.
Add _get_item_sql, _delete_item_from_db_sql to search search_queue.
Add people_queue type.
Add people scheduler.
Add people queue.
Add tvinfo source switch queue item.
Alternate naming for person/character images.
Add load and save image/thumb urls for persons.
Add load character pics.
Add save images for characters.
Add save image urls for characters to db.
Change limit for person searches to 100 instead of 10 default.
Add person verification.
Add people_url and character_url to sources that support them.
Add save castlist changes.
Add remove old characters from castlist.
Change optimize find_show_by_id.
Change improve debug info for person, character obj.
Add db_support_upsert support flag in db.py.
Add cast list objs and load from db.
Add parse and add additional images to TVInfo.
Add optional loading of images and actors/crew.
Fix _make_timestamp in py2.
Save and load _src_update_time.
Change use update time for show updates.
Add _set_network optimization.
Add src_update_timestamp to tvshow tbl.
Add updated_timestamp to TVInfoShow.
Add _indexer_update_time TVShow obj.
Add support to search for external ids on TV info sources: [TVINFO_TVDB, TVINFO_IMDb, TVINFO_TMDB, TVINFO_TRAKT].
Change show tasks page, keep remove button for failed switches always visible.
Add use get_url for tvmaze_api interface (to support failure handling), without changing original lib.
Add missing settings in switch show.
Add new switch error: TVSWITCH_ID_CONFLICT: 'new id conflicts with existing show'.
Add messages for manual switch id.
Add connection skip handling.
Add get_url failure handling to Trakt lib.
Add real search_person to tvinfo interface.
Change move TMDB api key to tmdb_api.
Add get_url usage via tmdb_api.
Change join/split of akas/join and sql group_concat to `;;;` to prevent issues with names that may contain comma (`,`).
Add Trakt api specific failure times.
Add warning about reassigning MEMCACHE
Add calc_age to sg_helpers for person page to remove dupe code.
Add return age in ajax for persons.
Change format dates on person page to honour config/General.
Add convert_to_inch_fraction_html to sg_helpers.
Change direct assign method instead of wrapper (faster).
Change force disk_pickle_protocol=2 for py2 compatibility in tvinfo cache.
Add episode rename info during switch.
Add save deleted episodes when switching tvinfo source.
Add get_switch_changed page.
Add force=True to QueueItemRefresh during switch of tvinfo to force rewriting of metadata.
Add filter character dupes in tvdb_api only take images for unique character, role combos on tvdb.
Fix humanize lib in py27.
Add diskcache to tvinfo_base.
Add doc files for diskcache lib.
Add clean tvinfo to show_updater.
Add switch_ep_errors table to sickbeard.db
Add debug log message when extra data is fetched for a person.
Change make character loading more efficient.
Add placeholder image for characters and persons.
Change start, end year moved to new extra table to support multiple person per character.
Change replace start_year, end_year with persons_years in Character class.
Add new table character_person_years, change table structure characters.
Add check if show is found for switch pages.
Add missing scheduled to cache.db people queue table.
Change trakt show search now will ignore failure handling, to make sure it's always tried when searching for shows.
Change add/improve tvmaze id cross search.
Change improve search, if only ids are given, resulting seriesnames on source will be used as text search on following tvinfo sources.
Add new parameter: prefer_person to imagecache/character endpoint.
Add if prefer_person is set and person_id is set to valid person and the character has more then 1 person assigned the character image will not be returned, instead the actors image or the placeholder.
Add only take external ids if character is confirmed in logic.
Add match name instead of person id for checking same person in show when adding cast for sources without person id (tvdb)
Add cache tmdb genres directly in dict for performance.
4 years ago
|
|
|
show_updates = {}
|
|
|
|
for src in sickbeard.TVInfoAPI().search_sources:
|
|
|
|
tvinfo_config = sickbeard.TVInfoAPI(src).api_params.copy()
|
|
|
|
t = sickbeard.TVInfoAPI(src).setup(**tvinfo_config)
|
|
|
|
show_updates.update({src: t.get_updated_shows()})
|
|
|
|
|
|
|
|
pi_list = []
|
|
|
|
for cur_show_obj in sickbeard.showList: # type: sickbeard.tv.TVShow
|
|
|
|
|
|
|
|
try:
|
|
|
|
# if should_update returns True (not 'Ended') or show is selected stale 'Ended' then update,
|
|
|
|
# otherwise just refresh
|
Add support for multiple TV info sources.
Changelog
---------
Change improve loading speed of shows at startup.
Change improve main execution loop speed.
Add force cast update to view show page.
Add person view.
Add character view.
Add characters, person to clean-up cache (30 days).
Add reload person, character images every 7 days.
Add suppress UI notification for scheduled people updates during show updates and during switching ids.
Add resume support of switched shows after restart that switched id but not finished updating.
Add failed TV info switches to show tasks page.
Add remove item from queue and clear queue test buttons to mange/show-tasks and manage/search-tasks.
Change improve show update logic.
Add to view-show page a notification message if a show fails to switch.
Add check for existing show with new id pair before switching.
Change prioritize first episode start year over the start year set at the tv info source.
Change delete non existing episodes when switching indexer.
Change "exists in db" link on search results page to support any info source.
Add TMDB person pics as fallback.
Add use person fallback for character images.
Add logic to add start, end year in case of multiple characters per person.
Change improve speed getting list in the import view.
Add abort people cast update when show is deleted, also remove show from any queued show item or search item
Support list of names to search for in show search.
Change assist user search terms when the actual title of a show is unknown.
Add support URLs in search.
Change remove year from search term ... year is still used for relevancy order.
Add updating show.nfo when a cast changes.
Change use longest biography available for output.
Add UI requests of details for feb 28 will also return feb 29 in years without feb 29.
Add fetch extra data fallback from TMDB for persons.
technical commit messages (combined commits)
--------------------------------------------
Add tmdb get_trending, get_popular, get_top_rated, discover to tvinfoapi.
Add home/get_persons ajax endpoint, currently supports: birthday, deathday, names.
Change daily-schedule to new get_episode_time - More TODO
Change view-show to use get_episode_time.
Add get show updates list in show updater.
Add get_episode_time to network_timezones.
Add airtime for episode and show to get_episode_time.
Small ep obj load performance improvement.
Add handle special episodes and assign numbers based on airdate.
Add handle tvmaze specials without airdate.
Change during switch tv info source, specials are removed from db because of non-existing generic numbering.
Change add first/latest regular episode, use first_aired_regular_episode in all places that have airdate of first episode.
Add IMDb to person interface.
Add akas to person.
Add IMDb bio parser.
Add TMDB api for people.
Add character role start/end year to IMDb api and tv character.
Fix updating characters with multiple persons, by limiting to one.
Add cache to imdb_api.py.
Add cache to tmdb_api: get_person, _search_person.
Add cache to trakt get_person, _search_person cache.
Improve main execution loop speed https://stackify.com/20-simple-python-performance-tuning-tips/ point: 12
Add network to episode for tvdb_api (from show data).
Add fallback for network/timezone for tv episode to tv show.
Add skip retrieve_exceptions for tv info sources that don't have 'scene_url'.
Change move network load before show load to make sure the tvshow obj timezone can be set (startup).
Add datetime.time to/from integer to sbdatetime (hour, minute only).
Add load all indexer mapping at once from db during startup.
Add load the failed count during startup.
Change move sanitize_filename to sg_helpers.
Change move download_file to sg_helpers.
Add list_tables, list_indexes to db.py.
Add multi db column add function.
Restore backup tables during upgrade.
Use lib.tvinfo_base import everywhere.
Add new properties to tvepisode.
Add show_updates to indexer endpoint.
Add new db schema.
Add Character and Persons tables.
Add tvmaze_api lib.
Add pytvmaze lib.
Add debug __repr__ to people/show queue.
Add crew to show tvinfo_base.
Drop backup tables for now.
Don't save switch refresh, update show queue items (since they are sub queues of switch).
Remove show from switched_shows in case it is in it when deleting the show.
Use switch queue for manual switch
Load/save updated time for person/Character.
Add show_queue table.
Add _get_item_sql, _delete_item_from_db_sql to search search_queue.
Add people_queue type.
Add people scheduler.
Add people queue.
Add tvinfo source switch queue item.
Alternate naming for person/character images.
Add load and save image/thumb urls for persons.
Add load character pics.
Add save images for characters.
Add save image urls for characters to db.
Change limit for person searches to 100 instead of 10 default.
Add person verification.
Add people_url and character_url to sources that support them.
Add save castlist changes.
Add remove old characters from castlist.
Change optimize find_show_by_id.
Change improve debug info for person, character obj.
Add db_support_upsert support flag in db.py.
Add cast list objs and load from db.
Add parse and add additional images to TVInfo.
Add optional loading of images and actors/crew.
Fix _make_timestamp in py2.
Save and load _src_update_time.
Change use update time for show updates.
Add _set_network optimization.
Add src_update_timestamp to tvshow tbl.
Add updated_timestamp to TVInfoShow.
Add _indexer_update_time TVShow obj.
Add support to search for external ids on TV info sources: [TVINFO_TVDB, TVINFO_IMDb, TVINFO_TMDB, TVINFO_TRAKT].
Change show tasks page, keep remove button for failed switches always visible.
Add use get_url for tvmaze_api interface (to support failure handling), without changing original lib.
Add missing settings in switch show.
Add new switch error: TVSWITCH_ID_CONFLICT: 'new id conflicts with existing show'.
Add messages for manual switch id.
Add connection skip handling.
Add get_url failure handling to Trakt lib.
Add real search_person to tvinfo interface.
Change move TMDB api key to tmdb_api.
Add get_url usage via tmdb_api.
Change join/split of akas/join and sql group_concat to `;;;` to prevent issues with names that may contain comma (`,`).
Add Trakt api specific failure times.
Add warning about reassigning MEMCACHE
Add calc_age to sg_helpers for person page to remove dupe code.
Add return age in ajax for persons.
Change format dates on person page to honour config/General.
Add convert_to_inch_fraction_html to sg_helpers.
Change direct assign method instead of wrapper (faster).
Change force disk_pickle_protocol=2 for py2 compatibility in tvinfo cache.
Add episode rename info during switch.
Add save deleted episodes when switching tvinfo source.
Add get_switch_changed page.
Add force=True to QueueItemRefresh during switch of tvinfo to force rewriting of metadata.
Add filter character dupes in tvdb_api only take images for unique character, role combos on tvdb.
Fix humanize lib in py27.
Add diskcache to tvinfo_base.
Add doc files for diskcache lib.
Add clean tvinfo to show_updater.
Add switch_ep_errors table to sickbeard.db
Add debug log message when extra data is fetched for a person.
Change make character loading more efficient.
Add placeholder image for characters and persons.
Change start, end year moved to new extra table to support multiple person per character.
Change replace start_year, end_year with persons_years in Character class.
Add new table character_person_years, change table structure characters.
Add check if show is found for switch pages.
Add missing scheduled to cache.db people queue table.
Change trakt show search now will ignore failure handling, to make sure it's always tried when searching for shows.
Change add/improve tvmaze id cross search.
Change improve search, if only ids are given, resulting seriesnames on source will be used as text search on following tvinfo sources.
Add new parameter: prefer_person to imagecache/character endpoint.
Add if prefer_person is set and person_id is set to valid person and the character has more then 1 person assigned the character image will not be returned, instead the actors image or the placeholder.
Add only take external ids if character is confirmed in logic.
Add match name instead of person id for checking same person in show when adding cast for sources without person id (tvdb)
Add cache tmdb genres directly in dict for performance.
4 years ago
|
|
|
if cur_show_obj.should_update(update_date=update_date,
|
|
|
|
last_indexer_change=show_updates.get(cur_show_obj.tvid, {}).
|
|
|
|
get(cur_show_obj.prodid)) \
|
|
|
|
or cur_show_obj.tvid_prodid in stale_should_update:
|
|
|
|
cur_queue_item = sickbeard.show_queue_scheduler.action.updateShow(cur_show_obj,
|
|
|
|
scheduled_update=True)
|
|
|
|
else:
|
|
|
|
logger.debug(u'Not updating episodes for show %s because it\'s marked as ended and last/next'
|
|
|
|
u' episode is not within the grace period.' % cur_show_obj.unique_name)
|
|
|
|
cur_queue_item = sickbeard.show_queue_scheduler.action.refreshShow(cur_show_obj, True, True)
|
|
|
|
|
|
|
|
pi_list.append(cur_queue_item)
|
|
|
|
|
|
|
|
except (exceptions_helper.CantUpdateException, exceptions_helper.CantRefreshException) as e:
|
|
|
|
logger.log(u'Automatic update failed: ' + ex(e), logger.ERROR)
|
|
|
|
|
|
|
|
if len(pi_list):
|
|
|
|
sickbeard.show_queue_scheduler.action.daily_update_running = True
|
|
|
|
|
|
|
|
ui.ProgressIndicators.setIndicator('dailyUpdate', ui.QueueProgressIndicator('Daily Update', pi_list))
|
|
|
|
|
|
|
|
logger.log(u'Added all shows to show queue for full update')
|
|
|
|
|
|
|
|
finally:
|
|
|
|
self.amActive = False
|
|
|
|
|
|
|
|
def __del__(self):
|
|
|
|
pass
|