Skip to content

Commit

Permalink
add username support
Browse files Browse the repository at this point in the history
  • Loading branch information
Niceygy committed Nov 5, 2023
1 parent 3fd74f4 commit 2d0ff37
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build/
dist/
*.spec
8 changes: 6 additions & 2 deletions game.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import json
import os
import glob
import getpass

global username
username = getpass.getuser()

global eventAssociationsMain
global eventAssociationsDocked
Expand Down Expand Up @@ -78,13 +82,13 @@ def eventHandler(event):
print("Fileheader found, skipping")
else:
print(f"Found event: {event}")
system = getSystem(load("C:/Users/Nicey/Saved Games/Frontier Developments/Elite Dangerous"))
system = getSystem(load("C:/Users/"+username+"/Saved Games/Frontier Developments/Elite Dangerous"))
if system: # Check if the string exists
return eventAssociationsMain[event] + system
else:
return eventAssociationsMain[event]
elif event in eventAssociationsDocked:
station = getStation(load("C:/Users/Nicey/Saved Games/Frontier Developments/Elite Dangerous"))
station = getStation(load("C:/Users/"+username+"/Saved Games/Frontier Developments/Elite Dangerous"))
if station: # Check if the string exists
print(f"Returning: {eventAssociationsDocked[event] + station}")
return eventAssociationsDocked[event] + station
Expand Down
3 changes: 2 additions & 1 deletion log.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ def onStart():
print("EDDP started")
print("Log file: " + logDir + "/" + logFile)
print("Log directory: " + logDir)
print("Log file: " + logFile)
print("Log file: " + logFile)
return logDir + logFile
8 changes: 5 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from discordrp import Presence
import time
import getpass

from game import getCMDR, load, getSystem, eventHandler

global username
username = getpass.getuser()


def updatePrecense(presence, state, start_time, cmdr):
Expand All @@ -26,15 +28,15 @@ def updatePrecense(presence, state, start_time, cmdr):
start_time = int(time.time())

with Presence(client_id) as presence:
logFileLoaded = load("C:/Users/Nicey/Saved Games/Frontier Developments/Elite Dangerous")
logFileLoaded = load("C:/Users/"+username+"/Saved Games/Frontier Developments/Elite Dangerous")
print("Connected")
cmdr = getCMDR(logFileLoaded)
updatePrecense(presence, "In the main menu", start_time, cmdr)
print("Presence updated")

while True:
time.sleep(15)
logs = load("C:/Users/Nicey/Saved Games/Frontier Developments/Elite Dangerous")
logs = load("C:/Users/"+username+"/Saved Games/Frontier Developments/Elite Dangerous")
for log in logs:
if "event" in log:
currently = eventHandler(log["event"])
Expand Down

0 comments on commit 2d0ff37

Please sign in to comment.