kodi:move-sources
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| kodi:move-sources [2021/11/01 22:02] – Wuff | kodi:move-sources [2023/05/29 11:55] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 35: | Line 35: | ||
| UPDATE path SET texture = REPLACE(texture,' | UPDATE path SET texture = REPLACE(texture,' | ||
| .quit | .quit | ||
| + | </ | ||
| + | |||
| + | Adjust favourites | ||
| + | < | ||
| + | vi .kodi/ | ||
| </ | </ | ||
| Line 44: | Line 49: | ||
| https:// | https:// | ||
| + | |||
| + | <code - kodimovesource.sh> | ||
| + | #!/bin/bash | ||
| + | dbhost=" | ||
| + | dbuser=" | ||
| + | dbpassword=" | ||
| + | kodihome="/ | ||
| + | |||
| + | if [[ $# -lt 2 ]] || [[ $# -gt 2 ]] | ||
| + | then | ||
| + | echo " | ||
| + | echo " | ||
| + | exit 0 | ||
| + | fi | ||
| + | |||
| + | echo -e " | ||
| + | read -r -p "Are you sure? [y/N] " response | ||
| + | response=${response,, | ||
| + | if [[ ! " | ||
| + | then | ||
| + | exit 0 | ||
| + | fi | ||
| + | |||
| + | #find highest numeric MyVideos / MyMusic db | ||
| + | videodb=$(mysql -h$dbhost -u$dbuser -p$dbpassword -e "show databases like ' | ||
| + | audiodb=$(mysql -h$dbhost -u$dbuser -p$dbpassword -e "show databases like ' | ||
| + | texturedb=$(ls $kodihome/ | ||
| + | |||
| + | echo " | ||
| + | |||
| + | # Escaping paths for MySQL/ | ||
| + | printf -v from " | ||
| + | printf -v to " | ||
| + | |||
| + | # updating databases | ||
| + | echo " | ||
| + | #exit 0 | ||
| + | mysql -h$dbhost -u$dbuser -p$dbpassword 2>/ | ||
| + | use $videodb | ||
| + | UPDATE ignore path SET strPath = REPLACE(strPath,' | ||
| + | UPDATE ignore movie SET c22 = REPLACE(c22,' | ||
| + | UPDATE ignore episode SET c18 = REPLACE(c18,' | ||
| + | UPDATE ignore art SET url = REPLACE(url,' | ||
| + | UPDATE ignore tvshow SET c16 = REPLACE(c16,' | ||
| + | UPDATE ignore files SET strFilename = REPLACE(strFilename,' | ||
| + | use $audiodb | ||
| + | UPDATE ignore path SET strPath = REPLACE(strPath,' | ||
| + | EOF | ||
| + | |||
| + | echo " | ||
| + | sqlite3 $texturedb <<EOF | ||
| + | UPDATE path SET url = REPLACE(url," | ||
| + | UPDATE path SET texture = REPLACE(texture," | ||
| + | EOF | ||
| + | |||
| + | echo " | ||
| + | # updating sources file (using pipe separator avoiding forward slash issues) | ||
| + | sed -i " | ||
| + | |||
| + | echo " | ||
| + | # updating sources file (using pipe separator avoiding forward slash issues) | ||
| + | sed -i " | ||
| + | |||
| + | echo "Kodi restart is required to apply new sources and paths" | ||
| + | read -r -p " | ||
| + | response=${response,, | ||
| + | if [[ " | ||
| + | then | ||
| + | service kodi restart | ||
| + | echo "Kodi restarted." | ||
| + | fi | ||
| + | |||
| + | echo "All done" | ||
| + | </ | ||
| + | |||
| + | example moving folders while ignoring A/An/The at the start and adjusting the Kodi paths with above bash script (comment out the verification prompts in the script to automate): | ||
| + | < | ||
| + | |||
| + | #Move based on First letter of movie name, excluding 'A ' or 'An ' or 'The ' | ||
| + | for i in {0..9} {A..Z}; do mv -v / | ||
| + | #remaining after A/An/The processed | ||
| + | for i in {0..9} {A..Z}; do mv -v / | ||
| + | |||
| + | |||
| + | for i in {0..9} {A..Z}; do ~/ | ||
| + | for i in {0..9} {A..Z}; do ~/ | ||
| + | for i in {0..9} {A..Z}; do ~/ | ||
| + | for i in {0..9} {A..Z}; do ~/ | ||
| + | for i in {0..9} {A..Z}; do ~/ | ||
| + | for i in {0..9} {A..Z}; do ~/ | ||
| + | |||
| + | #remaining after A/An/The processed | ||
| + | for i in {0..9} {A..Z}; do ~/ | ||
| + | |||
| + | </ | ||
kodi/move-sources.1635804164.txt.gz · Last modified: (external edit)