Skip to content

Commit

Permalink
Added game art
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Dlesk committed Jan 7, 2012
1 parent f301bb6 commit 09e354d
Show file tree
Hide file tree
Showing 50 changed files with 95 additions and 20 deletions.
Binary file modified Gamez.db
Binary file not shown.
13 changes: 8 additions & 5 deletions Gamez.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ server.socket_host = "127.0.0.1"
server.socket_port = 8085

[NZBMatrix]
username = ""
api_key = ""
username =
api_key =

[Newznab]
api_key = ""
api_key =
wii_category_id = "1030"
xbox360_category_id = "1050"
host = ""
host =
port =

[Sabnzbd]
api_key = ""
api_key =
host = "127.0.0.1"
port = 8081

Expand All @@ -26,3 +26,6 @@ is_to_ignore_update = 0
ignored_version =
api_key = "ikzFRzA1Y8I1UajNJAOQ803TbTYk1vLB64A9SxrAxAw"

[Notifications]
prowl__api = ""

Binary file modified cherrypy/__init__.pyc
Binary file not shown.
Binary file modified cherrypy/_cpchecker.pyc
Binary file not shown.
Binary file modified cherrypy/_cpcompat.pyc
Binary file not shown.
Binary file modified cherrypy/_cpconfig.pyc
Binary file not shown.
Binary file modified cherrypy/_cpdispatch.pyc
Binary file not shown.
Binary file modified cherrypy/_cperror.pyc
Binary file not shown.
Binary file modified cherrypy/_cplogging.pyc
Binary file not shown.
Binary file modified cherrypy/_cpreqbody.pyc
Binary file not shown.
Binary file modified cherrypy/_cprequest.pyc
Binary file not shown.
Binary file modified cherrypy/_cpserver.pyc
Binary file not shown.
Binary file modified cherrypy/_cptools.pyc
Binary file not shown.
Binary file modified cherrypy/_cptree.pyc
Binary file not shown.
Binary file modified cherrypy/_cpwsgi.pyc
Binary file not shown.
Binary file modified cherrypy/_cpwsgi_server.pyc
Binary file not shown.
Binary file modified cherrypy/lib/__init__.pyc
Binary file not shown.
Binary file modified cherrypy/lib/auth.pyc
Binary file not shown.
Binary file modified cherrypy/lib/auth_basic.pyc
Binary file not shown.
Binary file modified cherrypy/lib/auth_digest.pyc
Binary file not shown.
Binary file modified cherrypy/lib/caching.pyc
Binary file not shown.
Binary file modified cherrypy/lib/cptools.pyc
Binary file not shown.
Binary file modified cherrypy/lib/encoding.pyc
Binary file not shown.
Binary file modified cherrypy/lib/httpauth.pyc
Binary file not shown.
Binary file modified cherrypy/lib/httputil.pyc
Binary file not shown.
Binary file modified cherrypy/lib/jsontools.pyc
Binary file not shown.
Binary file modified cherrypy/lib/reprconf.pyc
Binary file not shown.
Binary file modified cherrypy/lib/sessions.pyc
Binary file not shown.
Binary file modified cherrypy/lib/static.pyc
Binary file not shown.
Binary file modified cherrypy/lib/xmlrpcutil.pyc
Binary file not shown.
Binary file modified cherrypy/process/__init__.pyc
Binary file not shown.
Binary file modified cherrypy/process/plugins.pyc
Binary file not shown.
Binary file modified cherrypy/process/servers.pyc
Binary file not shown.
Binary file modified cherrypy/process/win32.pyc
Binary file not shown.
Binary file modified cherrypy/process/wspbus.pyc
Binary file not shown.
Binary file modified cherrypy/wsgiserver/__init__.pyc
Binary file not shown.
Binary file modified cherrypy/wsgiserver/wsgiserver2.pyc
Binary file not shown.
8 changes: 8 additions & 0 deletions lib/ConfigFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def CheckConfigForAllKeys(app_path):
config.add_section('Newznab')
changesMade = True

if(config.has_section('Notifications') == False):
config.add_section('Notifications')
changesMade = True

if(config.has_option('global','server.socket_host') == False):
config.set('global','server.socket_host','"127.0.0.1"')
changesMade = True
Expand Down Expand Up @@ -99,6 +103,10 @@ def CheckConfigForAllKeys(app_path):
config.set('Newznab','port','')
changesMade = True

