Manual path modification in the Kodi database

  • I recently added a hard drive to Kodi and I copied all the series from the old drive. As the path and folder are differents to do not mix series with films, it no longer plays the series.

    How can I change the path "by hand" without scraping the whole series again ? After scrapping for the first time I had to do quite a few modifications and I wouldn't want to lose them.

    Thank you

  • Enable SSH and use PuTTY (Windows) or the native SSH clients on Linux/macOS to connect

    I managed to connect with PuTTY and found the video database at "/storage/.kodi/userdata/Database". How can then edit the database file?

    When I try to install sqlite3 following the link that you said I get an error message that says that "There is no working sudo" ¿?

    If I copy the line without "sudo" another message says " There is no working "apt-get". It seems that these commands do not work in my LibreELECT 9.0.2 installed in an ODROID-C2?. What are the correct comands then?

    Thank you!

  • You don't need to install sqlite3 since it is already installed/present in the OS. And you don't need to prefix commands with 'sudo' to run them as root since you are already the root user. TL/DR; Just run the fix commands.

  • You don't need to install sqlite3 since it is already installed/present in the OS. And you don't need to prefix commands with 'sudo' to run them as root since you are already the root user. TL/DR; Just run the fix commands.

    Well, finally I entered the lines:

    UPDATE path SET strPath = REPLACE(strPath,'/current/VIDEOS FOTOS/','/updated/VIDEOS FOTOS SERIES/');

    UPDATE movie SET c22 = REPLACE(c22,'/current/VIDEOS FOTOS/','/updated/VIDEOS FOTOS SERIES/');

    UPDATE episode SET c18 = REPLACE(c18,'/current/VIDEOS FOTOS/','/updated/VIDEOS FOTOS SERIES/');

    UPDATE art SET url = REPLACE(url,'/current/VIDEOS FOTOS/','/updated/VIDEOS FOTOS SERIES/');

    UPDATE tvshow SET c16 = REPLACE(c16,'/current/VIDEOS FOTOS/','/updated/VIDEOS FOTOS SERIES/');

    UPDATE files SET strFilename = REPLACE(strFilename,'/current/VIDEOS FOTOS/','/updated/VIDEOS FOTOS SERIES/');

    but there's no changes in the database, the path remains the same ¿?

    What's wrong?

    Edited 2 times, last by Papalapa (January 21, 2023 at 6:31 PM).

  • SQL statements are meant to be run inside sqlite3 session. You open it with sqlite3 ~/.kodi/userdata/Database/MyVideosXX.db (replace XX with database version number). Then type the statements at sqlite> prompt. After you're done type .quit. Be careful with UPDATE statement because you might destroy your data with it if you (or the author of instructions) make a mistake.

  • I don't know. Can you give example of a path you want to change?

    Also: It's a good idea to stop Kodi before doing changes to database by hand

    Of course. The old HDD was titled VIDEOS FOTOS, and the Series were into the SERIES folder.

    The new HDD is titled PELIS 04 and the Series are into the VIDEOS FOTOS SERIES/SERIES folder.

    I tried to replace the path VIDEOS FOTOS (old) by the new one VIDEOS FOTOS SERIES in MyVideosXX.db

    What I don't know is if it's also necessary to repace the HDD label (PELIS 04 instead of VIDEOS FOTOS and if so, where it is.

    Many thanks for your concert about the database but don't worry, I'm using my spare ODROID-C2 with a copy of the database from the ODROID-C2 used to watch the films so, nothing happens if the dabatase becomes damaged. I only want to test first before to apply the modification.

  • I tried to replace the path VIDEOS FOTOS (old) by the new one VIDEOS FOTOS SERIES in MyVideosXX.db

    Ok I think you misunderstood how text REPLACE function works. You did

    REPLACE(strPath,'/current/VIDEOS FOTOS/','/updated/VIDEOS FOTOS SERIES/');

    while what you describe is more like

    REPLACE(strPath,'/VIDEOS FOTOS/','/VIDEOS FOTOS SERIES/');

    Quote

    What I don't know is if it's also necessary to repace the HDD label (PELIS 04 instead of VIDEOS FOTOS and if so, where it is.

    Of course. It's in various places. You can copy files to your PC and use graphical tool DB Browser for SQLite to browse database tables (Browse Data tab) and execute SQL (Execute SQL tab).

  • Many thanks for your support, but after several attempts in different ways I didn't success. Finally I'll re-scrap the series from Kodi because I think that's the easiest way.