diff --git a/Gamez.db b/Gamez.db
index c73df90..80fae8b 100644
Binary files a/Gamez.db and b/Gamez.db differ
diff --git a/lib/Constants.pyc b/lib/Constants.pyc
index 547f007..6f3bc00 100644
Binary files a/lib/Constants.pyc and b/lib/Constants.pyc differ
diff --git a/lib/DBFunctions.py b/lib/DBFunctions.py
index 3c3a090..ce44f91 100644
--- a/lib/DBFunctions.py
+++ b/lib/DBFunctions.py
@@ -3,60 +3,12 @@
import sys
import datetime
from Logger import LogEvent
+import urllib
+import json
-def GetAllWiiGames():
+def GetGamesFromTerm(term):
db_path = os.path.join(os.path.abspath(""),"Gamez.db")
- sql = 'SELECT game_name,ID,game_id FROM wii_games order by game_name asc'
- data = ""
- connection = sqlite3.connect(db_path)
- cursor = connection.cursor()
- cursor.execute(sql)
- result = cursor.fetchall()
- for record in result:
- try:
- game_name = str(record[0])
- game_name.replace("'","''")
- id = str(record[1])
- game_id = str(record[2])
- rowdata = id + "::" + game_id + "::" + game_name + "\r\n"
- data = data + rowdata + "||"
- #{db_id:"1", nintendo_id:"RVDX01", game_title:"Super Mario Bros."},
- except:
- continue
- cursor.close()
- data = data[:-2]
- return data
-
-
-
-def GetWiiGameList():
- db_path = os.path.join(os.path.abspath(""),"Gamez.db")
- sql = 'SELECT distinct game_name FROM wii_games order by game_name asc'
- data = ""
- connection = sqlite3.connect(db_path)
- cursor = connection.cursor()
- cursor.execute(sql)
- result = cursor.fetchall()
- for record in result:
- try:
- game_name = str(record[0])
- game_name.replace("'","''")
- id = str(record[1])
- game_id = str(record[2])
- rowdata = id + "::" + game_id + "::" + game_name + "\r\n"
- data = data + rowdata + "||"
- #{db_id:"1", nintendo_id:"RVDX01", game_title:"Super Mario Bros."},
- except:
- continue
- cursor.close()
- data = data[:-2]
- return data
-
-#Below are the only ones currently used
-
-def GetWiiGamesFromTerm(term):
- db_path = os.path.join(os.path.abspath(""),"Gamez.db")
- sql = "SELECT distinct game_name FROM wii_games where game_name like '%" + term.replace("'","''") + "%' order by game_name asc"
+ sql = "SELECT GAME_NAME,SYSTEM FROM GAMES where game_name like '%" + term.replace("'","''") + "%' ORDER BY GAME_NAME ASC"
data = ""
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
@@ -65,6 +17,7 @@ def GetWiiGamesFromTerm(term):
for record in result:
try:
game_name = str(record[0])
+ system = str(record[1])
rowdata = '{"value":"' + game_name + '"},'
data = data + rowdata
except:
@@ -74,9 +27,9 @@ def GetWiiGamesFromTerm(term):
data = "[" + data + "]"
return data
-def GetWiiGameDataFromTerm(term):
+def GetGameDataFromTerm(term):
db_path = os.path.join(os.path.abspath(""),"Gamez.db")
- sql = "SELECT game_name,game_id,id FROM wii_games where game_name like '%" + term.replace("'","''") + "%' order by game_name asc"
+ sql = "SELECT game_name,game_type,id,system FROM games where game_name like '%" + term.replace("'","''") + "%' order by game_name asc"
data = ''
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
@@ -84,21 +37,30 @@ def GetWiiGameDataFromTerm(term):
result = cursor.fetchall()
for record in result:
try:
- #
Trident | Internet Explorer 4.0 | Win 95+ |
game_name = str(record[0])
- game_id = str(record[1])
+ game_type = str(record[1])
db_id = str(record[2])
- rowdata = "Download | " + game_name + " | " + game_id + " |
"
+ system = str(record[3])
+ rowdata = "Download | " + game_name + " | " + game_type + " | " + system + " |
"
data = data + rowdata
except:
continue
cursor.close()
return data
-def AddWiiGameToDb(db_id,status):
+def AddGameToDb(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 + "')"
+ sql = "select game_name,system,game_type 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])
+ cursor.close()
+ sql = "insert into requested_games(GAME_NAME,SYSTEM,GAME_TYPE,status) values('" + game_name + "','" + system + "','" + game_type + "','" + status + "')"
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
cursor.execute(sql)
@@ -108,7 +70,7 @@ def AddWiiGameToDb(db_id,status):
def GetRequestedGames():
db_path = os.path.join(os.path.abspath(""),"Gamez.db")
- sql = "SELECT wii_games.id,game_name,game_id,status FROM requested_games inner join wii_games on requested_games.WiiGameID = wii_games.ID order by game_name asc"
+ sql = "SELECT id,game_name,game_type,status,system FROM requested_games order by game_name asc"
data = ''
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
@@ -118,9 +80,10 @@ def GetRequestedGames():
try:
db_id = str(record[0])
game_name = str(record[1])
- game_id = str(record[2])
+ game_type = str(record[2])
status = str(record[3])
- rowdata = "Delete | " + game_name + " | " + game_id + " | " + status + " | |