if(config.has_option('Notifications','prowl_api') == False):
config.set('Notifications','prowl__api','""')
changesMade = True

if(changesMade):
with open(configFilePath,'wb') as configFile:
config.write(configFile)
Binary file modified lib/ConfigFunctions.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/Constants.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
def VersionNumber():
return "1.1.2.0"
return "1.1.3.0"
Binary file modified lib/Constants.pyc
Binary file not shown.
68 changes: 56 additions & 12 deletions lib/DBFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def GetGamesFromTerm(term):

def GetGameDataFromTerm(term):
db_path = os.path.join(os.path.abspath(""),"Gamez.db")
sql = "SELECT game_name,game_type,id,system FROM games where game_name like '%" + term.replace("'","''") + "%' order by game_name asc"
sql = "SELECT game_name,game_type,id,system,cover FROM games where game_name like '%" + term.replace("'","''") + "%' order by game_name asc"
data = ''
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
Expand All @@ -41,7 +41,8 @@ def GetGameDataFromTerm(term):
game_type = str(record[1])
db_id = str(record[2])
system = str(record[3])
rowdata = "<tr><td><a href='addgame?dbid=" + db_id + "'>Download</a></td><td>" + game_name + "</td><td>" + game_type + "</td><td>" + system + "</td></tr>"
cover = str(record[4])
rowdata = "<tr align='center'><td><a href='addgame?dbid=" + db_id + "'>Download</a></td><td><img width='85' height='120' src='" + cover + "' /></td><td>" + game_name + "</td><td>" + game_type + "</td><td>" + system + "</td></tr>"
data = data + rowdata
except:
continue
Expand All @@ -51,16 +52,17 @@ def GetGameDataFromTerm(term):
def AddGameToDb(db_id,status):
LogEvent("Adding game in 'Wanted' status")
db_path = os.path.join(os.path.abspath(""),"Gamez.db")
sql = "select game_name,system,game_type from games where ID = '" + db_id + "'"
sql = "select game_name,system,game_type,cover from games where ID = '" + db_id + "'"
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
cursor.execute(sql)
result = cursor.fetchall()[0]
game_name = str(result[0])
system = str(result[1])
game_type = str(result[2])
cover = str(result[3])
cursor.close()
sql = "insert into requested_games(GAME_NAME,SYSTEM,GAME_TYPE,status) values('" + game_name.replace("'","''") + "','" + system + "','" + game_type + "','" + status + "')"
sql = "insert into requested_games(GAME_NAME,SYSTEM,GAME_TYPE,status,cover) values('" + game_name.replace("'","''") + "','" + system + "','" + game_type + "','" + status + "','" + cover + "')"
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
cursor.execute(sql)
Expand All @@ -70,7 +72,7 @@ def AddGameToDb(db_id,status):

def GetRequestedGames():
db_path = os.path.join(os.path.abspath(""),"Gamez.db")
sql = "SELECT id,game_name,game_type,status,system FROM requested_games order by game_name asc"
sql = "SELECT id,game_name,game_type,status,system,cover FROM requested_games order by game_name asc"
data = ''
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
Expand All @@ -83,7 +85,8 @@ def GetRequestedGames():
game_type = str(record[2])
status = str(record[3])
system = str(record[4])
rowdata = "<tr><td><a href='removegame?dbid=" + db_id + "'>Delete</a></td><td>" + game_name + "</td><td>" + game_type + "</td><td>" + system + "</td><td>" + status + "</td><td><select id=updateSatusSelectObject class=ui-widget onchange=UpdateGameStatus(this.options[this.selectedIndex].value,'" + db_id + "')>"
cover = str(record[5])
rowdata = "<tr align='center'><td><a href='removegame?dbid=" + db_id + "'>Delete</a></td><td><center><img width='85' height='120' src='" + cover + "' /></center></td><td>" + game_name + "</td><td>" + game_type + "</td><td>" + system + "</td><td>" + status + "</td><td><select id=updateSatusSelectObject class=ui-widget onchange=UpdateGameStatus(this.options[this.selectedIndex].value,'" + db_id + "')>"
if(status == "Snatched"):
rowdata = rowdata + "<option>Downloaded</option><option selected=true>Snatched</option><option>Wanted</option>"
elif(status == "Downloaded"):
Expand Down Expand Up @@ -127,6 +130,8 @@ def UpdateStatus(game_id,status):
cursor.execute(sql)
connection.commit()
cursor.close()

