#!/usr/bin/env python2 # Author: Nic Wolfe # URL: http://code.google.com/p/sickbeard/ # # This file is part of SickRage. # # SickRage 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. # # SickRage 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 SickRage. If not, see . # Check needed software dependencies to nudge users to fix their setup from __future__ import with_statement import time import signal import sys import shutil import subprocess import traceback if sys.version_info < (2, 6): print "Sorry, requires Python 2.6 or 2.7." sys.exit(1) 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: print "The Python module Cheetah is required" sys.exit(1) import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib'))) # 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 locale import datetime import threading import getopt import sickbeard from sickbeard import db, logger, network_timezones, failed_history, name_cache from sickbeard.tv import TVShow from sickbeard.webserveInit import SRWebServer from sickbeard.databases.mainDB import MIN_DB_VERSION, MAX_DB_VERSION from sickbeard.event_queue import Events from lib.configobj import ConfigObj throwaway = datetime.datetime.strptime('20110101', '%Y%m%d') signal.signal(signal.SIGINT, sickbeard.sig_handler) signal.signal(signal.SIGTERM, sickbeard.sig_handler) class SickRage(object): def __init__(self): # system event callback for shutdown/restart sickbeard.events = Events(self.shutdown) # daemon constants self.runAsDaemon = False self.CREATEPID = False self.PIDFILE = '' # webserver constants self.webserver = None self.forceUpdate = False self.forcedPort = None self.noLaunch = False def help_message(self): """ print help message for commandline options """ help_msg = "\n" help_msg += "Usage: " + sickbeard.MY_FULLNAME + "