Merge pull request #314 from cuu/master

warehouse bug fix of adding URL repeatedly
This commit is contained in:
GNU 2019-12-25 14:16:48 +08:00 committed by GitHub
commit 708c863a33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -960,23 +960,28 @@ class GameStorePage(Page):
self._Screen._MsgBox.Draw() self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow() self._Screen.SwapAndShow()
else: else:
valid_url= self.raw_github_com(inputed) if "github.com/clockworkpi/warehouse" in inputed:
if valid_url == False:
self._Screen._MsgBox.SetText("Warehouse existed!") self._Screen._MsgBox.SetText("Warehouse existed!")
self._Screen._MsgBox.Draw() self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow() self._Screen.SwapAndShow()
else: else:
sql_insert = """ INSERT INTO warehouse(title,file,type) VALUES( valid_url= self.raw_github_com(inputed)
if valid_url == False:
self._Screen._MsgBox.SetText("Warehouse url error!")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
else:
sql_insert = """ INSERT INTO warehouse(title,file,type) VALUES(
'%s', '%s',
'%s', '%s',
'source');""" % (inputed,valid_url) 'source');""" % (inputed,valid_url)
c.execute(sql_insert) c.execute(sql_insert)
conn.commit() conn.commit()
self.SyncList() self.SyncList()
self._Screen.Draw() self._Screen.Draw()
self._Screen.SwapAndShow() self._Screen.SwapAndShow()
conn.close() conn.close()
except Exception as ex: except Exception as ex:
print(ex) print(ex)