Posts: 5,400
Joined: Jul 2012
Reputation:
372
For watched and resume, export library to separate xml files with overwrite on the database that has what you want. On the new database import from the xml files (for example, set content on the source and scan, or do refresh on individual items).
scott s.
.
Posts: 20,935
Joined: Apr 2017
Reputation:
1,443
And nfo files are a library feature. If the movies/tv shows are not in the library, then there is nothing to export.
Posts: 7
Joined: Jul 2024
Reputation:
0
I have a very similar need to transfer watched and resume status from Kodi 17.6 to 19.5. (I have to use 19.5 for a specific skin.) I exported as single file, and get all the info I need. However, I don't want it to import anything except playcount, lastplayed, and resume info.
I can clean the single xml file with:
grep -E 'videodb>|<\?xml|version>|<path>/|<filenameandpath>|<basepath>|movie>|resume>|<position>|<total>|<playcount>|<lastplayed>' videodb.xml > watcheddb.xml
But what I don't know is what the importer keys on... is it path? title? Something else? Would this even work to MERGE the watched info without changing anything else?
Posts: 20,935
Joined: Apr 2017
Reputation:
1,443
The other method is direct editing of the database. But if you choose to attempt this, make sure you have a backup of your database first, in case you screw up the process.
Get a copy of your v17.6 database that has all the playcount data
After scanning your library into v19.5 make a copy of the database for backup.
Open both v17.6 and v19.5 databases
Go to the files table in both.
Sort both tables by filename.
Hopefully all the filenames are identical in both databases, so both lists should be identical.
Now just like an Excel spreadsheet simply copy the contents of one column into the same column in the other database.
Save the database
Posts: 7
Joined: Jul 2024
Reputation:
0
Interesting! That sounds like a possible solution, since both have the same sources, and both can be cleaned/scraped first so the filename entries SHOULD be the same count/order.
Thank you. I will give that a try once I find a DB viewer for macos that will do the Excel like column copy.
Posts: 7
Joined: Jul 2024
Reputation:
0
Thanks again for the help.
I am a little stuck. The 2 databases have the exact same count of items in movie and movie_view. I even pasted the c22 path columns from the old and new db's into 2 different text files, and did a diff on them, and they are identical. But, the files table is vastly different due to some 3000 dead entries that don't go away with a normal DB clean operation.
movie_view is the only one that has both the path and the lastPlayed, viewCount, etc that I want to copy from DB to DB. DB Browser refuses to allow me to past into a view, only into a table... which is sort of odd that it allows me to unlock the view for editing, but not let me paste without an error stating that editing in view mode is not allowed. I thought I saw that view editing was added years ago, but apparently I'm missing a few steps.
I may try going down the path of using a deep db clean with script.database.cleaner (the old one for 17 and the new one for 19+), and see if I can get matching file tables.
Posts: 7
Joined: Jul 2024
Reputation:
0
I did find a solution to transfer last played, play count and resume info from Kodi 17 to 19, without just upgrading the db in-place (It was ancient and crusty and I really wanted a clean start.)
This works for non-scraped titles as well as scraped titles. Probably only works for movies, but that is all I cared about for home movies not indexed by tmdb.
On new machine, starting out with a clean Kodi install, using sources with the same paths. Scan with TMDB to catch all the commercial stuff.
The transfer:
Export strPath, strFilename, playCount, resume info, etc as a tab delimited file from SQlite studio from the old DB. (I used a select statement to grab just what I wanted from the various tables)
Use shell script to iterate through each entry in the tab separated file to see if it still exists by path+filename.
If present, create an .nfo that contains just the info present in the db (playCount, lastPlayed, etc.) and place it at the same path.
Change advancessettings.xml to set importwatchedstate and importresumepoint to true.
Update library to pull this info in.
Remove the advanced settings so it doesn't reimport the generated nfos.
Search media source for files ending in .nfo that were generated on the date the script above ran and delete them just to be sure they don't get imported again later.
Profit.