This commit is contained in:
Gustavo 2018-03-31 01:05:46 -03:00
parent 4d944396b8
commit 9acc47cc76
2 changed files with 11 additions and 6 deletions

View file

@ -18,8 +18,6 @@ addon = xbmcaddon.Addon()
addon_base_path = xbmc.translatePath(addon.getAddonInfo('profile')).decode('utf-8') addon_base_path = xbmc.translatePath(addon.getAddonInfo('profile')).decode('utf-8')
xbmcplugin.setContent(addon_handle, "files") xbmcplugin.setContent(addon_handle, "files")
os.environ['LD_LIBRARY_PATH'] = "/usr/lib:/lib:" + addon.getAddonInfo("path") + "/lib"
def build_url(query): def build_url(query):
return base_url + "?" + urllib.urlencode(query) return base_url + "?" + urllib.urlencode(query)

View file

@ -34,7 +34,7 @@ class SERVER_DATA(ctypes.Structure):
("gsVersion", ctypes.c_char_p), ("gsVersion", ctypes.c_char_p),
("modes", DISPLAY_MODE), ("modes", DISPLAY_MODE),
("serverInfo", SERVER_INFORMATION)] ("serverInfo", SERVER_INFORMATION)]
class APP_LIST(ctypes.Structure): class APP_LIST(ctypes.Structure):
pass pass
@ -46,10 +46,17 @@ class _HTTP_DATA(ctypes.Structure):
_fields_ = [("memory", ctypes.POINTER(ctypes.c_ubyte)), _fields_ = [("memory", ctypes.POINTER(ctypes.c_ubyte)),
("size", ctypes.c_size_t)] ("size", ctypes.c_size_t)]
def findlib(name):
libdirs = os.environ['LD_LIBRARY_PATH'].split(':')
for dir in libdirs:
for file in os.listdir(dir):
if file.find(name) != -1:
return os.path.join(dir, file)
class LibGameStream: class LibGameStream:
def __init__(self, libpath = ""): def __init__(self, libpath = ""):
self.commonlib = ctypes.cdll.LoadLibrary(os.path.join(libpath, "libmoonlight-common.so.2")) self.commonlib = ctypes.cdll.LoadLibrary(findlib("libmoonlight-common.so"))
self.gslib = ctypes.cdll.LoadLibrary(os.path.join(libpath, "libgamestream.so.2")) self.gslib = ctypes.cdll.LoadLibrary(findlib("libgamestream.so"))
self.connected = False self.connected = False
self.address = "" self.address = ""
self.key_dir = "" self.key_dir = ""
@ -101,7 +108,7 @@ class LibGameStream:
return lst return lst
def poster(self, appId, toFolder): def poster(self, appId, toFolder):
unique_id = "" unique_id = ""
with open(os.path.join(self.key_dir, "uniqueid.dat"), "r") as f: with open(os.path.join(self.key_dir, "uniqueid.dat"), "r") as f:
unique_id = f.read() unique_id = f.read()