Kodi Community Forum

Full Version: Copy / export movie list, e.g. movies last watched?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Can one copy / export (e.g. to the clipboard, a txt file or such) movie lists, e.g. movies last watched / played?
of a movie
Can Kodi automatically save (after a movie is watched) the names of watched movies to a txt file or so? So each name of a movie which is just watched completely is written / added to a txt file.
There are numerous scripts and tools to do with backing up movie & TV show info, including watched status.

Might be helpful if you told us what you want to do with that info so we can suggest something suitable.
Thank you, Gobberwart,

I just want to move (with a sync program) with a more or less automated manner the watched movies to another external drive each time the main external drive gets too ful.
trakt.tv addon should fit your request without any paper Wink
Thank you.

What option in takt.tv does make a list of the last watched / played movies? Could not find one.
(2017-06-29, 10:45)Boyzie Wrote: [ -> ]Thank you, Gobberwart,

I just want to move (with a sync program) with a more or less automated manner the watched movies to another external drive each time the main external drive gets too ful.
I think I understand.

Basically you need a plain text file containing the filenames (and paths?) of anything you've watched so you can feed that list into another program to move those files somewhere else.

Ie. Foreach (filename in filenamelist) { move file }

Is that right?

Trakt won't help you with this. Trakt will only track your watched history based on movie id, not your local filenames. Even then, I'm not aware that it can export anything useful.

There may be a niche addon somewhere that will do the job, but you might need to code something yourself. Either a kodi addon or just a script that will query the kodi database and dump the info you need.

For example using database MyVideos107.db, this query...

Code:
SELECT path.strPath, files.strFilename FROM files, path WHERE files.idPath = path.idPath AND files.playcount > 1

Should get the info you need, then it's just a matter of concatenating the path and filename and writing it to a file.

You'd probably want to expand on that so that it only shows files found in a specific location etc.

FYI I used the free app "DB Browser for SQLite" to run this query, then just export results to a CSV file.
This query is slightly better...

Code:
SELECT (path.strPath || '\' || files.strFilename) as strFilePathName FROM files, path WHERE files.idPath = path.idPath AND files.playcount > 1 AND path.strPath LIKE 'D:\%'

The output ends up as FILEPATH\FILENAME in a single field, so export is then very simple.
After a little research I came across an addon in the kodi repo called "janitor" which is designed to automate the entire process and has a bunch of options which look pretty useful.

It doesn't export anything, but it can move files to wherever you specify based on watched status, so if that's all you want, you won't need to export.

It's in the programs section of the repo if you want to check it out.

Note that the addon description says it will "delete" the files, but you can choose between deletion and moving them to another location.

The only thing I can't tell is what would happen if the destination folder was part of the kodi library. I'd hope it would ignore them.
Quote:Basically you need a plain text file containing the filenames (and paths?) of anything you've watched so you can feed that list into another program to move those files somewhere else.
Yes, sorry, forgot to mention this. And yes, the file / movie name would be enough to enter it in the / a sync program to be included (and exclude all of the other files / folders).

Quote:Ie. Foreach (filename in filenamelist) { move file }

Is that right?
Yes, it looks right, each watched movie (usually in a single movie folder) with files / folders (.actors and such) belonging to the movie file shall be moved to an external drive.

Quote: There may be a niche addon somewhere that will do the job, but you might need to code something yourself. Either a kodi addon or just a script that will query the kodi database and dump the info you need.
Yes, if only I were able to code. I am happy to be able of copying / moving files.

Quote:For example using database MyVideos107.db, this query...

Code:
SELECT path.strPath, files.strFilename FROM files, path WHERE files.idPath = path.idPath AND files.playcount > 1
Thank you. Sorry, but I do not even have any idea where to enter this.

Quote: You'd probably want to expand on that so that it only shows files found in a specific location etc.
Yes, that would be still more useful.

Quote:FYI I used the free app "DB Browser for SQLite" to run this query, then just export results to a CSV file.
So I have to do such a query somewhere here, I assume:
Image

Quote:The output ends up as FILEPATH\FILENAME in a single field, so export is then very simple.
Thank you, I would try it.

Quote:After a little research I came across an addon in the kodi repo called "janitor" which is designed to automate the entire process and has a bunch of options which look pretty useful.
That sounds great, thank you for searching.

Quote:It doesn't export anything, but it can move files to wherever you specify based on watched status, so if that's all you want, you won't need to export.
Yes, it actually is. Additionally I want to check (by content or checksum) whether the (movie) files are transferred correctly, so I would have to copy first and after checking remove the source files.

Quote: Note that the addon description says it will "delete" the files, but you can choose between deletion and moving them to another location.
Hope, I can also choose to copy them.

Quote: It's in the programs section of the repo if you want to check it out.
Yes, of course.

Quote: The only thing I can't tell is what would happen if the destination folder was part of the kodi library. I'd hope it would ignore them.
That is indeed the case, all of the movies / series are transferred to a folder contained in the Kodi database / library.

I didn't dare to try, I assume, I can mess up the database doing a wrong query, this looks quite good to do such a query:
Image

But I tried using a copy of that database, I have any idea where to insert that query.

Actually using a database program to export such lists does not seem to be bad respectively not bader than using Janitor or such. I could - I assume - create a shortcut, link to that query and easily start it each time I want. And there are much more options / ways, I guess, to use such a database program if / when need be, can extent queries, use for different tasks.

Thank you very much