mirror of
https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck.git
synced 2025-04-14 03:51:20 +02:00
added chrome bookmark scanner
This commit is contained in:
parent
9688709a3d
commit
c88d7dea0d
@ -2037,12 +2037,81 @@ else:
|
||||
|
||||
|
||||
|
||||
# chrome bookmark scanner for xbox and geforce
|
||||
|
||||
# Path to the Chrome Bookmarks file
|
||||
bookmarks_file_path = f"{logged_in_home}/.var/app/com.google.Chrome/config/google-chrome/Default/Bookmarks"
|
||||
|
||||
# Check if the bookmarks file exists
|
||||
if not os.path.exists(bookmarks_file_path):
|
||||
print("Chrome Bookmarks not found. Skipping scanning for Bookmarks.")
|
||||
else:
|
||||
# Lists to store results
|
||||
geforce_now_urls = []
|
||||
xbox_urls = []
|
||||
|
||||
with open(bookmarks_file_path, 'r') as f:
|
||||
data = json.load(f)
|
||||
|
||||
# Loop through the "Other bookmarks" folder
|
||||
for item in data['roots']['other']['children']:
|
||||
if item['type'] == "url":
|
||||
name = item['name'].strip()
|
||||
url = item['url']
|
||||
|
||||
if not name:
|
||||
continue
|
||||
|
||||
# GeForce NOW
|
||||
if "play.geforcenow.com/games" in url:
|
||||
if name == "GeForce NOW":
|
||||
continue # Skip generic folder/bookmark
|
||||
|
||||
# Strip anything from &lang and onward
|
||||
if "&" in url:
|
||||
url = url.split("&")[0]
|
||||
|
||||
geforce_now_urls.append(("GeForce NOW", name, url))
|
||||
|
||||
# Xbox Cloud Gaming
|
||||
elif "www.xbox.com/en-US/play/games/" in url:
|
||||
# Clean up the name
|
||||
if name.startswith("Play "):
|
||||
game_name = name.replace("Play ", "").split(" |")[0].strip()
|
||||
else:
|
||||
game_name = name.split(" |")[0].strip()
|
||||
|
||||
if game_name:
|
||||
xbox_urls.append(("Xbox", game_name, url))
|
||||
|
||||
# Merge both into a single list for processing
|
||||
all_urls = geforce_now_urls + xbox_urls
|
||||
|
||||
for platform_name, game_name, url in all_urls:
|
||||
print(f"{platform_name}: {game_name} - {url}")
|
||||
|
||||
# Encode URL to prevent issues with special characters
|
||||
encoded_url = quote(url, safe=":/?=&")
|
||||
|
||||
chromelaunch_options = (
|
||||
f'run --branch=stable --arch=x86_64 --command=/app/bin/chrome --file-forwarding com.google.Chrome @@u @@ '
|
||||
f'--window-size=1280,800 --force-device-scale-factor=1.00 --device-scale-factor=1.00 '
|
||||
f'--start-fullscreen {encoded_url} --no-first-run --enable-features=OverlayScrollbar'
|
||||
)
|
||||
|
||||
chromedirectory = os.environ.get("chromedirectory", "/usr/bin/flatpak")
|
||||
chrome_startdir = os.environ.get("chrome_startdir", "/usr/bin")
|
||||
|
||||
|
||||
# Replace this with whatever function or method you're using to handle the entries
|
||||
create_new_entry(
|
||||
chromedirectory,
|
||||
game_name,
|
||||
chromelaunch_options,
|
||||
chrome_startdir,
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
#end of chrome scanner for xbox and geforce bookmarks
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user