kodi:move-sources
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
kodi:move-sources [2021/11/01 11:47] – created Wulf Rajek | kodi:move-sources [2023/05/29 11:55] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Kodi Move Sources ====== | ====== Kodi Move Sources ====== | ||
- | Update paths of Textures13.db SQLite DB: | + | Update paths of latest MyMusic table of Music MySQL DB: |
+ | < | ||
+ | mysql -u kodi -p | ||
+ | </ | ||
+ | < | ||
+ | use MyMusic82 | ||
+ | UPDATE path SET strPath = REPLACE(strPath,' | ||
+ | exit | ||
+ | </ | ||
+ | |||
+ | Update paths of latest MyVideo table of Movies/ | ||
+ | < | ||
+ | mysql -u kodi -p | ||
+ | </ | ||
+ | < | ||
+ | use MyVideos119 | ||
+ | UPDATE path SET strPath = REPLACE(strPath,' | ||
+ | UPDATE movie SET c22 = REPLACE(c22,' | ||
+ | UPDATE episode SET c18 = REPLACE(c18,' | ||
+ | UPDATE art SET url = REPLACE(url,' | ||
+ | UPDATE tvshow SET c16 = REPLACE(c16,' | ||
+ | UPDATE files SET strFilename = REPLACE(strFilename,' | ||
+ | exit | ||
+ | </ | ||
+ | |||
+ | Update paths of latest | ||
< | < | ||
cd .kodi/ | cd .kodi/ | ||
Line 11: | Line 36: | ||
.quit | .quit | ||
</ | </ | ||
+ | |||
+ | Adjust favourites | ||
+ | < | ||
+ | vi .kodi/ | ||
+ | </ | ||
+ | |||
+ | Adjust source | ||
+ | < | ||
+ | vi .kodi/ | ||
+ | </ | ||
+ | Note: Restart kodi after source adjustment! | ||
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.1635767256.txt.gz · Last modified: 2023/05/29 11:53 (external edit)