hi
- User
hi
- Assistant
Hello! How may I assist you today?
- User
im writing a script and am having trouble with my coding, im trying to figure out a way to parse game launchers so that i can display what games i own in a list, whats the best way to do that? im on arch linux btw
- Assistant
To parse game launchers and get a list of the games you own on Arch Linux, you can use one of the following methods:
-
Check for game launcher configuration files: Many game launchers store configuration files that contain information on the games installed. Check for the configuration files of the game launchers you use, and parse them to get a list of the games you own.
-
Use a game launcher API: Some game launchers provide APIs that allow you to retrieve information about the games installed. You can use these APIs to get a list of the games you own.
-
Use a library or tool: There are many libraries and tools available that can help you parse game launchers and retrieve information about the games installed. Some popular options include libgnome-games-support, Lutris, and Gamemode.
Once you have retrieved the list of games, you can display them in a list on your script.
-
- User
could you write me a bash script on the best way to parse Epic Games Launcher, i need a way that would work without user interaction
- Assistant
Sure, here is a possible script that uses the
jqcommand-line tool to parse the Epic Games Launcher configuration file (~/.config/Epic/UnrealEngineLauncher/GameManifests/manifest.json) and extract the names of the installed games:#!/bin/bash # Path to the configuration file config_file="$HOME/.config/Epic/UnrealEngineLauncher/GameManifests/manifest.json" # Check if the configuration file exists if [ ! -f "$config_file" ]; then echo "Epic Games Launcher configuration file not found: $config_file" exit 1 fi # Parse the configuration file with jq and extract the names of the installed games installed_games=$(jq -r '.Installed[] | select(.AppVersionString != "") | .AppName' "$config_file") # Display the list of installed games echo "Installed games:" echo "$installed_games"The script checks if the configuration file exists, parses it with
jq, and extracts the names of the installed games. Theselectfunction excludes games that have a blank version string, which should filter out games that are not actually installed. Finally, the list of installed games is displayed. Note that this script assumes that the user has already logged in to the Epic Games Launcher and installed one or more games. - User
ok cool, this would would work in arch linux if epic games is installed in the default location correct?
- Assistant
Yes, the script should work on Arch Linux assuming the Epic Games Launcher is installed in the default location (
~/.config/Epic/UnrealEngineLauncher/). However, if the launcher is installed in a different location, you would need to modify theconfig_filevariable to point to the correct location of the configuration file. - User
is jq a python command?
- Assistant
No,
jqis not a Python command.jqis a command-line JSON processor written in C and available for most operating systems, including Linux.jqis designed to parse, filter, and transform JSON data easily from the command line, and it uses its own query language to extract and manipulate data. The basic syntax for usingjqis similar to usingawkorsed, but is specifically tailored for working with JSON data. - User
cool now that i have that lets say i downloaded a game and now want to add it to steam as a shortcut what would be the best way to do this? could i do this from bash?
- Assistant
Yes, you could create a Steam shortcut to the game from a Bash script.
The general process would be:
- Determine the path of the game executable
- Create a
.desktopfile with the appropriate metadata (name, icon, etc.) and command to run the game executable - Add the
.desktopfile to the appropriate Steam shortcut folder (usually~/.local/share/Steam/steamapps/common/)
Here's an example script that should do what you're asking. It assumes that you have already downloaded the game and that you know the path to the game executable:
#!/bin/bash # Path to the game's executable game_executable=/path/to/game/executable # Name of the game game_name="My Game" # Path to the Steam shortcut folder steam_shortcuts="$HOME/.local/share/Steam/steamapps/common/" # Name and icon of the Steam shortcut shortcut_name="My Game" shortcut_icon="/path/to/game/icon.png" # Create the .desktop file cat > "$shortcut_name.desktop" << EOL [Desktop Entry] Name=$game_name Exec=$game_executable Icon=$shortcut_icon Terminal=false Type=Application EOL # Copy the .desktop file to the Steam shortcuts folder cp "$shortcut_name.desktop" "$steam_shortcuts" # Clean up the .desktop file rm "$shortcut_name.desktop" - User
is it possible to do it without the .desktop shortcuts and just add them straight to the library?
- Assistant
Yes, it is possible to add a game to your Steam library without creating a
.desktopshortcut.Here's an example script that demonstrates how to add a game to the Steam library using the
steamcmdcommand-line tool:#!/bin/bash # Path to the steamcmd executable steamcmd_path="$HOME/steamcmd/steamcmd.sh" # Steam username and password (replace with your own) steam_username="your_steam_username" steam_password="your_steam_password" # App ID of the game you want to add (replace with the actual app ID) game_app_id="123456" # Steam library folder (replace with your own) steam_library_folder="$HOME/.local/share/Steam/steamapps/" # Path to the folder containing the game files (replace with your own) game_folder="/path/to/game/folder" # Create a Steam app manifest file cat > "$steam_library_folder/appmanifest_$game_app_id.acf" << EOL "AppState" { "appid" "$game_app_id" "Universe" "1" "StateFlags" "1026" "installdir" "My Game" "LastUpdated" "0" "UpdateResult" "0" "SizeOnDisk" "0" "buildid" "0" } EOL # Use steamcmd to install the game "$steamcmd_path" +login "$steam_username" "$steam_password" +force_install_dir "$game_folder" +app_update "$game_app_id" validate +quit
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.