Skip to content

Instantly share code, notes, and snippets.

@bonelifer
Forked from cleanhands/mediasources.sh
Created October 2, 2025 20:17
Show Gist options
  • Save bonelifer/318ec4ae12ac4711f7d8ae0fd363c9ed to your computer and use it in GitHub Desktop.
Save bonelifer/318ec4ae12ac4711f7d8ae0fd363c9ed to your computer and use it in GitHub Desktop.
Generate mediasources.xml for Kodi using https://github.com/AquilaIrreale/urlencode
#!/bin/bash
IFS= read -rp 'Server name: ' server_name < /dev/tty
IFS= read -rp 'Username: ' username < /dev/tty
IFS= read -rsp 'Password: ' password < /dev/tty
echo 1>&2
password_encoded=$(urlencode -bc $' "#$%&\'*+,/:;<=>?@[\\]^`{|}~' <<< "$password")
tee "$HOME/.kodi/userdata/mediasources.xml" <<EOF
<mediasources>
<network>
<location id="0">davs://${username}:${password_encoded}@${server_name}</location>
</network>
</mediasources>
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment