database: fix duplicated entries
This commit is contained in:
parent
58f9d21b3d
commit
509055ca71
|
@ -9,33 +9,36 @@ def main():
|
||||||
|
|
||||||
conn = sqlite3.connect(database)
|
conn = sqlite3.connect(database)
|
||||||
data = []
|
data = []
|
||||||
|
pkgs = dict()
|
||||||
with conn:
|
with conn:
|
||||||
cursor = conn.execute("SELECT FULLPKGNAME, COMMENT, DESCR_CONTENTS, WANTLIB, RUN_DEPENDS FROM PortsQ")
|
cursor = conn.execute("SELECT FULLPKGNAME, COMMENT, DESCR_CONTENTS, WANTLIB, RUN_DEPENDS FROM PortsQ")
|
||||||
for row in cursor:
|
for row in cursor:
|
||||||
gui = False
|
if not pkgs.get(row[0]):
|
||||||
tui = False
|
pkgs[row[0]] = True
|
||||||
if row[3]:
|
gui = False
|
||||||
m = re.search("(GL|SDL|gtk-3|X11|Qt5Gui)", row[3])
|
tui = False
|
||||||
if m:
|
if row[3]:
|
||||||
gui = True
|
m = re.search("(GL|SDL|gtk-3|X11|Qt5Gui)", row[3])
|
||||||
m = re.search("(curses)", row[3])
|
if m:
|
||||||
if m:
|
gui = True
|
||||||
tui = True
|
m = re.search("(curses)", row[3])
|
||||||
if row[4]:
|
if m:
|
||||||
m = re.search("x11/gtk\+3,-guic", row[4])
|
tui = True
|
||||||
if m:
|
if row[4]:
|
||||||
gui = True
|
m = re.search("x11/gtk\+3,-guic", row[4])
|
||||||
if not gui and row[2] and row[3] and row[1] and not tui:
|
if m:
|
||||||
m = re.search("(client)", row[3]+row[1]+row[2])
|
gui = True
|
||||||
if m:
|
if not gui and row[2] and row[3] and row[1] and not tui:
|
||||||
tui = True
|
m = re.search("(client)", row[3]+row[1]+row[2])
|
||||||
data.append({
|
if m:
|
||||||
"pkgname": row[0], #"-".join(row[0].split("-")[:-1]),
|
tui = True
|
||||||
"comment": row[1],
|
data.append({
|
||||||
"descr": row[2],
|
"pkgname": row[0], #"-".join(row[0].split("-")[:-1]),
|
||||||
"gui": gui,
|
"comment": row[1],
|
||||||
"tui": tui
|
"descr": row[2],
|
||||||
})
|
"gui": gui,
|
||||||
|
"tui": tui
|
||||||
|
})
|
||||||
print(json.dumps(data))
|
print(json.dumps(data))
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue