rename submodule

This commit is contained in:
cuu 2019-12-04 21:36:04 +08:00
parent e9ed6d7cf1
commit 764aa61b7f
7 changed files with 86 additions and 15 deletions

1
.gitignore vendored
View File

@ -21,3 +21,4 @@ screenshots/*
*.log
.DS_Store
sys.py/.*
sys.py/*.db

6
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "sys.py/pyaria2-rpc"]
path = sys.py/pyaria2-rpc
url = https://github.com/cuu/pyaria2-rpc.git
[submodule "sys.py/pyaria2_rpc"]
path = sys.py/pyaria2_rpc
url = https://github.com/cuu/pyaria2_rpc.git

View File

@ -2,6 +2,7 @@ session=${1:-gameshell}
case $session in
hdmi )
exec ~/launcher/aria2c --conf-path=~/launcher/aria2.conf
feh --bg-center ~/launcher/sys.py/gameshell/wallpaper/desktopbg.jpg
cd ~/launcher/sys.py/ ; python appinstaller.py& cd ~/
exec ~/launcher/load.sh &
@ -10,6 +11,7 @@ hdmi )
exec ~/launcher/dwm-mod
;;
gameshell )
exec ~/launcher/aria2c --conf-path=~/launcher/aria2.conf
feh --bg-center ~/launcher/sys.py/gameshell/wallpaper/loading.png
cd ~/launcher/sys.py/ ; python appinstaller.py& cd ~/
exec ~/launcher/load.sh &

View File

@ -6,7 +6,7 @@ import platform
import glob
import json
import gobject
import sqlite3
#from beeprint import pp
from libs.roundrects import aa_round_rect
@ -177,6 +177,13 @@ class Aria2DownloadProcessPage(Page):
self._FileNameLabel.Draw()
self._SizeLabel.Draw()
def dict_factory(cursor, row):
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
class GameStorePage(Page):
_FootMsg = ["Nav","","","Back","Select"]
_MyList = []
@ -204,6 +211,19 @@ class GameStorePage(Page):
]
self._MyStack.Push(repos)
def SyncSqlite(self):
try:
conn = sqlite3.connect("aria2tasks.db")
conn.row_factory = sqlite3.Row
c = conn.cursor()
ret = c.execute("SELECT * FROM tasks").fetchall()
conn.close()
return ret
except Exception as ex:
print(ex)
return None
return None
def SyncList(self):
self._MyList = []
@ -214,6 +234,12 @@ class GameStorePage(Page):
repos = self._MyStack.Last()
if self._MyStack.Length() == 1: # on top
sqlite3_menu= self.SyncSqlite()
if sqlite3_menu != None and len(sqlite3_menu) > 0:
print(sqlite3_menu)
repos.extend(sqlite3_menu )
for i,u in enumerate( repos ):
#print(i,u)
li = InfoPageListItem()
@ -277,32 +303,63 @@ class GameStorePage(Page):
menu_file = remote_file_url.split("master")[1] #assume master branch
local_menu_file = "%s/aria2Download%s" % (os.path.expanduser('~'),menu_file )
if FileExists( local_menu_file ) == False:
if config.RPC.urlDownloading(remote_file_url) == False:
config.RPC.addUri( remote_file_url, options={"out": menu_file})
print(local_menu_file, "non-existed")
gid,ret = config.RPC.urlDownloading(remote_file_url)
if ret == False:
gid = config.RPC.addUri( remote_file_url, options={"out": menu_file})
self._Downloading = remote_file_url
self._Screen._MsgBox.SetText("Loading")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
else:
print(gid," url is downloading")
self._Screen._MsgBox.SetText("Loading")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
else:
#read the local_menu_file, push into stack,display menu
self._Downloading = None
local_menu_json = json.load(local_menu_file)
with open(local_menu_file) as json_file:
local_menu_json = json.load(json_file)
self._MyStack.Push(local_menu_json["lists"])
self.SyncList()
self._Screen.Draw()
self._Screen.SwapAndShow()
else:
#download the game probably
remote_file_url = cur_li._Value["file"]
menu_file = remote_file_url.split("master")[1]
local_menu_file = "%s/aria2Download%s" % (os.path.expanduser('~'),menu_file )
print cur_li._Value["type"]
if config.RPC.urlDownloading(remote_file_url) == False:
gid = config.RPC.addUri( remote_file_url, options={"out": menu_file})
self._Downloading = remote_file_url
try:
conn = sqlite3.connect("aria2tasks.db")
c = conn.cursor()
c.execute("INSERT INTO tasks VALUES ('"+gid+"','"+cur_li._Value["title"]+"','"+cur_li._Value["file"]+"','"+cur_li._Value["type"]+"','active')")
conn.commit()
conn.close()
except Exception as ex:
print(ex)
self._Screen._MsgBox.SetText("Getting the game now")
self._Screen._MsgBox.Draw()
seff._Screen.SwapAndShow()
def OnLoadCb(self):
self._Scrolled = 0
self._PosY = 0
self._DrawOnce = False
#sync
self.SyncList()
def OnReturnBackCb(self):
pass

View File

@ -6,6 +6,7 @@ from wicd import misc
import libs.websocket as websocket
aria2_ws = "ws://localhost:6800/jsonrpc"
aria2_db = "aria2tasks.db"
@misc.threaded
def game_install_thread():
@ -14,6 +15,12 @@ def game_install_thread():
def on_message(ws, message):
print("got message")
print(message)
#decode json
#lookup in the sqlite db ,update the status[error,complete],
#uncompress the game into destnation folder in the game_install_thread
aria2_noti = json.loads(message)
def on_error(ws, error):
print(error)
@ -50,9 +57,13 @@ def init_sqlite3():
sql_create_tasks_table = """ CREATE TABLE IF NOT EXISTS tasks (
id integer PRIMARY KEY,
gid text NOT NULL,
title text NOT NULL,
file text NOT NULL,
type text NOT NULL,
status text,
totalLength text,
completedLength text
completedLength text,
fav text
); """
conn = create_connection(database)

View File

@ -2,7 +2,7 @@
import os
import platform
from UI.util_funcs import FileExists,ArmSystem
from pyaria2 import Xmlrpc
from pyaria2_rpc.pyaria2 import Xmlrpc
CurKeySet = "GameShell" ## >>> PC or GameShell <<<
@ -35,7 +35,7 @@ PowerLevel = "balance_saving"
def PreparationInAdv():
global SKIN,ButtonsLayout
global PowerLevel
global RPC
if SKIN != None:
return