mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-12 09:48:50 +01:00
rename submodule
This commit is contained in:
parent
e9ed6d7cf1
commit
764aa61b7f
1
.gitignore
vendored
1
.gitignore
vendored
@ -21,3 +21,4 @@ screenshots/*
|
||||
*.log
|
||||
.DS_Store
|
||||
sys.py/.*
|
||||
sys.py/*.db
|
||||
|
||||
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -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
|
||||
|
||||
4
.xinitrc
4
.xinitrc
@ -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 &
|
||||
@ -9,7 +10,8 @@ hdmi )
|
||||
#exec /usr/bin/twm -f ~/launcher/.twmrc
|
||||
exec ~/launcher/dwm-mod
|
||||
;;
|
||||
gameshell )
|
||||
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 &
|
||||
|
||||
@ -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 = []
|
||||
@ -203,6 +210,19 @@ class GameStorePage(Page):
|
||||
{"title":"github.com/cuu/gamestore","file":"https://raw.githubusercontent.com/cuu/gamestore/master/index.json","type":"dir"}
|
||||
]
|
||||
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):
|
||||
|
||||
@ -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,33 +303,64 @@ 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
|
||||
"""
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -73,7 +73,7 @@ def PreparationInAdv():
|
||||
else:
|
||||
ArmSystem("sudo iw wlan0 set power_save off >/dev/null")
|
||||
|
||||
RPC = Xmlrpc('localhost', 6800)
|
||||
RPC = Xmlrpc('localhost', 6800)
|
||||
PreparationInAdv()
|
||||
##sys.py/.powerlevel
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user