Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
usage_of_batocera-settings [2023/10/04 18:18] – Removed batocera-settings (old) crcerrorusage_of_batocera-settings [2023/10/09 18:41] (current) – python example works now crcerror
Line 4: Line 4:
  
 <WRAP center round info> <WRAP center round info>
-This command is a bit out of date to use now, most if not all things can be adjusted within Batocera EmulationStation itself or through manually editing the text file. Certain commands may no longer be functional. The following is still useful for scripting however.+This command is a bit out of date to use now, most if not all things can be adjusted within Batocera EmulationStation itself or through manually editing the text file. Certain commands may no longer be functional. On older versions of Batocera, the list of available functions can be found by entering in ''batocera-settings'' and pressing Enter.
 </WRAP> </WRAP>
  
Line 35: Line 35:
 ===== Recommended commands and expressions ===== ===== Recommended commands and expressions =====
  
-batocera-setting-get and batocera-setting-set is utilized by parameters parsedThe old batocera-settings itself was a relic of RecalBox times. FunFact: Because batocera-settings is based on C-codeit's much faster then the old python-script.+The commands are called with ''batocera-setting-get'' and ''batocera-setting-set''For the syntax belowreplace the contents in the square brackets with your intended setting (and don't include the square brackets themselves).
  
-As batocera-settings is more modern and supports reading/writing values. For these examples, replace the contents in the square brackets with your intended setting (and don't include the square brackets themselves).+Syntax for reading setting values: 
 +<code> 
 +batocera-settings-get -f [CONFIG_FILE] [KEY] 
 +batocera-settings-get [KEY] 
 +</code>
  
-  * Synthax: +This will read the KEY setting from the specified config file and output its current file. If no ''-f'' flag specified, it will search through ''userdata/system/batocera.conf'' by default. 
-    * **''batocera-settings-get -f [CONFIG_FILE] [KEY]''** + 
-    * **''batocera-settings-set -f [CONFIG_FILE] [KEY] [VALUE]''**+Syntax for setting those values: 
 +<code> 
 +batocera-settings-set -f [CONFIG_FILE] [KEY] [VALUE] 
 +batocera-settings-set [KEY] [VALUE] 
 +</code> 
 + 
 +This will search for the key in the config file and then replace its value with the new specified one. If the key doesn't already exist in the config file, a new line with that key will be created. 
 + 
 +In Batocera **v36** and above, syntax for reading the current board's default setting: 
 + 
 +<code> 
 +batocera-settings-get-master [key] 
 +</code>
  
-  * BATOCERA usage +This will read the key from ''/usr/share/batocera/sysconfigs/batocera.conf.${BOARD_MODEL}''.
-    * **''batocera-settings-get [key]''** read ''key'' from ''batocera.conf'' +
-    * **''batocera-settings-set [key] [value]''** write value ''key=value'' to ''batocera.conf'' +
-    * **''batocera-settings-get -f [file] [key]''** read value key from ''file'' +
-  * BATOCERA board-specific usage (added in Batocera **v36**) +
-    * **''batocera-settings-get-master [key]''** read ''key'' from ''/usr/share/batocera/sysconfigs/batocera.conf.${BOARD_MODEL}''+
  
 ===== Error code handling ====== ===== Error code handling ======
Line 126: Line 137:
  
 <code python| obtain_value.py> <code python| obtain_value.py>
 +
 #!/usr/bin/python #!/usr/bin/python
-# -*- coding: utf-8 -*- 
 #This is an example file how batocera-settings-get can be utilized #This is an example file how batocera-settings-get can be utilized
 #to read a value out from /userdata/system/batocera.conf with python #to read a value out from /userdata/system/batocera.conf with python
  
 import subprocess import subprocess
- +command=(["batocera-settings-get""system.power.switch"]) 
-value (subprocess.check_output(['batocera-settings-get''power.switch.device'])) +rc = subprocess.call(command, stdout=subprocess.DEVNULL
-if value+if rc == 0: 
-    print "Power Switch Detected: ", value+    value = subprocess.check_output(command).decode("utf-8") 
 +    print ("Power Switch Detected: ", value)
 else: else:
-    print "No power switch detected!"+    print ("No power switch detected!")
 </code> </code>
 +
 +
  
  • usage_of_batocera-settings.1696443511.txt.gz
  • Last modified: 3 years ago
  • by crcerror