Skip to content

Instantly share code, notes, and snippets.

@haarp
Created January 31, 2021 18:54
Show Gist options
  • Save haarp/e53e3ab69f4764b9e7ef3c7b24793a62 to your computer and use it in GitHub Desktop.
Save haarp/e53e3ab69f4764b9e7ef3c7b24793a62 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# Interact with BMBF's config
# FIXME: Album covers go missing?!
# Useful to start/kill BMBF without putting on the headset:
## adb shell am start com.weloveoculus.BMBF/.MainActivity
## adb shell am force-stop com.weloveoculus.BMBF
import sys
import urllib.request
import json
if len(sys.argv) < 2:
print( "Gonna need the IP address of your Quest running BMBF..." )
exit(1)
try:
data = urllib.request.urlopen("http://" + sys.argv[1] + ":50000/host/beatsaber/config").read()
except:
print( "Grabbing BMBF JSON failed, is IP correct and BMBF running?" )
exit(2)
data = json.loads( data )
# isolate Config object (as per https://github.com/ComputerElite/wiki/wiki/BMBF_technical#how-to-alter-the-bmbf-config)
data = data["Config"]
# write back as config.json (human-readable)
open( "config.json", "w" ).write( json.dumps(data, indent=4) )
print( "Done, you may now edit `config.json`, or replace it with a backup (from `/sdcard/BMBFData/config.json`)." )
print( "When finished, upload the config with: curl -i http://" + sys.argv[1] + ":50000/host/beatsaber/config --upload-file config.json" )
print( "(if this fails, it's likely because BMBF doesn't see a song or mod you're trying to add - `Reload Songs Folder` may help)" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment