2014-03-10 05:18:05 +00:00
|
|
|
# Author: Nic Wolfe <nic@wolfeden.ca>
|
|
|
|
# URL: http://code.google.com/p/sickbeard/
|
|
|
|
#
|
2014-11-12 16:43:14 +00:00
|
|
|
# This file is part of SickGear.
|
2014-03-10 05:18:05 +00:00
|
|
|
#
|
2014-11-12 16:43:14 +00:00
|
|
|
# SickGear is free software: you can redistribute it and/or modify
|
2014-03-10 05:18:05 +00:00
|
|
|
# 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.
|
|
|
|
#
|
2014-11-12 16:43:14 +00:00
|
|
|
# SickGear is distributed in the hope that it will be useful,
|
2014-03-10 05:18:05 +00:00
|
|
|
# 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
|
2014-11-12 16:43:14 +00:00
|
|
|
# along with SickGear. If not, see <http://www.gnu.org/licenses/>.
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
import os.path
|
|
|
|
import datetime
|
|
|
|
import re
|
2014-05-23 05:36:48 +00:00
|
|
|
import urlparse
|
2014-05-12 10:34:18 +00:00
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
import sickbeard
|
2015-09-18 00:06:34 +00:00
|
|
|
import sickbeard.providers
|
2014-05-23 05:36:48 +00:00
|
|
|
from sickbeard import encodingKludge as ek
|
2015-09-18 00:06:34 +00:00
|
|
|
from sickbeard import helpers, logger, naming, db
|
2015-11-19 22:05:19 +00:00
|
|
|
from lib.libtrakt import TraktAPI
|
2015-03-01 13:49:08 +00:00
|
|
|
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
naming_ep_type = ('%(seasonnumber)dx%(episodenumber)02d',
|
|
|
|
's%(seasonnumber)02de%(episodenumber)02d',
|
|
|
|
'S%(seasonnumber)02dE%(episodenumber)02d',
|
|
|
|
'%(seasonnumber)02dx%(episodenumber)02d')
|
2014-04-27 10:31:54 +00:00
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
sports_ep_type = ('%(seasonnumber)dx%(episodenumber)02d',
|
|
|
|
's%(seasonnumber)02de%(episodenumber)02d',
|
|
|
|
'S%(seasonnumber)02dE%(episodenumber)02d',
|
|
|
|
'%(seasonnumber)02dx%(episodenumber)02d')
|
2014-04-27 10:31:54 +00:00
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
naming_ep_type_text = ('1x02', 's01e02', 'S01E02', '01x02')
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
naming_multi_ep_type = {0: ['-%(episodenumber)02d'] * len(naming_ep_type),
|
|
|
|
1: [' - %s' % x for x in naming_ep_type],
|
|
|
|
2: [x + '%(episodenumber)02d' for x in ('x', 'e', 'E', 'x')]}
|
|
|
|
naming_multi_ep_type_text = ('extend', 'duplicate', 'repeat')
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
naming_sep_type = (' - ', ' ')
|
|
|
|
naming_sep_type_text = (' - ', 'space')
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
def change_https_cert(https_cert):
|
2014-03-10 05:18:05 +00:00
|
|
|
if https_cert == '':
|
|
|
|
sickbeard.HTTPS_CERT = ''
|
|
|
|
return True
|
|
|
|
|
|
|
|
if os.path.normpath(sickbeard.HTTPS_CERT) != os.path.normpath(https_cert):
|
|
|
|
if helpers.makeDir(os.path.dirname(os.path.abspath(https_cert))):
|
|
|
|
sickbeard.HTTPS_CERT = os.path.normpath(https_cert)
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Changed https cert path to %s' % https_cert)
|
2014-03-10 05:18:05 +00:00
|
|
|
else:
|
|
|
|
return False
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
def change_https_key(https_key):
|
2014-03-10 05:18:05 +00:00
|
|
|
if https_key == '':
|
|
|
|
sickbeard.HTTPS_KEY = ''
|
|
|
|
return True
|
|
|
|
|
|
|
|
if os.path.normpath(sickbeard.HTTPS_KEY) != os.path.normpath(https_key):
|
|
|
|
if helpers.makeDir(os.path.dirname(os.path.abspath(https_key))):
|
|
|
|
sickbeard.HTTPS_KEY = os.path.normpath(https_key)
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Changed https key path to %s' % https_key)
|
2014-03-10 05:18:05 +00:00
|
|
|
else:
|
|
|
|
return False
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
def change_log_dir(log_dir, web_log):
|
2014-03-10 05:18:05 +00:00
|
|
|
log_dir_changed = False
|
|
|
|
abs_log_dir = os.path.normpath(os.path.join(sickbeard.DATA_DIR, log_dir))
|
|
|
|
web_log_value = checkbox_to_value(web_log)
|
|
|
|
|
|
|
|
if os.path.normpath(sickbeard.LOG_DIR) != abs_log_dir:
|
|
|
|
if helpers.makeDir(abs_log_dir):
|
|
|
|
sickbeard.ACTUAL_LOG_DIR = os.path.normpath(log_dir)
|
|
|
|
sickbeard.LOG_DIR = abs_log_dir
|
|
|
|
|
2016-11-14 21:33:15 +00:00
|
|
|
logger.sb_log_instance.init_logging()
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Initialized new log file in %s' % sickbeard.LOG_DIR)
|
2014-03-10 05:18:05 +00:00
|
|
|
log_dir_changed = True
|
|
|
|
|
|
|
|
else:
|
|
|
|
return False
|
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
if sickbeard.WEB_LOG != web_log_value or log_dir_changed:
|
2014-03-10 05:18:05 +00:00
|
|
|
sickbeard.WEB_LOG = web_log_value
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
def change_nzb_dir(nzb_dir):
|
2014-03-10 05:18:05 +00:00
|
|
|
if nzb_dir == '':
|
|
|
|
sickbeard.NZB_DIR = ''
|
|
|
|
return True
|
|
|
|
|
|
|
|
if os.path.normpath(sickbeard.NZB_DIR) != os.path.normpath(nzb_dir):
|
|
|
|
if helpers.makeDir(nzb_dir):
|
|
|
|
sickbeard.NZB_DIR = os.path.normpath(nzb_dir)
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Changed NZB folder to %s' % nzb_dir)
|
2014-03-10 05:18:05 +00:00
|
|
|
else:
|
|
|
|
return False
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
def change_torrent_dir(torrent_dir):
|
2014-03-10 05:18:05 +00:00
|
|
|
if torrent_dir == '':
|
|
|
|
sickbeard.TORRENT_DIR = ''
|
|
|
|
return True
|
|
|
|
|
|
|
|
if os.path.normpath(sickbeard.TORRENT_DIR) != os.path.normpath(torrent_dir):
|
|
|
|
if helpers.makeDir(torrent_dir):
|
|
|
|
sickbeard.TORRENT_DIR = os.path.normpath(torrent_dir)
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Changed torrent folder to %s' % torrent_dir)
|
2014-03-10 05:18:05 +00:00
|
|
|
else:
|
|
|
|
return False
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
def change_tv_download_dir(tv_download_dir):
|
2014-03-10 05:18:05 +00:00
|
|
|
if tv_download_dir == '':
|
|
|
|
sickbeard.TV_DOWNLOAD_DIR = ''
|
|
|
|
return True
|
|
|
|
|
|
|
|
if os.path.normpath(sickbeard.TV_DOWNLOAD_DIR) != os.path.normpath(tv_download_dir):
|
|
|
|
if helpers.makeDir(tv_download_dir):
|
|
|
|
sickbeard.TV_DOWNLOAD_DIR = os.path.normpath(tv_download_dir)
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Changed TV download folder to %s' % tv_download_dir)
|
2014-03-10 05:18:05 +00:00
|
|
|
else:
|
|
|
|
return False
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
def schedule_autopostprocesser(freq):
|
2014-05-21 20:26:24 +00:00
|
|
|
sickbeard.AUTOPOSTPROCESSER_FREQUENCY = to_int(freq, default=sickbeard.DEFAULT_AUTOPOSTPROCESSER_FREQUENCY)
|
|
|
|
|
|
|
|
if sickbeard.AUTOPOSTPROCESSER_FREQUENCY < sickbeard.MIN_AUTOPOSTPROCESSER_FREQUENCY:
|
|
|
|
sickbeard.AUTOPOSTPROCESSER_FREQUENCY = sickbeard.MIN_AUTOPOSTPROCESSER_FREQUENCY
|
|
|
|
|
2014-06-15 07:16:55 +00:00
|
|
|
sickbeard.autoPostProcesserScheduler.cycleTime = datetime.timedelta(minutes=sickbeard.AUTOPOSTPROCESSER_FREQUENCY)
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
sickbeard.autoPostProcesserScheduler.set_paused_state()
|
2014-05-21 20:26:24 +00:00
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
def schedule_recentsearch(freq):
|
2014-12-22 18:30:53 +00:00
|
|
|
sickbeard.RECENTSEARCH_FREQUENCY = to_int(freq, default=sickbeard.DEFAULT_RECENTSEARCH_FREQUENCY)
|
2014-05-15 04:16:46 +00:00
|
|
|
|
2014-12-22 18:30:53 +00:00
|
|
|
if sickbeard.RECENTSEARCH_FREQUENCY < sickbeard.MIN_RECENTSEARCH_FREQUENCY:
|
|
|
|
sickbeard.RECENTSEARCH_FREQUENCY = sickbeard.MIN_RECENTSEARCH_FREQUENCY
|
2014-05-15 04:16:46 +00:00
|
|
|
|
2014-12-22 18:30:53 +00:00
|
|
|
sickbeard.recentSearchScheduler.cycleTime = datetime.timedelta(minutes=sickbeard.RECENTSEARCH_FREQUENCY)
|
2014-05-15 04:16:46 +00:00
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
def schedule_backlog(freq):
|
|
|
|
sickbeard.BACKLOG_FREQUENCY = minimax(freq, sickbeard.DEFAULT_BACKLOG_FREQUENCY,
|
|
|
|
sickbeard.MIN_BACKLOG_FREQUENCY, sickbeard.MAX_BACKLOG_FREQUENCY)
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2015-04-09 17:24:35 +00:00
|
|
|
sickbeard.backlogSearchScheduler.action.cycleTime = sickbeard.BACKLOG_FREQUENCY
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
def schedule_update(freq):
|
2014-04-27 15:02:34 +00:00
|
|
|
sickbeard.UPDATE_FREQUENCY = to_int(freq, default=sickbeard.DEFAULT_UPDATE_FREQUENCY)
|
|
|
|
|
|
|
|
if sickbeard.UPDATE_FREQUENCY < sickbeard.MIN_UPDATE_FREQUENCY:
|
2014-05-17 16:18:50 +00:00
|
|
|
sickbeard.UPDATE_FREQUENCY = sickbeard.MIN_UPDATE_FREQUENCY
|
2014-04-27 15:02:34 +00:00
|
|
|
|
|
|
|
sickbeard.versionCheckScheduler.cycleTime = datetime.timedelta(hours=sickbeard.UPDATE_FREQUENCY)
|
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
def schedule_version_notify(version_notify):
|
|
|
|
old_setting = sickbeard.VERSION_NOTIFY
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
sickbeard.VERSION_NOTIFY = version_notify
|
|
|
|
|
2014-05-02 11:33:06 +00:00
|
|
|
if not version_notify:
|
2014-03-10 05:18:05 +00:00
|
|
|
sickbeard.NEWEST_VERSION_STRING = None
|
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
if not old_setting and version_notify:
|
2015-03-01 13:49:08 +00:00
|
|
|
sickbeard.versionCheckScheduler.action.run()
|
|
|
|
|
2014-03-10 05:18:05 +00:00
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
def schedule_download_propers(download_propers):
|
|
|
|
if sickbeard.DOWNLOAD_PROPERS != download_propers:
|
|
|
|
sickbeard.DOWNLOAD_PROPERS = download_propers
|
|
|
|
sickbeard.properFinderScheduler.set_paused_state()
|
2014-07-29 02:20:48 +00:00
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
def schedule_trakt(use_trakt):
|
2014-07-29 02:20:48 +00:00
|
|
|
if sickbeard.USE_TRAKT == use_trakt:
|
|
|
|
return
|
|
|
|
|
|
|
|
sickbeard.USE_TRAKT = use_trakt
|
2015-11-19 22:05:19 +00:00
|
|
|
# if sickbeard.USE_TRAKT:
|
|
|
|
# sickbeard.traktCheckerScheduler.start()
|
|
|
|
# else:
|
2017-12-27 17:54:19 +00:00
|
|
|
# sickbeard.traktCheckerScheduler.stop()
|
2015-11-19 22:05:19 +00:00
|
|
|
# logger.log(u'Waiting for the TRAKTCHECKER thread to exit')
|
|
|
|
# try:
|
|
|
|
# sickbeard.traktCheckerScheduler.join(10)
|
|
|
|
# except:
|
|
|
|
# pass
|
2014-07-29 02:20:48 +00:00
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
def schedule_subtitles(use_subtitles):
|
|
|
|
if sickbeard.USE_SUBTITLES != use_subtitles:
|
|
|
|
sickbeard.USE_SUBTITLES = use_subtitles
|
|
|
|
sickbeard.subtitlesFinderScheduler.set_paused_state()
|
|
|
|
|
|
|
|
|
|
|
|
def schedule_emby_watched(emby_watched_interval):
|
|
|
|
emby_watched_freq = minimax(emby_watched_interval, sickbeard.DEFAULT_WATCHEDSTATE_FREQUENCY,
|
|
|
|
0, sickbeard.MAX_WATCHEDSTATE_FREQUENCY)
|
|
|
|
if emby_watched_freq and emby_watched_freq != sickbeard.EMBY_WATCHEDSTATE_FREQUENCY:
|
|
|
|
sickbeard.EMBY_WATCHEDSTATE_FREQUENCY = emby_watched_freq
|
|
|
|
sickbeard.embyWatchedStateScheduler.cycleTime = datetime.timedelta(minutes=emby_watched_freq)
|
|
|
|
|
|
|
|
sickbeard.EMBY_WATCHEDSTATE_SCHEDULED = bool(emby_watched_freq)
|
|
|
|
sickbeard.embyWatchedStateScheduler.set_paused_state()
|
2014-07-29 02:20:48 +00:00
|
|
|
|
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
def schedule_plex_watched(plex_watched_interval):
|
|
|
|
plex_watched_freq = minimax(plex_watched_interval, sickbeard.DEFAULT_WATCHEDSTATE_FREQUENCY,
|
|
|
|
0, sickbeard.MAX_WATCHEDSTATE_FREQUENCY)
|
|
|
|
if plex_watched_freq and plex_watched_freq != sickbeard.PLEX_WATCHEDSTATE_FREQUENCY:
|
|
|
|
sickbeard.PLEX_WATCHEDSTATE_FREQUENCY = plex_watched_freq
|
|
|
|
sickbeard.plexWatchedStateScheduler.cycleTime = datetime.timedelta(minutes=plex_watched_freq)
|
2015-03-01 13:49:08 +00:00
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
sickbeard.PLEX_WATCHEDSTATE_SCHEDULED = bool(plex_watched_freq)
|
|
|
|
sickbeard.plexWatchedStateScheduler.set_paused_state()
|
|
|
|
|
|
|
|
|
|
|
|
def check_section(cfg, section):
|
2014-03-10 05:18:05 +00:00
|
|
|
""" Check if INI section exists, if not create it """
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
if section not in cfg:
|
|
|
|
cfg[section] = {}
|
2014-03-10 05:18:05 +00:00
|
|
|
return False
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
return True
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
def checkbox_to_value(option, value_on=1, value_off=0):
|
|
|
|
"""
|
|
|
|
Turns checkbox option 'on' or 'true' to value_on (1)
|
|
|
|
any other value returns value_off (0)
|
|
|
|
"""
|
2014-09-05 14:02:16 +00:00
|
|
|
|
|
|
|
if type(option) is list:
|
|
|
|
option = option[-1]
|
|
|
|
|
2014-03-10 05:18:05 +00:00
|
|
|
if option == 'on' or option == 'true':
|
|
|
|
return value_on
|
|
|
|
|
|
|
|
return value_off
|
|
|
|
|
|
|
|
|
|
|
|
def clean_host(host, default_port=None):
|
|
|
|
"""
|
|
|
|
Returns host or host:port or empty string from a given url or host
|
|
|
|
If no port is found and default_port is given use host:default_port
|
|
|
|
"""
|
|
|
|
|
|
|
|
host = host.strip()
|
|
|
|
|
|
|
|
if host:
|
|
|
|
|
|
|
|
match_host_port = re.search(r'(?:http.*://)?(?P<host>[^:/]+).?(?P<port>[0-9]*).*', host)
|
|
|
|
|
|
|
|
cleaned_host = match_host_port.group('host')
|
|
|
|
cleaned_port = match_host_port.group('port')
|
|
|
|
|
|
|
|
if cleaned_host:
|
|
|
|
|
|
|
|
if cleaned_port:
|
2015-03-01 13:49:08 +00:00
|
|
|
host = '%s:%s' % (cleaned_host, cleaned_port)
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
elif default_port:
|
2015-03-01 13:49:08 +00:00
|
|
|
host = '%s:%s' % (cleaned_host, default_port)
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
else:
|
|
|
|
host = cleaned_host
|
|
|
|
|
|
|
|
else:
|
|
|
|
host = ''
|
|
|
|
|
|
|
|
return host
|
|
|
|
|
|
|
|
|
|
|
|
def clean_hosts(hosts, default_port=None):
|
|
|
|
cleaned_hosts = []
|
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
for cur_host in [host.strip() for host in hosts.split(',')]:
|
2014-03-10 05:18:05 +00:00
|
|
|
if cur_host:
|
|
|
|
cleaned_host = clean_host(cur_host, default_port)
|
|
|
|
if cleaned_host:
|
|
|
|
cleaned_hosts.append(cleaned_host)
|
|
|
|
|
|
|
|
if cleaned_hosts:
|
2015-03-01 13:49:08 +00:00
|
|
|
cleaned_hosts = ','.join(cleaned_hosts)
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
else:
|
|
|
|
cleaned_hosts = ''
|
|
|
|
|
|
|
|
return cleaned_hosts
|
|
|
|
|
|
|
|
|
2015-01-21 11:36:58 +00:00
|
|
|
def clean_url(url, add_slash=True):
|
2015-03-01 13:49:08 +00:00
|
|
|
""" Returns an cleaned url starting with a scheme and folder with trailing '/' or an empty string """
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2014-05-23 05:36:48 +00:00
|
|
|
if url and url.strip():
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2014-05-23 05:36:48 +00:00
|
|
|
url = url.strip()
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2014-05-23 05:36:48 +00:00
|
|
|
if '://' not in url:
|
|
|
|
url = '//' + url
|
|
|
|
|
|
|
|
scheme, netloc, path, query, fragment = urlparse.urlsplit(url, 'http')
|
|
|
|
|
|
|
|
if not path.endswith('/'):
|
2015-03-01 13:49:08 +00:00
|
|
|
basename, ext = ek.ek(os.path.splitext, ek.ek(os.path.basename, path))
|
2015-01-21 11:36:58 +00:00
|
|
|
if not ext and add_slash:
|
2015-03-01 13:49:08 +00:00
|
|
|
path += '/'
|
2014-05-23 05:36:48 +00:00
|
|
|
|
|
|
|
cleaned_url = urlparse.urlunsplit((scheme, netloc, path, query, fragment))
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
else:
|
2014-05-23 05:36:48 +00:00
|
|
|
cleaned_url = ''
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2014-05-23 05:36:48 +00:00
|
|
|
return cleaned_url
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
|
2018-03-14 16:07:19 +00:00
|
|
|
def kv_csv(data, default=''):
|
|
|
|
"""
|
|
|
|
Returns a cleansed CSV string of key value pairs
|
|
|
|
Elements must have one '=' in order to be returned
|
|
|
|
Elements are stripped of leading/trailing whitespace but may contain whitespace (e.g. "tv shows")
|
|
|
|
"""
|
|
|
|
if not isinstance(data, basestring):
|
|
|
|
return default
|
|
|
|
|
|
|
|
return ','.join(['='.join(i.strip() for i in i.split('=')) for i in data.split(',')
|
|
|
|
if 1 == len(re.findall('=', i)) and all(i.replace(' ', '').split('='))])
|
|
|
|
|
|
|
|
|
2014-03-10 05:18:05 +00:00
|
|
|
def to_int(val, default=0):
|
|
|
|
""" Return int value of val or default on error """
|
|
|
|
|
|
|
|
try:
|
|
|
|
val = int(val)
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
except(StandardError, Exception):
|
2014-03-10 05:18:05 +00:00
|
|
|
val = default
|
|
|
|
|
|
|
|
return val
|
|
|
|
|
|
|
|
|
|
|
|
def minimax(val, default, low, high):
|
|
|
|
""" Return value forced within range """
|
|
|
|
|
|
|
|
val = to_int(val, default=default)
|
|
|
|
|
|
|
|
if val < low:
|
|
|
|
return low
|
|
|
|
if val > high:
|
|
|
|
return high
|
|
|
|
|
|
|
|
return val
|
|
|
|
|
|
|
|
|
|
|
|
def check_setting_int(config, cfg_name, item_name, def_val):
|
|
|
|
try:
|
|
|
|
my_val = int(config[cfg_name][item_name])
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
except(StandardError, Exception):
|
2014-03-10 05:18:05 +00:00
|
|
|
my_val = def_val
|
|
|
|
try:
|
|
|
|
config[cfg_name][item_name] = my_val
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
except(StandardError, Exception):
|
2014-03-10 05:18:05 +00:00
|
|
|
config[cfg_name] = {}
|
|
|
|
config[cfg_name][item_name] = my_val
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log('%s -> %s' % (item_name, my_val), logger.DEBUG)
|
2014-03-10 05:18:05 +00:00
|
|
|
return my_val
|
|
|
|
|
|
|
|
|
|
|
|
def check_setting_float(config, cfg_name, item_name, def_val):
|
|
|
|
try:
|
|
|
|
my_val = float(config[cfg_name][item_name])
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
except(StandardError, Exception):
|
2014-03-10 05:18:05 +00:00
|
|
|
my_val = def_val
|
|
|
|
try:
|
|
|
|
config[cfg_name][item_name] = my_val
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
except(StandardError, Exception):
|
2014-03-10 05:18:05 +00:00
|
|
|
config[cfg_name] = {}
|
|
|
|
config[cfg_name][item_name] = my_val
|
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log('%s -> %s' % (item_name, my_val), logger.DEBUG)
|
2014-03-10 05:18:05 +00:00
|
|
|
return my_val
|
|
|
|
|
|
|
|
|
|
|
|
def check_setting_str(config, cfg_name, item_name, def_val, log=True):
|
2015-03-01 13:49:08 +00:00
|
|
|
"""
|
|
|
|
For passwords you must include the word `password` in the item_name and
|
|
|
|
add `helpers.encrypt(ITEM_NAME, ENCRYPTION_VERSION)` in save_config()
|
|
|
|
"""
|
|
|
|
|
2014-03-10 05:18:05 +00:00
|
|
|
if bool(item_name.find('password') + 1):
|
2014-05-17 14:57:47 +00:00
|
|
|
log = False
|
2014-03-10 05:18:05 +00:00
|
|
|
encryption_version = sickbeard.ENCRYPTION_VERSION
|
|
|
|
else:
|
|
|
|
encryption_version = 0
|
2014-03-25 05:57:24 +00:00
|
|
|
|
2014-03-10 05:18:05 +00:00
|
|
|
try:
|
|
|
|
my_val = helpers.decrypt(config[cfg_name][item_name], encryption_version)
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
except(StandardError, Exception):
|
2014-03-10 05:18:05 +00:00
|
|
|
my_val = def_val
|
|
|
|
try:
|
|
|
|
config[cfg_name][item_name] = helpers.encrypt(my_val, encryption_version)
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
except(StandardError, Exception):
|
2014-03-10 05:18:05 +00:00
|
|
|
config[cfg_name] = {}
|
|
|
|
config[cfg_name][item_name] = helpers.encrypt(my_val, encryption_version)
|
|
|
|
|
|
|
|
if log:
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log('%s -> %s' % (item_name, my_val), logger.DEBUG)
|
2014-03-10 05:18:05 +00:00
|
|
|
else:
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log('%s -> ******' % item_name, logger.DEBUG)
|
2014-03-10 05:18:05 +00:00
|
|
|
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
return (my_val, def_val)['None' == my_val]
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
class ConfigMigrator:
|
2014-03-10 05:18:05 +00:00
|
|
|
def __init__(self, config_obj):
|
|
|
|
"""
|
|
|
|
Initializes a config migrator that can take the config from the version indicated in the config
|
2015-03-01 13:49:08 +00:00
|
|
|
file up to the version required by SG
|
2014-03-10 05:18:05 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
self.config_obj = config_obj
|
|
|
|
|
|
|
|
# check the version of the config
|
|
|
|
self.config_version = check_setting_int(config_obj, 'General', 'config_version', sickbeard.CONFIG_VERSION)
|
|
|
|
self.expected_config_version = sickbeard.CONFIG_VERSION
|
|
|
|
self.migration_names = {1: 'Custom naming',
|
|
|
|
2: 'Sync backup number with version number',
|
|
|
|
3: 'Rename omgwtfnzb variables',
|
2015-06-19 16:47:52 +00:00
|
|
|
4: 'Add newznab cat_ids',
|
2014-12-25 01:57:51 +00:00
|
|
|
5: 'Metadata update',
|
2014-12-16 14:14:54 +00:00
|
|
|
6: 'Rename daily search to recent search',
|
2015-02-17 06:39:35 +00:00
|
|
|
7: 'Rename coming episodes to episode view',
|
|
|
|
8: 'Disable searches on start',
|
2015-04-07 03:10:50 +00:00
|
|
|
9: 'Rename pushbullet variables',
|
|
|
|
10: 'Reset backlog frequency to default',
|
2015-06-07 22:02:01 +00:00
|
|
|
11: 'Migrate anime split view to new layout',
|
2015-09-07 00:38:21 +00:00
|
|
|
12: 'Add "hevc" and some non-english languages to ignore words if not found',
|
2015-11-19 22:05:19 +00:00
|
|
|
13: 'Change default dereferrer url to blank',
|
2017-05-02 16:08:28 +00:00
|
|
|
14: 'Convert Trakt to multi-account',
|
2017-08-23 17:39:30 +00:00
|
|
|
15: 'Transmithe.net rebranded Nebulance',
|
|
|
|
16: 'Purge old cache image folders'}
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
def migrate_config(self):
|
2015-03-01 13:49:08 +00:00
|
|
|
""" Calls each successive migration until the config is the same version as SG expects """
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
if self.config_version > self.expected_config_version:
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log_error_and_exit(
|
|
|
|
u'Your config version (%s) has been incremented past what this version of SickGear supports (%s).\n'
|
|
|
|
'If you have used other forks or a newer version of SickGear, your config file may be unusable due to '
|
|
|
|
'their modifications.' % (self.config_version, self.expected_config_version))
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
sickbeard.CONFIG_VERSION = self.config_version
|
|
|
|
|
|
|
|
while self.config_version < self.expected_config_version:
|
|
|
|
next_version = self.config_version + 1
|
|
|
|
|
|
|
|
if next_version in self.migration_names:
|
2015-03-01 13:49:08 +00:00
|
|
|
migration_name = ': %s' % self.migration_names[next_version]
|
2014-03-10 05:18:05 +00:00
|
|
|
else:
|
|
|
|
migration_name = ''
|
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Backing up config before upgrade')
|
2014-03-10 05:18:05 +00:00
|
|
|
if not helpers.backupVersionedFile(sickbeard.CONFIG_FILE, self.config_version):
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log_error_and_exit(u'Config backup failed, abort upgrading config')
|
2014-03-10 05:18:05 +00:00
|
|
|
else:
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Proceeding with upgrade')
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
# do the migration, expect a method named _migrate_v<num>
|
|
|
|
logger.log(u'Migrating config up to version %s %s' % (next_version, migration_name))
|
|
|
|
getattr(self, '_migrate_v%s' % next_version)()
|
2014-03-10 05:18:05 +00:00
|
|
|
self.config_version = next_version
|
|
|
|
|
|
|
|
# save new config after migration
|
|
|
|
sickbeard.CONFIG_VERSION = self.config_version
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Saving config file to disk')
|
2014-03-10 05:18:05 +00:00
|
|
|
sickbeard.save_config()
|
|
|
|
|
|
|
|
# Migration v1: Custom naming
|
|
|
|
def _migrate_v1(self):
|
|
|
|
"""
|
|
|
|
Reads in the old naming settings from your config and generates a new config template from them.
|
|
|
|
"""
|
|
|
|
|
|
|
|
sickbeard.NAMING_PATTERN = self._name_to_pattern()
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log('Based on your old settings I am setting your new naming pattern to: %s' % sickbeard.NAMING_PATTERN)
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
sickbeard.NAMING_CUSTOM_ABD = bool(check_setting_int(self.config_obj, 'General', 'naming_dates', 0))
|
|
|
|
|
|
|
|
if sickbeard.NAMING_CUSTOM_ABD:
|
|
|
|
sickbeard.NAMING_ABD_PATTERN = self._name_to_pattern(True)
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log('Adding a custom air-by-date naming pattern to your config: %s' % sickbeard.NAMING_ABD_PATTERN)
|
2014-03-10 05:18:05 +00:00
|
|
|
else:
|
|
|
|
sickbeard.NAMING_ABD_PATTERN = naming.name_abd_presets[0]
|
|
|
|
|
|
|
|
sickbeard.NAMING_MULTI_EP = int(check_setting_int(self.config_obj, 'General', 'naming_multi_ep_type', 1))
|
|
|
|
|
|
|
|
# see if any of their shows used season folders
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
my_db = db.DBConnection()
|
|
|
|
season_folder_shows = my_db.select('SELECT * FROM tv_shows WHERE flatten_folders = 0')
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
# if any shows had season folders on then prepend season folder to the pattern
|
|
|
|
if season_folder_shows:
|
|
|
|
|
|
|
|
old_season_format = check_setting_str(self.config_obj, 'General', 'season_folders_format', 'Season %02d')
|
|
|
|
|
|
|
|
if old_season_format:
|
|
|
|
try:
|
|
|
|
new_season_format = old_season_format % 9
|
2014-07-29 02:20:48 +00:00
|
|
|
new_season_format = str(new_season_format).replace('09', '%0S')
|
2014-03-10 05:18:05 +00:00
|
|
|
new_season_format = new_season_format.replace('9', '%S')
|
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Changed season folder format from %s to %s, prepending it to your naming config' %
|
|
|
|
(old_season_format, new_season_format))
|
2014-03-10 05:18:05 +00:00
|
|
|
sickbeard.NAMING_PATTERN = new_season_format + os.sep + sickbeard.NAMING_PATTERN
|
|
|
|
|
|
|
|
except (TypeError, ValueError):
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Can not change %s to new season format' % old_season_format, logger.ERROR)
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
# if no shows had it on then don't flatten any shows and don't put season folders in the config
|
|
|
|
else:
|
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'No shows were using season folders before so I am disabling flattening on all shows')
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
# don't flatten any shows at all
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
my_db.action('UPDATE tv_shows SET flatten_folders = 0')
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
sickbeard.NAMING_FORCE_FOLDERS = naming.check_force_season_folders()
|
|
|
|
|
|
|
|
def _name_to_pattern(self, abd=False):
|
|
|
|
|
|
|
|
# get the old settings from the file
|
|
|
|
use_periods = bool(check_setting_int(self.config_obj, 'General', 'naming_use_periods', 0))
|
|
|
|
ep_type = check_setting_int(self.config_obj, 'General', 'naming_ep_type', 0)
|
|
|
|
sep_type = check_setting_int(self.config_obj, 'General', 'naming_sep_type', 0)
|
|
|
|
use_quality = bool(check_setting_int(self.config_obj, 'General', 'naming_quality', 0))
|
|
|
|
|
|
|
|
use_show_name = bool(check_setting_int(self.config_obj, 'General', 'naming_show_name', 1))
|
|
|
|
use_ep_name = bool(check_setting_int(self.config_obj, 'General', 'naming_ep_name', 1))
|
|
|
|
|
|
|
|
# make the presets into templates
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
naming_ep_tmpl = ('%Sx%0E',
|
2015-03-01 13:49:08 +00:00
|
|
|
's%0Se%0E',
|
|
|
|
'S%0SE%0E',
|
|
|
|
'%0Sx%0E')
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
naming_sep_tmpl = (' - ', ' ')
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
# set up our data to use
|
|
|
|
if use_periods:
|
|
|
|
show_name = '%S.N'
|
|
|
|
ep_name = '%E.N'
|
|
|
|
ep_quality = '%Q.N'
|
|
|
|
abd_string = '%A.D'
|
|
|
|
else:
|
|
|
|
show_name = '%SN'
|
|
|
|
ep_name = '%EN'
|
|
|
|
ep_quality = '%QN'
|
|
|
|
abd_string = '%A-D'
|
|
|
|
|
|
|
|
if abd:
|
|
|
|
ep_string = abd_string
|
|
|
|
else:
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
ep_string = naming_ep_tmpl[ep_type]
|
2014-03-10 05:18:05 +00:00
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
final_name = ''
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
# start with the show name
|
|
|
|
if use_show_name:
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
final_name += show_name + naming_sep_tmpl[sep_type]
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
# add the season/ep stuff
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
final_name += ep_string
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
# add the episode name
|
|
|
|
if use_ep_name:
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
final_name += naming_sep_tmpl[sep_type] + ep_name
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
# add the quality
|
|
|
|
if use_quality:
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
final_name += naming_sep_tmpl[sep_type] + ep_quality
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
if use_periods:
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
final_name = re.sub('\s+', '.', final_name)
|
2014-03-10 05:18:05 +00:00
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
return final_name
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
# Migration v2: Dummy migration to sync backup number with config version number
|
|
|
|
def _migrate_v2(self):
|
|
|
|
return
|
|
|
|
|
|
|
|
# Migration v2: Rename omgwtfnzb variables
|
|
|
|
def _migrate_v3(self):
|
|
|
|
"""
|
|
|
|
Reads in the old naming settings from your config and generates a new config template from them.
|
|
|
|
"""
|
|
|
|
# get the old settings from the file and store them in the new variable names
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
for prov in [curProvider for curProvider in sickbeard.providers.sortedProviderList()
|
|
|
|
if 'omgwtfnzbs' == curProvider.name]:
|
2015-09-06 02:56:09 +00:00
|
|
|
prov.username = check_setting_str(self.config_obj, 'omgwtfnzbs', 'omgwtfnzbs_uid', '')
|
|
|
|
prov.api_key = check_setting_str(self.config_obj, 'omgwtfnzbs', 'omgwtfnzbs_key', '')
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2015-06-19 16:47:52 +00:00
|
|
|
# Migration v4: Add default newznab cat_ids
|
2014-03-10 05:18:05 +00:00
|
|
|
def _migrate_v4(self):
|
|
|
|
""" Update newznab providers so that the category IDs can be set independently via the config """
|
|
|
|
|
|
|
|
new_newznab_data = []
|
|
|
|
old_newznab_data = check_setting_str(self.config_obj, 'Newznab', 'newznab_data', '')
|
|
|
|
|
|
|
|
if old_newznab_data:
|
2015-03-01 13:49:08 +00:00
|
|
|
old_newznab_data_list = old_newznab_data.split('!!!')
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
for cur_provider_data in old_newznab_data_list:
|
|
|
|
try:
|
2015-03-01 13:49:08 +00:00
|
|
|
name, url, key, enabled = cur_provider_data.split('|')
|
2014-03-10 05:18:05 +00:00
|
|
|
except ValueError:
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Skipping Newznab provider string: "%s", incorrect format' % cur_provider_data,
|
2014-03-25 05:57:24 +00:00
|
|
|
logger.ERROR)
|
2014-03-10 05:18:05 +00:00
|
|
|
continue
|
|
|
|
|
2014-05-26 06:29:22 +00:00
|
|
|
if name == 'Sick Beard Index':
|
2014-03-10 05:18:05 +00:00
|
|
|
key = '0'
|
|
|
|
|
|
|
|
if name == 'NZBs.org':
|
2015-06-19 16:47:52 +00:00
|
|
|
cat_ids = '5030,5040,5060,5070,5090'
|
2014-03-10 05:18:05 +00:00
|
|
|
else:
|
2015-06-19 16:47:52 +00:00
|
|
|
cat_ids = '5030,5040,5060'
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2015-06-19 16:47:52 +00:00
|
|
|
cur_provider_data_list = [name, url, key, cat_ids, enabled]
|
2015-03-01 13:49:08 +00:00
|
|
|
new_newznab_data.append('|'.join(cur_provider_data_list))
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
sickbeard.NEWZNAB_DATA = '!!!'.join(new_newznab_data)
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
# Migration v5: Metadata upgrade
|
|
|
|
def _migrate_v5(self):
|
2015-03-01 13:49:08 +00:00
|
|
|
""" Updates metadata values to the new format
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2015-03-01 13:49:08 +00:00
|
|
|
Quick overview of what the upgrade does:
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
new | old | description (new)
|
|
|
|
----+-----+--------------------
|
|
|
|
1 | 1 | show metadata
|
|
|
|
2 | 2 | episode metadata
|
|
|
|
3 | 4 | show fanart
|
|
|
|
4 | 3 | show poster
|
|
|
|
5 | - | show banner
|
|
|
|
6 | 5 | episode thumb
|
|
|
|
7 | 6 | season poster
|
|
|
|
8 | - | season banner
|
|
|
|
9 | - | season all poster
|
|
|
|
10 | - | season all banner
|
|
|
|
|
|
|
|
Note that the ini places start at 1 while the list index starts at 0.
|
|
|
|
old format: 0|0|0|0|0|0 -- 6 places
|
|
|
|
new format: 0|0|0|0|0|0|0|0|0|0 -- 10 places
|
|
|
|
|
|
|
|
Drop the use of use_banner option.
|
|
|
|
Migrate the poster override to just using the banner option (applies to xbmc only).
|
|
|
|
"""
|
|
|
|
|
|
|
|
metadata_xbmc = check_setting_str(self.config_obj, 'General', 'metadata_xbmc', '0|0|0|0|0|0')
|
|
|
|
metadata_xbmc_12plus = check_setting_str(self.config_obj, 'General', 'metadata_xbmc_12plus', '0|0|0|0|0|0')
|
|
|
|
metadata_mediabrowser = check_setting_str(self.config_obj, 'General', 'metadata_mediabrowser', '0|0|0|0|0|0')
|
|
|
|
metadata_ps3 = check_setting_str(self.config_obj, 'General', 'metadata_ps3', '0|0|0|0|0|0')
|
|
|
|
metadata_wdtv = check_setting_str(self.config_obj, 'General', 'metadata_wdtv', '0|0|0|0|0|0')
|
|
|
|
metadata_tivo = check_setting_str(self.config_obj, 'General', 'metadata_tivo', '0|0|0|0|0|0')
|
2014-05-11 23:15:24 +00:00
|
|
|
metadata_mede8er = check_setting_str(self.config_obj, 'General', 'metadata_mede8er', '0|0|0|0|0|0')
|
2015-02-25 12:33:40 +00:00
|
|
|
metadata_kodi = check_setting_str(self.config_obj, 'General', 'metadata_kodi', '0|0|0|0|0|0')
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
use_banner = bool(check_setting_int(self.config_obj, 'General', 'use_banner', 0))
|
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
def _migrate_metadata(metadata, metadata_name, banner):
|
2014-03-10 05:18:05 +00:00
|
|
|
cur_metadata = metadata.split('|')
|
|
|
|
# if target has the old number of values, do upgrade
|
|
|
|
if len(cur_metadata) == 6:
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Upgrading ' + metadata_name + ' metadata, old value: ' + metadata)
|
2014-03-10 05:18:05 +00:00
|
|
|
cur_metadata.insert(4, '0')
|
|
|
|
cur_metadata.append('0')
|
|
|
|
cur_metadata.append('0')
|
|
|
|
cur_metadata.append('0')
|
|
|
|
# swap show fanart, show poster
|
|
|
|
cur_metadata[3], cur_metadata[2] = cur_metadata[2], cur_metadata[3]
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
# if user was using banner to override the poster,
|
2015-03-01 13:49:08 +00:00
|
|
|
# instead enable the banner option and deactivate poster
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
if 'XBMC' == metadata_name and banner:
|
2014-03-10 05:18:05 +00:00
|
|
|
cur_metadata[4], cur_metadata[3] = cur_metadata[3], '0'
|
|
|
|
# write new format
|
|
|
|
metadata = '|'.join(cur_metadata)
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Upgrading %s metadata, new value: %s' % (metadata_name, metadata))
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2014-05-11 23:15:24 +00:00
|
|
|
elif len(cur_metadata) == 10:
|
|
|
|
metadata = '|'.join(cur_metadata)
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Keeping %s metadata, value: %s' % (metadata_name, metadata))
|
2014-03-10 05:18:05 +00:00
|
|
|
else:
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Skipping %s: "%s", incorrect format' % (metadata_name, metadata), logger.ERROR)
|
2014-03-10 05:18:05 +00:00
|
|
|
metadata = '0|0|0|0|0|0|0|0|0|0'
|
2015-03-01 13:49:08 +00:00
|
|
|
logger.log(u'Setting %s metadata, new value: %s' % (metadata_name, metadata))
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
return metadata
|
|
|
|
|
|
|
|
sickbeard.METADATA_XBMC = _migrate_metadata(metadata_xbmc, 'XBMC', use_banner)
|
|
|
|
sickbeard.METADATA_XBMC_12PLUS = _migrate_metadata(metadata_xbmc_12plus, 'XBMC 12+', use_banner)
|
|
|
|
sickbeard.METADATA_MEDIABROWSER = _migrate_metadata(metadata_mediabrowser, 'MediaBrowser', use_banner)
|
|
|
|
sickbeard.METADATA_PS3 = _migrate_metadata(metadata_ps3, 'PS3', use_banner)
|
|
|
|
sickbeard.METADATA_WDTV = _migrate_metadata(metadata_wdtv, 'WDTV', use_banner)
|
|
|
|
sickbeard.METADATA_TIVO = _migrate_metadata(metadata_tivo, 'TIVO', use_banner)
|
2014-05-11 23:15:24 +00:00
|
|
|
sickbeard.METADATA_MEDE8ER = _migrate_metadata(metadata_mede8er, 'Mede8er', use_banner)
|
2015-02-25 12:33:40 +00:00
|
|
|
sickbeard.METADATA_KODI = _migrate_metadata(metadata_kodi, 'Kodi', use_banner)
|
2014-12-25 01:57:51 +00:00
|
|
|
|
|
|
|
# Migration v6: Rename daily search to recent search
|
|
|
|
def _migrate_v6(self):
|
|
|
|
sickbeard.RECENTSEARCH_FREQUENCY = check_setting_int(self.config_obj, 'General', 'dailysearch_frequency',
|
|
|
|
sickbeard.DEFAULT_RECENTSEARCH_FREQUENCY)
|
|
|
|
|
|
|
|
sickbeard.RECENTSEARCH_STARTUP = bool(check_setting_int(self.config_obj, 'General', 'dailysearch_startup', 1))
|
|
|
|
if sickbeard.RECENTSEARCH_FREQUENCY < sickbeard.MIN_RECENTSEARCH_FREQUENCY:
|
|
|
|
sickbeard.RECENTSEARCH_FREQUENCY = sickbeard.MIN_RECENTSEARCH_FREQUENCY
|
|
|
|
|
2015-11-19 22:05:19 +00:00
|
|
|
for curProvider in sickbeard.providers.sortedProviderList():
|
2014-12-25 01:57:51 +00:00
|
|
|
if hasattr(curProvider, 'enable_recentsearch'):
|
2015-03-01 13:49:08 +00:00
|
|
|
curProvider.enable_recentsearch = bool(check_setting_int(
|
2015-07-13 09:39:20 +00:00
|
|
|
self.config_obj, curProvider.get_id().upper(), curProvider.get_id() + '_enable_dailysearch', 1))
|
2014-12-16 14:14:54 +00:00
|
|
|
|
|
|
|
def _migrate_v7(self):
|
|
|
|
sickbeard.EPISODE_VIEW_LAYOUT = check_setting_str(self.config_obj, 'GUI', 'coming_eps_layout', 'banner')
|
|
|
|
sickbeard.EPISODE_VIEW_SORT = check_setting_str(self.config_obj, 'GUI', 'coming_eps_sort', 'time')
|
|
|
|
if 'date' == sickbeard.EPISODE_VIEW_SORT:
|
|
|
|
sickbeard.EPISODE_VIEW_SORT = 'time'
|
2015-03-01 13:49:08 +00:00
|
|
|
sickbeard.EPISODE_VIEW_DISPLAY_PAUSED = bool(
|
|
|
|
check_setting_int(self.config_obj, 'GUI', 'coming_eps_display_paused', 0))
|
2014-12-16 14:14:54 +00:00
|
|
|
sickbeard.EPISODE_VIEW_MISSED_RANGE = check_setting_int(self.config_obj, 'GUI', 'coming_eps_missed_range', 7)
|
2015-01-04 02:26:55 +00:00
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
@staticmethod
|
|
|
|
def _migrate_v8():
|
2015-01-04 02:26:55 +00:00
|
|
|
# removing settings from gui and making it a hidden debug option
|
|
|
|
sickbeard.RECENTSEARCH_STARTUP = False
|
2015-02-17 06:39:35 +00:00
|
|
|
|
|
|
|
def _migrate_v9(self):
|
2015-02-24 07:32:45 +00:00
|
|
|
sickbeard.PUSHBULLET_ACCESS_TOKEN = check_setting_str(self.config_obj, 'Pushbullet', 'pushbullet_api', '')
|
2015-04-09 17:24:35 +00:00
|
|
|
sickbeard.PUSHBULLET_DEVICE_IDEN = check_setting_str(self.config_obj, 'Pushbullet', 'pushbullet_device', '')
|
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
@staticmethod
|
|
|
|
def _migrate_v10():
|
2015-04-09 17:24:35 +00:00
|
|
|
# reset backlog frequency to default
|
2015-04-07 03:10:50 +00:00
|
|
|
sickbeard.BACKLOG_FREQUENCY = sickbeard.DEFAULT_BACKLOG_FREQUENCY
|
2015-05-03 00:42:14 +00:00
|
|
|
|
2015-04-07 03:10:50 +00:00
|
|
|
def _migrate_v11(self):
|
|
|
|
if check_setting_int(self.config_obj, 'ANIME', 'anime_split_home', ''):
|
|
|
|
sickbeard.SHOWLIST_TAGVIEW = 'anime'
|
|
|
|
else:
|
2015-06-07 22:02:01 +00:00
|
|
|
sickbeard.SHOWLIST_TAGVIEW = 'default'
|
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
@staticmethod
|
|
|
|
def _migrate_v12():
|
2015-06-07 22:02:01 +00:00
|
|
|
# add words to ignore list and insert spaces to improve the ui config readability
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
words_to_add = ['hevc', 'reenc', 'x265', 'danish', 'deutsch', 'flemish', 'italian',
|
|
|
|
'nordic', 'norwegian', 'portuguese', 'spanish', 'turkish']
|
2015-06-07 22:02:01 +00:00
|
|
|
config_words = sickbeard.IGNORE_WORDS.split(',')
|
|
|
|
new_list = []
|
|
|
|
for new_word in words_to_add:
|
|
|
|
add_word = True
|
|
|
|
for ignore_word in config_words:
|
|
|
|
ignored = ignore_word.strip().lower()
|
|
|
|
if ignored and ignored not in new_list:
|
|
|
|
new_list += [ignored]
|
|
|
|
if re.search(r'(?i)%s' % new_word, ignored):
|
|
|
|
add_word = False
|
|
|
|
if add_word:
|
|
|
|
new_list += [new_word]
|
|
|
|
|
|
|
|
sickbeard.IGNORE_WORDS = ', '.join(sorted(new_list))
|
2015-09-07 00:38:21 +00:00
|
|
|
|
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
|
|
|
@staticmethod
|
|
|
|
def _migrate_v13():
|
2015-09-07 00:38:21 +00:00
|
|
|
# change dereferrer.org urls to blank, but leave any other url untouched
|
|
|
|
if sickbeard.ANON_REDIRECT == 'http://dereferer.org/?':
|
|
|
|
sickbeard.ANON_REDIRECT = ''
|
2015-11-19 22:05:19 +00:00
|
|
|
|
|
|
|
def _migrate_v14(self):
|
|
|
|
old_token = check_setting_str(self.config_obj, 'Trakt', 'trakt_token', '')
|
|
|
|
old_refresh_token = check_setting_str(self.config_obj, 'Trakt', 'trakt_refresh_token', '')
|
|
|
|
if old_token and old_refresh_token:
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
TraktAPI.add_account(old_token, old_refresh_token, None)
|
2017-05-02 16:08:28 +00:00
|
|
|
|
|
|
|
# Migration v15: Transmithe.net variables
|
|
|
|
def _migrate_v15(self):
|
|
|
|
try:
|
|
|
|
neb = filter(lambda p: 'Nebulance' in p.name, sickbeard.providers.sortedProviderList())[0]
|
|
|
|
except (StandardError, Exception):
|
|
|
|
return
|
|
|
|
# get the old settings from the file and store them in the new variable names
|
|
|
|
old_id = 'transmithe_net'
|
|
|
|
old_id_uc = old_id.upper()
|
|
|
|
neb.enabled = bool(check_setting_int(self.config_obj, old_id_uc, old_id, 0))
|
|
|
|
setattr(neb, 'username', check_setting_str(self.config_obj, old_id_uc, old_id + '_username', ''))
|
|
|
|
neb.password = check_setting_str(self.config_obj, old_id_uc, old_id + '_password', '')
|
|
|
|
neb.minseed = check_setting_int(self.config_obj, old_id_uc, old_id + '_minseed', 0)
|
|
|
|
neb.minleech = check_setting_int(self.config_obj, old_id_uc, old_id + '_minleech', 0)
|
|
|
|
neb.freeleech = bool(check_setting_int(self.config_obj, old_id_uc, old_id + '_freeleech', 0))
|
|
|
|
neb.enable_recentsearch = bool(check_setting_int(
|
|
|
|
self.config_obj, old_id_uc, old_id + '_enable_recentsearch', 1)) or not getattr(neb, 'supports_backlog')
|
|
|
|
neb.enable_backlog = bool(check_setting_int(self.config_obj, old_id_uc, old_id + '_enable_backlog', 1))
|
|
|
|
neb.search_mode = check_setting_str(self.config_obj, old_id_uc, old_id + '_search_mode', 'eponly')
|
|
|
|
neb.search_fallback = bool(check_setting_int(self.config_obj, old_id_uc, old_id + '_search_fallback', 0))
|
|
|
|
neb.seed_time = check_setting_int(self.config_obj, old_id_uc, old_id + '_seed_time', '')
|
|
|
|
neb._seed_ratio = check_setting_str(self.config_obj, old_id_uc, old_id + '_seed_ratio', '')
|
2017-08-23 17:39:30 +00:00
|
|
|
|
|
|
|
# Migration v16: Purge old cache image folder name
|
|
|
|
@staticmethod
|
|
|
|
def _migrate_v16():
|
|
|
|
if sickbeard.CACHE_DIR and ek.ek(os.path.isdir, sickbeard.CACHE_DIR):
|
|
|
|
cache_default = sickbeard.CACHE_DIR
|
|
|
|
dead_paths = ['anidb', 'imdb', 'trakt']
|
|
|
|
for path in dead_paths:
|
|
|
|
sickbeard.CACHE_DIR = '%s/images/%s' % (cache_default, path)
|
|
|
|
helpers.clearCache(True)
|
|
|
|
try:
|
|
|
|
ek.ek(os.rmdir, sickbeard.CACHE_DIR)
|
|
|
|
except OSError:
|
|
|
|
pass
|
|
|
|
sickbeard.CACHE_DIR = cache_default
|