Skip to content

Commit

Permalink
Merge branch 'midget_master' into unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
lad1337 committed Apr 17, 2012
2 parents 6033573 + c0d9950 commit a4514a5
Show file tree
Hide file tree
Showing 164 changed files with 13,475 additions and 3,499 deletions.
29 changes: 28 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,36 @@
*.pyc
# SB User Related #
######################
cache/*
cache.db*
config.ini
Logs/*
sickbeard.db*
autoProcessTV/autoProcessTV.cfg
server.crt
server.key

# Compiled source #
######################
*.py[co]

# IDE specific #
######################
*.bak
*.tmp
*.wpr
*.project
*.cproject
*.tmproj
*.tmproject
*.sw?

# OS generated files #
######################
.Spotlight-V100
.Trashes
.DS_Store
desktop.ini
ehthumbs.db
Thumbs.db
.directory
*~
47 changes: 27 additions & 20 deletions SickBeard.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.

import sys
if sys.version_info < (2, 5):
print "Sorry, requires Python 2.5 or higher."
sys.exit(1)

# we only need this for compiling an EXE and I will just always do that on 2.6+
if sys.hexversion >= 0x020600F0:
Expand Down Expand Up @@ -45,6 +48,7 @@
signal.signal(signal.SIGINT, sickbeard.sig_handler)
signal.signal(signal.SIGTERM, sickbeard.sig_handler)


def loadShowsFromDB():
"""
Populates the showList with shows from the database
Expand All @@ -58,11 +62,12 @@ def loadShowsFromDB():
curShow = TVShow(int(sqlShow["tvdb_id"]))
sickbeard.showList.append(curShow)
except Exception, e:
logger.log(u"There was an error creating the show in "+sqlShow["location"]+": "+str(e).decode('utf-8'), logger.ERROR)
logger.log(u"There was an error creating the show in " + sqlShow["location"] + ": " + str(e).decode('utf-8'), logger.ERROR)
logger.log(traceback.format_exc(), logger.DEBUG)

#TODO: make it update the existing shows if the showlist has something in it


def daemonize():
"""
Fork off as a daemon
Expand All @@ -89,7 +94,7 @@ def daemonize():
if pid != 0:
sys.exit(0)
except OSError, e:
raise RuntimeError("2st fork failed: %s [%d]" %
raise RuntimeError("2nd fork failed: %s [%d]" %
(e.strerror, e.errno))

dev_null = file('/dev/null', 'r')
Expand All @@ -100,6 +105,7 @@ def daemonize():
logger.log(u"Writing PID " + pid + " to " + str(sickbeard.PIDFILE))
file(sickbeard.PIDFILE, 'w').write("%s\n" % pid)


def main():
"""
TV for me
Expand All @@ -112,6 +118,7 @@ def main():
sickbeard.DATA_DIR = sickbeard.PROG_DIR
sickbeard.MY_ARGS = sys.argv[1:]
sickbeard.CREATEPID = False
sickbeard.DAEMON = False

sickbeard.SYS_ENCODING = None

Expand Down Expand Up @@ -192,7 +199,7 @@ def main():
raise SystemExit("Unable to write PID file: %s [%d]" % (e.strerror, e.errno))
else:
logger.log(u"Not running in daemon mode. PID file creation disabled.")

# if they don't specify a config file then put it in the data dir
if not sickbeard.CONFIG_FILE:
sickbeard.CONFIG_FILE = os.path.join(sickbeard.DATA_DIR, "config.ini")
Expand All @@ -213,12 +220,12 @@ def main():
if os.path.isfile(sickbeard.CONFIG_FILE):
raise SystemExit("Config file '" + sickbeard.CONFIG_FILE + "' must be writeable")
elif not os.access(os.path.dirname(sickbeard.CONFIG_FILE), os.W_OK):
raise SystemExit("Config file root dir '" + os.path.dirname(sickbeard.CONFIG_FILE) + "' must be writeable")
raise SystemExit("Config file root dir '" + os.path.dirname(sickbeard.CONFIG_FILE) + "' must be writeable")

os.chdir(sickbeard.DATA_DIR)

if consoleLogging:
print "Starting up Sick Beard "+SICKBEARD_VERSION+" from " + sickbeard.CONFIG_FILE
print "Starting up Sick Beard " + SICKBEARD_VERSION + " from " + sickbeard.CONFIG_FILE

# load the config and publish it to the sickbeard package
if not os.path.isfile(sickbeard.CONFIG_FILE):
Expand All @@ -233,18 +240,16 @@ def main():

if sickbeard.DAEMON:
daemonize()

# use this pid for everything
sickbeard.PID = os.getpid()

if forcedPort:
logger.log(u"Forcing web server to port "+str(forcedPort))
logger.log(u"Forcing web server to port " + str(forcedPort))
startPort = forcedPort
else:
startPort = sickbeard.WEB_PORT

logger.log(u"Starting Sick Beard on http://localhost:"+str(startPort))

if sickbeard.WEB_LOG:
log_dir = sickbeard.LOG_DIR
else:
Expand All @@ -263,17 +268,20 @@ def main():

try:
initWebServer({
'port': startPort,
'host': webhost,
'port': startPort,
'host': webhost,
'data_root': os.path.join(sickbeard.PROG_DIR, 'data'),
'web_root': sickbeard.WEB_ROOT,
'log_dir': log_dir,
'username': sickbeard.WEB_USERNAME,
'password': sickbeard.WEB_PASSWORD,
'web_root': sickbeard.WEB_ROOT,
'log_dir': log_dir,
'username': sickbeard.WEB_USERNAME,
'password': sickbeard.WEB_PASSWORD,
'enable_https': sickbeard.ENABLE_HTTPS,
'https_cert': sickbeard.HTTPS_CERT,
'https_key': sickbeard.HTTPS_KEY,
})
except IOError:
logger.log(u"Unable to start web server, is something else running on port %d?" % startPort, logger.ERROR)
if sickbeard.LAUNCH_BROWSER:
if sickbeard.LAUNCH_BROWSER and not sickbeard.DAEMON:
logger.log(u"Launching browser and exiting", logger.ERROR)
sickbeard.launchBrowser(startPort)
sys.exit()
Expand All @@ -286,7 +294,7 @@ def main():
sickbeard.start()

# launch browser if we're supposed to
if sickbeard.LAUNCH_BROWSER and not noLaunch:
if sickbeard.LAUNCH_BROWSER and not noLaunch and not sickbeard.DAEMON:
sickbeard.launchBrowser(startPort)

# start an update if we're supposed to
Expand All @@ -297,7 +305,6 @@ def main():
while (True):

if sickbeard.invoked_command:
logger.log(u"Executing invoked command: "+repr(sickbeard.invoked_command))
sickbeard.invoked_command()
sickbeard.invoked_command = None

Expand Down
3 changes: 2 additions & 1 deletion autoProcessTV/autoProcessTV.cfg.sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ host=localhost
port=8081
username=
password=
web_root=
web_root=
ssl=0
11 changes: 10 additions & 1 deletion autoProcessTV/autoProcessTV.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ def processEpisode(dirName, nzbName=None):
port = config.get("SickBeard", "port")
username = config.get("SickBeard", "username")
password = config.get("SickBeard", "password")
try:
ssl = int(config.get("SickBeard", "ssl"))
except (ConfigParser.NoOptionError, ValueError):
ssl = 0

try:
web_root = config.get("SickBeard", "web_root")
Expand All @@ -73,7 +77,12 @@ def processEpisode(dirName, nzbName=None):

myOpener = AuthURLOpener(username, password)

url = "http://" + host + ":" + port + web_root + "/home/postprocess/processEpisode?" + urllib.urlencode(params)
if ssl:
protocol = "https://"
else:
protocol = "http://"

url = protocol + host + ":" + port + web_root + "/home/postprocess/processEpisode?" + urllib.urlencode(params)

print "Opening URL:", url

Expand Down
3 changes: 2 additions & 1 deletion data/css/config.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#config{text-align:center;padding:0 30px 20px;}
#config *{font-family:"Trebuchet MS", Verdana, sans-serif;margin:0;padding:0;}
#config input[type=submit], #config input[type=button] { padding: 1px 5px; }
#config h3 a {text-decoration: none;}
#config h3 img {vertical-align: baseline; padding-right: 5px;}
#config ul{list-style-type:none;padding-left: 20px;}
Expand All @@ -13,7 +14,7 @@
#config-components{float:left;width:auto;}
#config-components-border{float:left;width:auto;border-top:1px solid #999;padding:5px 0;}
#config .title-group{border-bottom:1px dotted #666;position:relative;padding:25px 15px 25px;}
#config .component-group{border-bottom:1px dotted #666;position:relative;padding:15px 15px 25px;}
#config .component-group{border-top:1px dotted #666;position:relative;padding:15px 15px 25px;}
#config .component-group-desc{float:left;width:235px;}
#config .component-group-desc h3{font-size:1.5em;}
#config .component-group-desc p{width:85%;font-size:1.2em;color:#666;margin:.8em 0;}
Expand Down
70 changes: 51 additions & 19 deletions data/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
img { border: 0; vertical-align: middle;}

body {
text-rendering: optimizeLegibility;
background-color:#F5F1E4;
color:#000;
font-family:'Verdana', 'Helvetica', 'Sans-serif', 'sans';
Expand Down Expand Up @@ -56,14 +57,15 @@ margin:0;

h1 {
text-align:left;
font-size:19px;
line-height:20px;
font-size:21px;
line-height:23px;
font-weight:400;
}
h1.title {
padding-bottom:4px;
margin-bottom:12px;
border-bottom:1px solid #4e4e4e;
}

h1 a {
text-decoration:none;
}
Expand Down Expand Up @@ -123,23 +125,34 @@ font-size: 1em;
}

.sickbeardTable {
width:100%;
margin-left:auto;
margin-right:auto;
width: 100%;
margin-left:auto;
margin-right:auto;
text-align:left;
color: #000;
background-color: #fff;
border-spacing: 0;
}
.sickbeardTable th,
.sickbeardTable td {
padding: 4px;
border-left: #fff 1px solid;
border-top: #fff 1px solid;
}
.sickbeardTable th:first-child,
.sickbeardTable td:first-child {
border-left: none;
}
.sickbeardTable th{
padding:3px;
font-weight:700;
background-color:#333;
color:#FFF;
text-shadow: -1px -1px 0 rgba(0,0,0,0.3);
}
.sickbeardTable td{
padding:4px;
border-collapse: collapse;
background-color: #333;
color: #fff;
text-shadow: -1px -1px 0 rgba(0,0,0,0.3);
text-align: center;
}
.sickbeardTable tfoot a {
color:#FFF;
text-decoration: none;
color:#fff;
text-decoration: none;
}

.row {
Expand All @@ -148,9 +161,10 @@ clear:left;

.plotInfo {
cursor:help;
margin-left: 8px;
position: relative;
font-weight: 700;
float: right;
position: relative;
margin-left: 8px;
}

#tooltip {
Expand Down Expand Up @@ -270,6 +284,10 @@ padding:2px;
background-color:#000;
color:#fff;
}
.sf-menu li:hover, .sf-menu li.sfHover,
.sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {
color: #f5f5f5 !important;
}
#donate {
line-height:1em;
background: #57442B;
Expand Down Expand Up @@ -331,7 +349,10 @@ div#addShowPortal button div.button img{ position: absolute; display: block; to
div#addShowPortal button .buttontext { position: relative; display: block; padding: 0.1em 0.4em 0.1em 4.4em; text-align: left; }

#rootDirs, #rootDirsControls { width: 50%; min-width: 400px; }

td.tvShow { font-weight: bold; }

td.tvShow a {text-decoration: none; font-size: 1.2em; }
td.tvShow:hover { background-color: #cfcfcf !important; cursor: pointer; }
.navShow { display: inline; cursor: pointer; vertical-align: top; }

Expand All @@ -353,6 +374,17 @@ a.whitelink { color: white; }
}
div.ui-pnotify { min-width: 340px; max-width: 550px; width: auto !important;}

/* override for qtip2 */
.ui-tooltip-sb .ui-tooltip-titlebar a { color: #222222; text-decoration: none; }
.ui-tooltip, .qtip { max-width: 500px !important; }

option.flag {
padding-left: 35px;
background-color: #fff;
background-repeat: no-repeat;
background-position: 10px 50%;
}

span.quality {
font: bold 1em/1.2em verdana, sans-serif;
background: none repeat scroll 0 0 #999999;
Expand All @@ -367,7 +399,7 @@ span.quality {
span.Custom {
background: none repeat scroll 0 0 #444499; /* blue */
}
span.HD {
span.HD,span.WEB-DL,span.BluRay {
background: none repeat scroll 0 0 #449944; /* green */
}
span.SD {
Expand Down
11 changes: 0 additions & 11 deletions data/css/jquery.pnotify.default.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,3 @@ html > body .ui-pnotify {
display: block;
margin: 0 auto;
}
.ui-pnotify .picon {
background-color: transparent;
background-repeat: no-repeat;
background-position: center center;
width: 17px;
height: 17px;
}
.ui-pnotify .ui-widget {
font-family: verdana, sans-serif;
font-size: 95% !important;
}
Loading

0 comments on commit a4514a5

Please sign in to comment.