Skip to content

Commit daf74a6

Browse files
committed
API Basics 0.1.9b
1 parent b949b68 commit daf74a6

File tree

489 files changed

+177388
-123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

489 files changed

+177388
-123
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

first try.iss

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
; Script generated by the Inno Setup Script Wizard.
2+
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
3+
4+
#define MyAppName "StreamHelper"
5+
#define MyAppVersion "0.1.1 Closed Alpha"
6+
#define MyAppPublisher "COS Woks"
7+
#define MyAppURL "https://github.com/xFLLSquadronNorden/StreamHelper.py/tree/11b3df9b651e50616eed13f1f00b7f6ad0d7110a"
8+
#define MyAppExeName "MyProg.exe"
9+
10+
[Setup]
11+
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
12+
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
13+
AppId={{0A645662-73AB-4826-9700-A447D1B060F6}
14+
AppName={#MyAppName}
15+
AppVersion={#MyAppVersion}
16+
;AppVerName={#MyAppName} {#MyAppVersion}
17+
AppPublisher={#MyAppPublisher}
18+
AppPublisherURL={#MyAppURL}
19+
AppSupportURL={#MyAppURL}
20+
AppUpdatesURL={#MyAppURL}
21+
CreateAppDir=no
22+
InfoAfterFile=G:\com\Streamhelper\resources\CHANGELOG.txt
23+
; Remove the following line to run in administrative install mode (install for all users.)
24+
PrivilegesRequired=lowest
25+
OutputBaseFilename=StreamHelper
26+
SetupIconFile=G:\com\Streamhelper\resources\images\icon.ico
27+
Compression=lzma
28+
SolidCompression=yes
29+
WizardStyle=modern
30+
31+
[Languages]
32+
Name: "english"; MessagesFile: "compiler:Default.isl"
33+
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
34+
35+
[Files]
36+
Source: "G:\com\Streamhelper\resources\images\*"; DestDir: "{win}"; Flags: ignoreversion recursesubdirs createallsubdirs
37+
Source: "G:\com\Streamhelper\resources\runtime\*"; DestDir: "{win}"; Flags: ignoreversion
38+
Source: "G:\com\Streamhelper\resources\__init__.py"; DestDir: "{win}"; Flags: ignoreversion
39+
Source: "G:\com\Streamhelper\resources\CHANGELOG.txt"; DestDir: "{win}"; Flags: ignoreversion
40+
Source: "G:\com\Streamhelper\resources\main.ui"; DestDir: "{win}"; Flags: ignoreversion
41+
Source: "G:\com\Streamhelper\resources\namedialog.ui"; DestDir: "{win}"; Flags: ignoreversion
42+
Source: "G:\com\Streamhelper\resources\NumberWidget.ui"; DestDir: "{win}"; Flags: ignoreversion
43+
Source: "G:\com\Streamhelper\resources\SelectionDialog.ui"; DestDir: "{win}"; Flags: ignoreversion
44+
Source: "G:\com\Streamhelper\resources\TextFileWidget.ui"; DestDir: "{win}"; Flags: ignoreversion
45+
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
46+

resources/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget
55
from qtpy import QtGui, uic
66

7+
from resources.access.bindings import initConnection
78
from resources.runtime import savestate
89
from resources.runtime.Settings.configfunc import saveConfig, loadConfig
10+
from resources.runtime.Settings.logfunctions import logWrite, logWriteNoTime, logCreate
911
from resources.runtime.Settings.program import syncSettings
1012
from resources.runtime.functions import information, createStandardFiles, erroreasy
11-
from resources.runtime.Settings.logfunctions import logWrite, logWriteNoTime, logCreate
1213
from resources.runtime.textfiles.fileedit import createListFiles
1314
from resources.runtime.textlists.package import txlinit, addToList
1415

@@ -115,6 +116,7 @@ def __init__(self):
115116

116117
# Basic loading and startup operations
117118
window = txlinit(self, newFilePath, oldFilePath)
119+
initConnection(self)
118120

119121
# Detect the interactions / NOW HANDLED IN DESIGNATED PACKAGES
120122
# There are only the menu-items binded here in the main package
@@ -148,7 +150,7 @@ def showSettings(self):
148150
self.w.close() # Close window.
149151
self.w = None # Discard reference.
150152
else:
151-
if savestate.platform is 'linux':
153+
if savestate.platform == 'linux':
152154
logWrite("The application could not be started in sudo mode!")
153155
else:
154156
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1)

resources/access/bindings.py

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,72 @@
1-
import riotwatcher
1+
import re
2+
import subprocess
23

4+
from lcu_driver import Connector
5+
6+
from resources.images.program import copyFile
7+
from resources.runtime import savestate
8+
9+
connector = Connector()
10+
11+
12+
def initConnection(self):
13+
self.ui.establishConnection.clicked.connect(lambda: getClient(self))
14+
self.ui.swapTeams.clicked.connect(lambda: copyFile(
15+
"F:\\Windows Installation\\Bilder\\test.jpg",
16+
"C:\\Program Files\\obs-studio\\bin\\64bit\\LCS-Champ-Select.jpg"))
17+
18+
19+
def getClient(self):
20+
# init method to call all subsequent functions. Will build up the stats.
21+
try:
22+
cmdrun = subprocess.run(['wmic', 'PROCESS', "WHERE", "name='LeagueClientUx.exe'", "GET", "commandline"],
23+
capture_output=True, text=True).stdout
24+
except AttributeError:
25+
print("Process not found!")
26+
try:
27+
port = re.search("app-port=([0-9]*)", cmdrun).group().split("=")[1]
28+
auth = re.search("remoting-auth-token=([\w]*)", cmdrun).group().split("=")[1]
29+
except IndexError:
30+
# if there is no = in the found part
31+
port = "Error in collecting process data!"
32+
auth = ""
33+
self.ui.SummonerName.setStyleSheet("QLineEdit{background: lightred;}")
34+
except AttributeError:
35+
# if the client isn't open
36+
port = "Please make sure that you have your League Client up and running!"
37+
auth = ""
38+
self.ui.SummonerName.setStyleSheet("QLineEdit{background: lightred;}")
39+
print(port, auth)
40+
41+
try:
42+
startConnector()
43+
except:
44+
print("nothing found")
45+
if savestate.summoner != "":
46+
self.ui.SummonerName.setText(savestate.summoner["displayName"])
47+
self.ui.SummonerName.setStyleSheet("QLineEdit{background: lightgreen;}")
48+
else:
49+
self.ui.SummonerName.setStyleSheet("QLineEdit{background: red;}")
50+
51+
52+
def startConnector():
53+
@connector.ready
54+
async def connect(connection):
55+
# check if the user is already logged into his account
56+
summoner = await connection.request('get', '/lol-summoner/v1/current-summoner')
57+
if summoner.status != 200:
58+
print('Please login to your account.')
59+
else:
60+
print('Summoner received successfully!')
61+
savestate.summoner = await summoner.json()
62+
print(savestate.summoner["displayName"])
63+
64+
@connector.close
65+
async def disconnect(_):
66+
print('Finished task')
67+
await connect.stop()
68+
69+
try:
70+
connector.start()
71+
except ConnectionRefusedError:
72+
print("No Client found...")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)