From 4d8081533c94005c0078bd4a33203c2f9b659428 Mon Sep 17 00:00:00 2001 From: Michael Dlesk Date: Sat, 24 Dec 2011 22:31:56 -0500 Subject: [PATCH 1/2] Added log and settings page --- Gamez.ini | 10 +- Gamez.py | 16 ++- css/navigation.css | 35 ++++- css/settings.css | 54 ++++++++ lib/ConfigFunctions.py | 4 - lib/ConfigFunctions.pyc | Bin 1787 -> 1716 bytes lib/Constants.pyc | Bin 267 -> 267 bytes lib/DBFunctions.py | 80 +++++++++++- lib/DBFunctions.pyc | Bin 5906 -> 9111 bytes lib/GameTasks.py | 6 + lib/GameTasks.pyc | Bin 3370 -> 3690 bytes lib/Logger.py | 9 ++ lib/Logger.pyc | Bin 0 -> 480 bytes lib/UpgradeFunctions.py | 11 +- lib/UpgradeFunctions.pyc | Bin 4008 -> 4395 bytes lib/WebRoot.py | 273 ++++++++++++++++++++++++++++++++++++++- lib/WebRoot.pyc | Bin 10372 -> 21995 bytes lib/__init__.pyc | Bin 120 -> 120 bytes 18 files changed, 477 insertions(+), 21 deletions(-) create mode 100644 css/settings.css create mode 100644 lib/Logger.py create mode 100644 lib/Logger.pyc diff --git a/Gamez.ini b/Gamez.ini index a92a8ed..fc18e19 100644 --- a/Gamez.ini +++ b/Gamez.ini @@ -3,19 +3,17 @@ server.socket_host = "127.0.0.1" server.socket_port = 8085 [NZBMatrix] -username = -api_key = +username = "" +api_key = "" [Sabnzbd] -api_key = +api_key = "" host = "127.0.0.1" -port = 8080 -password = "" [Scheduler] download_interval = 60 [SystemGenerated] is_to_ignore_update = 0 -ignored_version = +ignored_version = "" diff --git a/Gamez.py b/Gamez.py index 665ac2e..5e48955 100644 --- a/Gamez.py +++ b/Gamez.py @@ -14,12 +14,15 @@ import cherrypy.process.plugins from cherrypy.process.plugins import Daemonizer from lib.ConfigFunctions import CheckConfigForAllKeys +from lib.DBFunctions import ValidateDB +from lib.Logger import LogEvent app_path = os.path.dirname(os.path.abspath("__FILE__")) config_path = os.path.join(app_path,'Gamez.ini') class RunApp(): def RunWebServer(self,isToDaemonize): + LogEvent("Generating CherryPy configuration") cherrypy.config.update(config_path) css_path = os.path.join(app_path,'css') images_path = os.path.join(app_path,'images') @@ -38,11 +41,15 @@ def RunWebServer(self,isToDaemonize): } daemon = Daemonizer(cherrypy.engine) - if(isToDaemonize == 1): + if(isToDaemonize == 1): + LogEvent("Preparing to run in daemon mode") daemon.subscribe() + LogEvent("Generating Post Process Script") GenerateSabPostProcessScript() RunGameTask() + + LogEvent("Getting download interval from config file and invoking scheduler") config = ConfigParser.RawConfigParser() config.read('Gamez.ini') interval = config.get('Scheduler','download_interval').replace('"','') @@ -50,8 +57,11 @@ def RunWebServer(self,isToDaemonize): workerTask = cherrypy.process.plugins.BackgroundTask(fInterval,RunGameTask) try: workerTask.start() + + LogEvent("Starting the Gamez web server") cherrypy.quickstart(WebRoot(app_path),'/',config=conf) except KeyboardInterrupt: + LogEvent("Shutting down Gamez") workerTask.cancel() if(isToDaemonize == 1): daemon.unsubscribe() @@ -103,12 +113,16 @@ def RunGameTask(): sabnzbdHost = config.get('Sabnzbd','host').replace('"','') sabnzbdPort = config.get('Sabnzbd','port').replace('"','') sabnzbdApi = config.get('Sabnzbd','api_key').replace('"','') + LogEvent("Searching for games") lib.GameTasks.GameTasks().FindGames(nzbMatrixUser,nzbMatrixApi,sabnzbdApi,sabnzbdHost,sabnzbdPort) except: print(sys.exc_info()[0]) if __name__ == '__main__': + LogEvent("Checking config file for completeness") CheckConfigForAllKeys(app_path) + LogEvent("Checking to make sure all tables exist in the database") + ValidateDB() isToDaemonize = 0 params = sys.argv for param in params: diff --git a/css/navigation.css b/css/navigation.css index dd32981..184aae3 100644 --- a/css/navigation.css +++ b/css/navigation.css @@ -171,4 +171,37 @@ div#menu li.back .left { background-color: khaki; color: Maroon; border: solid 1px silver; -} \ No newline at end of file +} + + +.clear-log-button { + border-top: 1px solid #96d1f8; + background: #65a9d7; + background: -webkit-gradient(linear, left top, left bottom, from(#3e779d), to(#65a9d7)); + background: -webkit-linear-gradient(top, #3e779d, #65a9d7); + background: -moz-linear-gradient(top, #3e779d, #65a9d7); + background: -ms-linear-gradient(top, #3e779d, #65a9d7); + background: -o-linear-gradient(top, #3e779d, #65a9d7); + padding: 5px 10px; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + border-radius: 8px; + -webkit-box-shadow: rgba(0,0,0,1) 0 1px 0; + -moz-box-shadow: rgba(0,0,0,1) 0 1px 0; + box-shadow: rgba(0,0,0,1) 0 1px 0; + text-shadow: rgba(0,0,0,.4) 0 1px 0; + color: white; + font-size: 14px; + font-family: Georgia, serif; + text-decoration: none; + vertical-align: middle; + } +.clear-log-button:hover { + border-top-color: #28597a; + background: #28597a; + color: #ccc; + } +.clear-log-button:active { + border-top-color: #1b435e; + background: #1b435e; + } \ No newline at end of file diff --git a/css/settings.css b/css/settings.css new file mode 100644 index 0000000..ea48f7c --- /dev/null +++ b/css/settings.css @@ -0,0 +1,54 @@ +body{ +font-family:"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif; +font-size:12px; +} +p, h1, form, button{border:0; margin:0; padding:0;} +.spacer{clear:both; height:1px;} +/* ----------- My Form ----------- */ +.myform{ +margin:0 auto; +width:600px; +padding:14px; +} + +/* ----------- stylized ----------- */ +#stylized{ +border:solid 2px #b7ddf2; +background:#ebf4fb; +} +#stylized h1 { +font-size:14px; +font-weight:bold; +margin-bottom:10px; +} +#stylized label{ +display:block; +font-weight:bold; +text-align:right; +width:240px; +float:left; +margin-top:5px; +} +#stylized input{ +float:left; +font-size:12px; +padding:4px 2px; +border:solid 1px #aacfe4; +width:300px; +margin:2px 0 20px 10px; +} +#stylized button{ +clear:both; +margin-left:250px; +width:125px; +height:31px; +background:#666666 url(img/button.png) no-repeat; +text-align:center; +line-height:31px; +color:#FFFFFF; +font-size:11px; +font-weight:bold; +} + + + diff --git a/lib/ConfigFunctions.py b/lib/ConfigFunctions.py index 96a2744..56c8e9b 100644 --- a/lib/ConfigFunctions.py +++ b/lib/ConfigFunctions.py @@ -51,10 +51,6 @@ def CheckConfigForAllKeys(app_path): config.set('Sabnzbd','host','"127.0.0.1"') changesMade = True - if(config.has_option('Sabnzbd','password') == False): - config.set('Sabnzbd','password','""') - changesMade = True - if(config.has_option('Scheduler','download_interval') == False): config.set('Scheduler','download_interval','60') changesMade = True diff --git a/lib/ConfigFunctions.pyc b/lib/ConfigFunctions.pyc index 1363c23d7ce760dbf8b6de27cfefac2da3799298..c573a68b0f47beb3b21cc0cecf274173b9289412 100644 GIT binary patch delta 181 zcmey(yM>pH`7ZjUh#lAw>wJz(N>F!F?nJ!VD=q49(08j3t~5wTujT3=B1l3`M-m zB|Ho@%nT_alUtcp8AT_rWQGOIF*O)h6X#lykCz)+A_TwI=Cl(N}@ eWeFo=#^k50iIW}J1h@r(azVl%LV0pDTOSkhN{>;nuBX}ZPD5KHDnDqcS`UW%r delta 19 acmeBX>SkhN{>;l2XfTm2l+kcv%z6MZH3ew^ diff --git a/lib/DBFunctions.py b/lib/DBFunctions.py index e003ca2..7b74c64 100644 --- a/lib/DBFunctions.py +++ b/lib/DBFunctions.py @@ -1,6 +1,8 @@ import os import sqlite3 import sys +import datetime +from Logger import LogEvent def GetAllWiiGames(): db_path = os.path.join(os.path.abspath(""),"Gamez.db") @@ -94,6 +96,7 @@ def GetWiiGameDataFromTerm(term): return data def AddWiiGameToDb(db_id,status): + LogEvent("Adding game in 'Wanted' status") db_path = os.path.join(os.path.abspath(""),"Gamez.db") sql = "insert into requested_games(WiiGameID,status) select '" + db_id + "','" + status + "' where not exists(select 1 from requested_games where WiiGameID='" + db_id + "')" connection = sqlite3.connect(db_path) @@ -117,7 +120,14 @@ def GetRequestedGames(): game_name = str(record[1]) game_id = str(record[2]) status = str(record[3]) - rowdata = "Delete" + game_name + "" + game_id + "" + status + "" + rowdata = "Delete" + game_name + "" + game_id + "" + status + "" data = data + rowdata except: continue @@ -125,6 +135,7 @@ def GetRequestedGames(): return data def RemoveWiiGameFromDb(db_id): + LogEvent("Removing game") db_path = os.path.join(os.path.abspath(""),"Gamez.db") sql = "delete from requested_games where WiiGameID='" + db_id + "'" connection = sqlite3.connect(db_path) @@ -145,6 +156,7 @@ def GetRequestedGamesAsArray(): return result def UpdateStatus(game_id,status): + LogEvent("Update status of game to " + status) db_path = os.path.join(os.path.abspath(""),"Gamez.db") sql = "update requested_games set status='" + status + "' where WiiGameID='" + game_id + "'" connection = sqlite3.connect(db_path) @@ -152,4 +164,70 @@ def UpdateStatus(game_id,status): cursor.execute(sql) connection.commit() cursor.close() + return + +def ValidateDB(): + LogEvent("Checking to make sure database has the correct tables") + db_path = os.path.join(os.path.abspath(""),"Gamez.db") + sql = "select name from sqlite_master where type='table'" + logTableExists = False + connection = sqlite3.connect(db_path) + cursor = connection.cursor() + cursor.execute(sql) + result = cursor.fetchall() + tables = list() + for record in result: + tableName = str(record[0]) + if(tableName == 'gamez_log'): + logTableExists = True + cursor.close() + if(logTableExists == False): + LogEvent("Creating table 'gamez_log'") + sql = "create table gamez_log(ID INTEGER NOT NULL PRIMARY KEY UNIQUE,message TEXT(255) NOT NULL,created_date DATE)" + connection = sqlite3.connect(db_path) + cursor = connection.cursor() + cursor.execute(sql) + connection.commit() + cursor.close() + return + +def AddEventToDB(message): + db_path = os.path.join(os.path.abspath(""),"Gamez.db") + createdDate = datetime.datetime.now() + sql = "INSERT INTO gamez_log (message,created_date) values('" + message + "',datetime())" + connection = sqlite3.connect(db_path) + cursor = connection.cursor() + cursor.execute(sql) + connection.commit() + cursor.close() + return + +def GetLog(): + db_path = os.path.join(os.path.abspath(""),"Gamez.db") + sql = "SELECT message,created_date FROM gamez_log order by created_date desc" + data = '' + connection = sqlite3.connect(db_path) + cursor = connection.cursor() + cursor.execute(sql) + result = cursor.fetchall() + for record in result: + try: + message = str(record[0]) + created_date = str(record[1]) + rowdata = "" + message + "" + created_date + "" + data = data + rowdata + except: + continue + cursor.close() + return data + +def ClearDBLog(): + db_path = os.path.join(os.path.abspath(""),"Gamez.db") + createdDate = datetime.datetime.now() + sql = "delete from gamez_log" + connection = sqlite3.connect(db_path) + cursor = connection.cursor() + cursor.execute(sql) + connection.commit() + cursor.close() return \ No newline at end of file diff --git a/lib/DBFunctions.pyc b/lib/DBFunctions.pyc index 8eac889fe5c7d975ea9e673d55e99dbd91fc54b0..cd55db8e593d5081422637210cecdffe46eb9ce7 100644 GIT binary patch literal 9111 zcmeHN&2t+`74MP!CHXTS8R@cSvg>i0-I{8=Ip;z^pf#1kv2&xj|PB%c*evYgL|phs-= ziYL9o^0MM*7~Chk9?tX&ua`3e!t3KqPI&#C$qR3QGlRm*ab`$(dCm+AZ;&%1!W-hu zsPKk4GbX$d&YTh6C}+;nikFIGSiS!r{Hqi#Wa9xO_rmq^OIeHgT?bLogYP`PDvLg` z5Sy0R%p@7SjU~RsyJp0f8L^KI$clXwEwPV2Jz}$0Gz4|n&x%G?Z1#ySh1l;A4K($O z29LFF?Inm&qxk!^>NWa*`F7(pY;E9%L?-$%Ykn|tW zWemn9=EQgdU;gdKZ(fY==S3qU8pvVS#Z0e+q=HMN)^fu zBTq*5+FrA>?W(Fz^Tu=<1w~R;DEL(HDbE$RZt>4>o_`t*|KB*j;t-l+>JuvLx)9rL zyuq2x(67b)sBza6S5jW>1b!@UaD6qb)nqk}`%qu4M=FfCTE3FidMsHap3Atp;RZpR zrLnQ@5XtSpt;)EU#s#60MG_Vs>#eQwqqzG{!0Yhb*p2hlS3l1WYfg>^&~qcH>VaND zB&*mMoT?D%Ci08<9?xwylk-uyOVbw7S8$@fh1~qDr=LaPCf-RsU7)jh8u)8ZOLy+p zYtJ#kykk;WKItS;PFzT4UyO$vT_KT7y;|pDI1} z{|a)Hf;c3$2NmQtYK($-zKVUEM~m=xuO3dS3~!+w4oRa!y5W$>IwW@v9lAqG%(Cc^ zd^&Wb4(XFaitdo4uxLA@R3ylB&QNle5|UHr93|%|d5@9{l#EmIH6*8yP9vK4uva!_ zQg0=lwEgrxDSZD0g*U)AfEzFki0>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py index cc91d8f..e48c73f 100644 --- a/lib/GameTasks.py +++ b/lib/GameTasks.py @@ -6,6 +6,7 @@ import shutil import stat from subprocess import call +from Logger import LogEvent class GameTasks(): @@ -18,6 +19,7 @@ def FindGames(self, nzbmatrixusername, nzbmatrixapi,sabnzbdApi,sabnzbdHost,sabnz try: game_name = str(game[0]) game_id = str(game[1]) + LogEvent("Searching for game: " + game_name) nzbmatrixResult = GameTasks().FindGameOnNZBMatrix(game_name,game_id,nzbmatrixusername,nzbmatrixapi,sabnzbdApi,sabnzbdHost,sabnzbdPort) except: error = sys.exc_info()[0] @@ -37,6 +39,7 @@ def FindGameOnNZBMatrix(self,game_name,game_id,username,api,sabnzbdApi,sabnzbdHo nzbID = nzbID.replace(";","") if(nzbID <> "nothing_found"): + LogEvent("Game found on NZB Matrix") GameTasks().AddNZBToSab(nzbID,game_name,sabnzbdApi,sabnzbdHost,sabnzbdPort,game_id) UpdateStatus(game_id,"Snatched") return @@ -47,6 +50,7 @@ def AddNZBToSab(self,nzbID,game_name,sabnzbdApi,sabnzbdHost,sabnzbdPort,game_id) responseObject = urllib.FancyURLopener({}).open(url) responseObject.read() responseObject.close() + LogEvent("NZB added to Sabnzbd") return def CheckIfPostProcessExistsInSab(self,sabnzbdApi,sabnzbdHost,sabnzbdPort): @@ -61,10 +65,12 @@ def CheckIfPostProcessExistsInSab(self,sabnzbdApi,sabnzbdHost,sabnzbdPort): destPath = os.path.join(scriptDir,"gamezPostProcess.py") try: + LogEvent("Copying post process script to Sabnzbd scripts folder") shutil.copyfile(srcPath,destPath) except: print 'Error Copying File' try: + LogEvent("Setting permissions on post process script") cmd = "chmod +x '" + destPath + "'" os.system(cmd) except: diff --git a/lib/GameTasks.pyc b/lib/GameTasks.pyc index 2f45429b87784f99e8f26cc3c4a092d5a2fb5e79..b87f9897a75f77cbef3806881037c1fd0cfacd7f 100644 GIT binary patch delta 1207 zcmZux&u<$=6n?X|*WMp?9Jh({t7cUqu?eM-s#Yo-DjYaa}hqi}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q*R*=yQ|*jN&lH8pM@Af12oIRp@kNz4-J zSe5C_UEykG==CSXsP_3v3W7K^4Cq9mv)j$9t^tVXSTH;1A}q8Az)A3B#)&~@%YcA} zU_!@$Z3O)7o!s*d>+BLY^=Yc^nZ86bx8nJpZpwJZ^IBeUrnS+gsT9xFn>Fz`K7p3_ z6dyq@zksS3GRBUD<^Nao6a}CKAl_c}QYBd3t$LUYc8Os`+&2~ub642Y=biv)l~@OfN{q$NpWoCIjY9-005a7G0> khlDo0X0yILX&)tneO!DrixMrBW}Q#*uJq7G{FS8i3$}cZs{jB1 diff --git a/lib/Logger.py b/lib/Logger.py new file mode 100644 index 0000000..e53db6b --- /dev/null +++ b/lib/Logger.py @@ -0,0 +1,9 @@ +import DBFunctions + +def LogEvent(message): + DBFunctions.AddEventToDB(message) + return + +def ClearLog(): + ClearDBLog() + return \ No newline at end of file diff --git a/lib/Logger.pyc b/lib/Logger.pyc new file mode 100644 index 0000000000000000000000000000000000000000..483bcc2d61082961f115917e09a043d6cd467141 GIT binary patch literal 480 zcmbV{!AiqG5Qb-xO0~8JpFr@mCm%pWG>v+ZAgw3KC1#h9l4K>j6%=pv3HqL%1h4wf zQmj{9GLwHZfByY8{+Nv3*PmHQn-$@Gj&et68V^%LbPo~H8w8V%gNS4_R|DAUFRZL& zNGXY!qTB(RCt5JQ60MjRd2=O}Oo_?wqov8!vMYUUJLkvPUub>#WIBIm(`J!*`M0NrFk!C=b|_ErPnHliQ!2+MaK5`82*0 z_-^9s{*K10FJ2ol-pI&^ugGhWQAK=Jg{t@o=}f9TAw$Sh;-{rklTKZRSd97j#d?n6 zo>fUEsOroL?ugq#9!=`XFgpETqp&z9L+pp`A*i{N2`S#l5Eg23QlaeUdA^r#q$jGc ztNx4YYq6aXu7y6#|3c@}lQX#Pj{A_eKenxtwAXIKgHB zoM!Q1W*uMPVcfO9Tu*zcUqEm7mGidy(DrN*dz<)W=u&s!^MkbA%L{uj=qDI}M@8<# z!*DZ~g~8;Y+(m~UX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SPBZ(QoJoJaRefVdBGkj3 zOMtCI;dmNRB3c0+R?LD~!m}7q@gDjnsQ4>P3a7(u$72#IDF?tXWFW8(fdM2aFiNG8 z5IpZb(P02jfC_+sz#*`}Hkznc!AnR8Ow(W-&=k__wS~b_NY|J^@aO;_k+ZrP&D|V>La82(J};Ml(Y|FF&U4zRYpx2 z-ICF588*eQlzmAJfAHJ4R(`>Qxyo>hb?+sDTOeb3Ed%41=m7oVRzDm_2__I^P;w(7!L8`|8%~cA4-6 zuDL|7441iy;m5Znfz7})5A;0e6)GQ=O63cDV*z*_c7u_~7ZVjKOgOCMi{%mm)L zgJ6>t-KpdY7<5WjcUuhTcR0h5DMF!@9EAj;Wt3+Aadx_vncm4s#ZjDP8|N^Z$cEOq z(T5O`rO{A%jgy%B{tG8L^2Y9<-L}rX9%R|oT3KQwYd&8q!*{K<##J7(A#1!PDm}Zs zOr3X{e7f@sJYZSJdpIaT3;Rx7R*GnBGmNXY}cB%}SApx_d(`l*G1!)-+a!Bk>)$U~A z({kaiFRZ;r&m=JA-)I9;i)HJI05ukAoQ@bsgf(Q(|>m;X(@%pfn z7B+-qDLYhH;Yz_WJdK*G3c(faa6FhylSuSKXrmvY`Nqj&1(RPY`d{QX>i;L)a0iW` zh?qyhSVYQbXlc +
  • + + Settings + +
  • +
  • + + Log + +
  • @@ -76,6 +89,7 @@ def index(self,status_message='',version=''): html = html + """No games added. Try searching for some.""" else: html = html + """ + @@ -83,6 +97,7 @@ def index(self,status_message='',version=''): + """ @@ -114,12 +129,11 @@ def search(self,term=''): - - + - + @@ -130,12 +144,22 @@ def search(self,term=''): Home +
  • + + Settings + +
  • +
  • + + Log + +
  • -
    +
      - + + + + + + + + +
    +
    +

    General

    + + + + + + + + + + +

    SABnzbd+

    + + + + + + + + + + +

    NZB Matrix

    + + + + + + + + +
    + + + +
    + + + + + + + + """ + return html; + + @cherrypy.expose + def log(self,status_message='',version=''): + if(os.name <> 'nt'): + os.chdir(WebRoot.appPath) + html = """ + + + + + + + + + + + + + + """ + html = html + """ + + +
    """ + db_result = GetLog() + if(db_result == ''): + html = html + """No log entries.""" + else: + html = html + """ + +
    Game Name Game ID StatusUpdate Status
    + + + + + + """ + html = html + db_result + html = html + """ + +
    MessageDate / Time
    +
    + + """ + html = html + """ +
    + + + + """ return html; @@ -225,4 +456,32 @@ def ignorecurrentversion(self,verification): def upgradetolatestversion(self,verification): if(verification == "SYSTEM_DIRECTED"): status = UpdateToLatestVersion(WebRoot.appPath) - raise cherrypy.InternalRedirect("/?status_message=" + status) \ No newline at end of file + raise cherrypy.InternalRedirect("/?status_message=" + status) + + @cherrypy.expose + def savesettings(self,cherrypyHost='', nzbMatrixUsername='', downloadInterval=3600, sabPort='', nzbMatrixApi='', sabApi='', cherrypyPort='', sabHost=''): + cherrypyHost = '"' + cherrypyHost + '"' + nzbMatrixUsername = '"' + nzbMatrixUsername + '"' + nzbMatrixApi = '"' + nzbMatrixApi + '"' + sabApi = '"' + sabApi + '"' + sabHost = '"' + sabHost + '"' + config = ConfigParser.RawConfigParser() + configFilePath = os.path.join(WebRoot.appPath,'Gamez.ini') + config.read(configFilePath) + config.set('global','server.socket_host',cherrypyHost) + config.set('global','server.socket_port',cherrypyPort) + config.set('NZBMatrix','username',nzbMatrixUsername) + config.set('NZBMatrix','api_key',nzbMatrixApi) + config.set('Sabnzbd','host',sabHost) + config.set('Sabnzbd','port',sabPort) + config.set('Sabnzbd','api_key',sabApi) + config.set('Scheduler','download_interval',downloadInterval) + with open(configFilePath,'wb') as configFile: + config.write(configFile) + status = "Application Settings Updated Successfully. Gamez is restarting. If after 5 seconds, Gamez isn't working, update the Gamez.ini file and re-launch Gamez" + raise cherrypy.InternalRedirect("/?status_message=" + status) + + @cherrypy.expose + def clearlog(self): + ClearDBLog() + raise cherrypy.InternalRedirect('/') \ No newline at end of file diff --git a/lib/WebRoot.pyc b/lib/WebRoot.pyc index 9fd54e7b5379f9602933799bed840286daecad38..ecd1093f151429519ae0dc32250c088f635dd389 100644 G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fyuT%A)bz+T{pIJUAZnvO2Fg?L}u z%K%ygw?s^|v?xZmR1wZey>nGbg+1po+KVpzNrhl$~Ar8b#CxM z%R8;RhSNB;0(AoGEpU5ai{_5S;ECnAi#aDMRE#=D4>U+`B{#h|doe3kf)&nNQRc5A z%r3E-l{&{y#cS7iTM}77vv>gQFm0Vk_Nc)PGwDbOC7XM-SSYzpy^wK%q(FX$~;ESP9&0o}y9851Mpy!v_d)%p20#R+VsrOGC1WlM#;Q$vx-&Yhlo o^2y@dVmjlVxRRgs<_q~!<*!mYReI)}gJGF2i+>yoJ20XB1VC2D82|tP diff --git a/lib/__init__.pyc b/lib/__init__.pyc index da42fe5fb3ec08bc27a7876d541cb0d76d2d55f8..7c98187df73dbe85df2ce402f8946eda05cc3b71 100644 GIT binary patch delta 13 Ucmb=ZU}yf!%k?Ap>qPcK03zN6P5=M^ delta 13 Ucmb=ZU}yf!%XMGw%S84<03kaB{{R30 From da8bf46f8c86e866946ec8b06ebcf3b179f4c3c1 Mon Sep 17 00:00:00 2001 From: Michael Dlesk Date: Sat, 24 Dec 2011 22:47:06 -0500 Subject: [PATCH 2/2] Added version number --- lib/Constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Constants.py b/lib/Constants.py index 5216c00..7144977 100644 --- a/lib/Constants.py +++ b/lib/Constants.py @@ -1,2 +1,2 @@ def VersionNumber(): - return "0.0.0.1" + return "0.0.0.3"