#!/usr/bin/env python2 # Author: Nic Wolfe # URL: http://code.google.com/p/sickbeard/ # # This file is part of SickGear. # # SickGear is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # SickGear is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with SickGear. If not, see . # Check needed software dependencies to nudge users to fix their setup from __future__ import print_function from __future__ import with_statement import datetime import errno import getopt import locale import os import signal import sys import shutil import subprocess import time import threading import warnings warnings.filterwarnings('ignore', module=r'.*fuzzywuzzy.*') warnings.filterwarnings('ignore', module=r'.*Cheetah.*') warnings.filterwarnings('ignore', module=r'.*connectionpool.*', message='.*certificate verification.*') warnings.filterwarnings('ignore', module=r'.*ssl_.*', message='.*SSLContext object.*') if not (2, 7, 9) <= sys.version_info < (3, 0): print('Python %s.%s.%s detected.' % sys.version_info[:3]) print('Sorry, SickGear requires Python 2.7.9 or higher. Python 3 is not supported.') sys.exit(1) try: import _cleaner except (StandardError, Exception): pass try: import Cheetah if Cheetah.Version[0] < '2': raise ValueError except ValueError: print('Sorry, requires Python module Cheetah 2.1.0 or newer.') sys.exit(1) except (StandardError, Exception): print('The Python module Cheetah is required') sys.exit(1) sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib'))) from lib.six import moves # We only need this for compiling an EXE and I will just always do that on 2.6+ if sys.hexversion >= 0x020600F0: from multiprocessing import freeze_support # @UnresolvedImport import sickbeard from sickbeard import db, logger, network_timezones, failed_history, name_cache from sickbeard.tv import TVShow from sickbeard.webserveInit import WebServer from sickbeard.databases.mainDB import MIN_DB_VERSION, MAX_DB_VERSION from sickbeard.event_queue import Events from sickbeard.exceptions import ex from lib.configobj import ConfigObj throwaway = datetime.datetime.strptime('20110101', '%Y%m%d') rollback_loaded = None signal.signal(signal.SIGINT, sickbeard.sig_handler) signal.signal(signal.SIGTERM, sickbeard.sig_handler) if 'win32' == sys.platform: signal.signal(signal.SIGBREAK, sickbeard.sig_handler) class SickGear(object): def __init__(self): # system event callback for shutdown/restart sickbeard.events = Events(self.shutdown) # daemon constants self.run_as_daemon = False self.create_pid = False self.pid_file = '' self.run_as_systemd = False self.console_logging = False # webserver constants self.webserver = None self.force_update = False self.forced_port = None self.no_launch = False self.web_options = None self.webhost = None self.start_port = None self.log_dir = None @staticmethod def help_message(): """ print help message for commandline options """ help_msg = [''] help_msg += ['Usage: %s