Notifications.HandleNotifications(game_id,status)
return

def ValidateDB():
Expand Down Expand Up @@ -176,7 +181,7 @@ def ValidateDB():
cursor.execute(sql)
connection.commit()
cursor.close()
sql = "CREATE TABLE REQUESTED_GAMES (ID INTEGER PRIMARY KEY,GAME_NAME TEXT,SYSTEM TEXT,GAME_TYPE TEXT,STATUS TEXT)"
sql = "CREATE TABLE REQUESTED_GAMES (ID INTEGER PRIMARY KEY,GAME_NAME TEXT,SYSTEM TEXT,GAME_TYPE TEXT,STATUS TEXT,COVER TEXT)"
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
cursor.execute(sql)
Expand All @@ -200,15 +205,52 @@ def ValidateDB():
cursor.execute(sql)
connection.commit()
cursor.close()
sql = "CREATE TABLE GAMES (ID INTEGER PRIMARY KEY,GAME_NAME TEXT,SYSTEM TEXT,GAME_TYPE TEXT)"
sql = "CREATE TABLE GAMES (ID INTEGER PRIMARY KEY,GAME_NAME TEXT,SYSTEM TEXT,GAME_TYPE TEXT,COVER TEXT)"
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
cursor.execute(sql)
connection.commit()
cursor.close()
AddWiiGamesIfMissing()
print "Database upgrade complete"


try:
sql = "alter table games add column cover text"
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
cursor.execute(sql)
connection.commit()
cursor.close()
except:
status = "Do Nothing"

try:
sql = "alter table requested_games add column cover text"
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
cursor.execute(sql)
connection.commit()
cursor.close()
except:
status = "Do Nothing"

#loop requested games where cover is null
sql = "select game_name,cover,system from requested_games where cover is null"
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
cursor.execute(sql)
result = cursor.fetchall()
cursor.close()
for record in result:
game_name = str(record[0])
cover = str(record[1])
system = str(record[2])
sql = "update requested_games set cover = (Select cover from games where game_name = '" + game_name + "' and system = '" + system + "') Where game_name = '" + game_name + "' and system = '" + system + "'"
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
cursor.execute(sql)
connection.commit()
cursor.close()
return

def AddEventToDB(message):
Expand Down Expand Up @@ -277,6 +319,7 @@ def AddWiiGamesIfMissing():
for data in json_data:
game_name = data['GameTitle']
game_type = data['GameType']
game_cover = data['GameCover']
db_path = os.path.join(os.path.abspath(""),"Gamez.db")
sql = "SELECT count(ID) from games where game_name = '" + game_name.replace("'","''") + "' AND system='Wii'"
connection = sqlite3.connect(db_path)
Expand All @@ -287,7 +330,7 @@ def AddWiiGamesIfMissing():
cursor.close()
if(str(recordCount) == "0"):
LogEvent("Adding Wii Game [" + game_name.replace("'","''") + "] to Game List")
sql = "INSERT INTO games (game_name,game_type,system) values('" + game_name.replace("'","''") + "','" + game_type + "','Wii')"
sql = "INSERT INTO games (game_name,game_type,system,cover) values('" + game_name.replace("'","''") + "','" + game_type + "','Wii','" + game_cover + "')"
cursor = connection.cursor()
cursor.execute(sql)
connection.commit()
Expand All @@ -309,6 +352,7 @@ def AddXbox360GamesIfMissing():
for data in json_data:
game_name = data['GameTitle']
game_type = data['GameType']
game_cover = data['GameCover']
db_path = os.path.join(os.path.abspath(""),"Gamez.db")
sql = "SELECT count(ID) from games where game_name = '" + game_name.replace("'","''") + "' AND system='Xbox360'"
connection = sqlite3.connect(db_path)
Expand All @@ -319,7 +363,7 @@ def AddXbox360GamesIfMissing():
cursor.close()
if(str(recordCount) == "0"):
LogEvent("Adding XBOX 360 Game [" + game_name.replace("'","''") + "] to Game List")
sql = "INSERT INTO games (game_name,game_type,system) values('" + game_name.replace("'","''") + "','" + game_type + "','Xbox360')"
sql = "INSERT INTO games (game_name,game_type,system,cover) values('" + game_name.replace("'","''") + "','" + game_type + "','Xbox360','" + game_cover + "')"
cursor = connection.cursor()
cursor.execute(sql)
connection.commit()
Expand All @@ -338,7 +382,7 @@ def ApiGetGamesFromTerm(term,system):
try:
game_name = str(record[0])
system = str(record[1])
rowdata = '{"GameTitle":"' + game_name + '","System":"' + system + '"},'
rowdata = '{"GameTitle":"' + game_name + '","System":"' + system + '","GameCover":"' + cover + '"},'
data = data + rowdata
except:
continue
Expand Down
Binary file modified lib/DBFunctions.pyc
Binary file not shown.
Binary file modified lib/GameTasks.pyc
Binary file not shown.
Binary file modified lib/Logger.pyc
Binary file not shown.
9 changes: 9 additions & 0 deletions lib/Notifications.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import DBFunctions

