From 2b031fff67a9d593c9f670192bf5fa883fa7b118 Mon Sep 17 00:00:00 2001 From: adam Date: Fri, 20 Feb 2015 22:03:27 +0800 Subject: [PATCH] Change startup code cleanup and PEP8 --- CHANGES.md | 1 + SickBeard.py | 135 ++++++++++++++++++++++++++------------------------- 2 files changed, 69 insertions(+), 67 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 76aefc66..4912a7da 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ * Add text to explain params passed to extra scripts on Config/Post Processing * Remove unused SickBeardURLOpener and AuthURLOpener classes * Update Pushbullet notifier (port from midgetspy/sickbeard) +* Change startup code cleanup and PEP8 [develop changelog] diff --git a/SickBeard.py b/SickBeard.py index d9522c57..df572169 100755 --- a/SickBeard.py +++ b/SickBeard.py @@ -25,9 +25,14 @@ import signal import sys import shutil import subprocess +import os +import locale +import datetime +import threading +import getopt if sys.version_info < (2, 6): - print "Sorry, requires Python 2.6 or 2.7." + print 'Sorry, requires Python 2.6 or 2.7.' sys.exit(1) try: @@ -36,27 +41,20 @@ try: if Cheetah.Version[0] != '2': raise ValueError except ValueError: - print "Sorry, requires Python module Cheetah 2.1.0 or newer." + print 'Sorry, requires Python module Cheetah 2.1.0 or newer.' sys.exit(1) except: - print "The Python module Cheetah is required" + 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, versionChecker +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 @@ -85,35 +83,36 @@ class SickGear(object): self.forcedPort = None self.noLaunch = False - def help_message(self): + @staticmethod + def help_message(): """ print help message for commandline options """ - help_msg = "\n" - help_msg += "Usage: " + sickbeard.MY_FULLNAME + "