Scan a barcode and listen music.
Convert a barcode as scanned from compact disc (e.g. 082839056427
) to a Discogs release (e.g. 41078
), smurf it to a valid pattern such as an artist, year and title (e.g. DNA ft. SUZANNE VEGA (1990) Tom's Diner
) to locate this on a locally attached network storage (e.g. \\nas\music\singles\DNA ft. SUZANNE VEGA (1990) Tom's Diner
), and post that request to the API on a Kodi.
-
Connect a WS-14810 barcode scanner to a Raspberry Pi running a Bash shell.
Append function (scan_barcode () { ... }
) with a custom while ... ; do-loop to the ~/.bashrc-file, and call it with'curl'
at the end of the run command:# .bashrc scan_barcode () { while read -ra barcode; do "$@" "host-running-flask.domain.local:5000/scan/${barcode[@]}" done } scan_barcode 'curl'
-
Generate a Discogs personal access token (PAT).
Write this token at thediscogs.authorization.personal-access-token
-property in thedal-segno-al-kodi.config.json
file. -
Enable Kodi's JSON RPC API.
Set the Settings/Services/Control/Allow remote control via HTTP-switch, and specify an username and password.
Write the username at thekodi.authorization.username
-property in thedal-segno-al-kodi.config.json
-file, and theunencryptedBase64 encoded username:password string atkodi.authorization.password
.
In addition, change thekodi.jsonrpc-uri
-property in the config file to your Kodi server's address. -
Run with
flask.exe --app '.\dal-segno-al-kodi.py' run --reload --host 0.0.0.0
-
Scan and listen!