def LogEvent(message):
DBFunctions.AddEventToDB(message)
return

def ClearLog():
ClearDBLog()
return
Binary file modified lib/UpgradeFunctions.pyc
Binary file not shown.
15 changes: 13 additions & 2 deletions lib/WebRoot.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def index(self,status_message='',version=''):
<thead>
<tr>
<th>Actions</th>
<th>Cover</th>
<th>Game Name</th>
<th>Game Type</th>
<th>System</th>
Expand Down Expand Up @@ -206,6 +207,7 @@ def search(self,term=''):
<thead>
<tr>
<th>Download</th>
<th>Cover</th>
<th>Game Name</th>
<th>Game Type</th>
<th>System</th>
Expand Down Expand Up @@ -353,7 +355,14 @@ def settings(self):
<label>Newznab Xbox 360 Category ID</label>
<input type="text" name="newznabXbox360Cat" id="newznabXbox360Cat" value='""" + config.get('Newznab','xbox360_category_id').replace('"','') + """' />
<button type="submit">Save Settings</button>
<h1>Notifications</h1>
<label>Prowl API</label>
<input type="text" name="prowlApi" id="prowlApi" value='""" + config.get('Notifications','prowl_api').replace('"','') + """' />
<button type="submit">Save Settings</button>
<div class="spacer"></div>
Expand Down Expand Up @@ -509,7 +518,7 @@ def upgradetolatestversion(self,verification):
raise cherrypy.InternalRedirect("/?status_message=" + status)

@cherrypy.expose
def savesettings(self,cherrypyHost='', nzbMatrixUsername='', downloadInterval=3600, sabPort='', nzbMatrixApi='', sabApi='', cherrypyPort='', sabHost='',gamezApiKey='',newznabHost='',newznabPort='',newznabApi='',newznabWiiCat='',newznabXbox360Cat=''):
def savesettings(self,cherrypyHost='', nzbMatrixUsername='', downloadInterval=3600, sabPort='', nzbMatrixApi='', sabApi='', cherrypyPort='', sabHost='',gamezApiKey='',newznabHost='',newznabPort='',newznabApi='',newznabWiiCat='',newznabXbox360Cat='',prowlApi=''):
cherrypyHost = '"' + cherrypyHost + '"'
nzbMatrixUsername = '"' + nzbMatrixUsername + '"'
nzbMatrixApi = '"' + nzbMatrixApi + '"'
Expand All @@ -520,6 +529,7 @@ def savesettings(self,cherrypyHost='', nzbMatrixUsername='', downloadInterval=36
newznabApi = '"' + newznabApi + '"'
newznabWiiCat = '"' + newznabWiiCat + '"'
newznabXbox360Cat = '"' + newznabXbox360Cat + '"'
prowlApi = '"' + prowlApi + '"'
config = ConfigParser.RawConfigParser()
configFilePath = os.path.join(WebRoot.appPath,'Gamez.ini')
config.read(configFilePath)
Expand All @@ -537,6 +547,7 @@ def savesettings(self,cherrypyHost='', nzbMatrixUsername='', downloadInterval=36
config.set('Newznab','wii_category_id',newznabWiiCat)
config.set('Newznab','xbox360_category_id',newznabXbox360Cat)
config.set('Newznab','api_key',newznabApi)
config.set('Notifications','prowl_api',prowlApi)
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"
Expand Down
Binary file modified lib/WebRoot.pyc
Binary file not shown.
Binary file modified lib/__init__.pyc
Binary file not shown.

0 comments on commit 09e354d

Please sign in to comment.