Naming files from local PLEX database

All about user-defined episode / movie format expressions
Post Reply
MaxNZ
Posts: 1
Joined: 07 Oct 2017, 12:46

Naming files from local PLEX database

Post by MaxNZ » 07 Oct 2017, 12:52

Hi,

I have flex database fully populated with correct data for each movie/show. However, file names are all out of wack, so I wanted to use Filebot to rename files based on existing Flex database. So when renaming files I'd like Filebot to lookup my local PLEX database instead of online one.. How can this be done? Thanks

User avatar
rednoah
The Source
Posts: 16547
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Naming files from local PLEX database

Post by rednoah » 07 Oct 2017, 22:05

There is no built-in support.

It's perfectly possible though, by writing a custom format that somehow talks to the database and gives you the correct file path based on that. You'd need some Java/Groovy skills for that.

If you could export your database into an easy-to-read file then it'd be much easier:
viewtopic.php?f=8&t=5373
:idea: Please read the FAQ and How to Request Help.

snickers2k
Posts: 12
Joined: 05 Nov 2016, 15:13

Re: Naming files from local PLEX database

Post by snickers2k » 21 Aug 2019, 11:09

@rednoah, this would be a huge feature request. I'm missing this feature for Years now... :/

I guess many of us fixing incorrect matches directly in Plex. But the original filename is still not appropriate. This is a huge Problem.

(Maybe it could be even useful (especially for cloud-users) to use the Plex-db completely, instead of xattr, to lower hits?)

devster
Posts: 332
Joined: 06 Jun 2017, 22:56

Re: Naming files from local PLEX database

Post by devster » 21 Aug 2019, 18:40

Plex matching doesn't need to be fixed if filename is correct, it's a bit of a chicken-n-egg scenario.
Also the request is non-trivial, as searching the Plex DB using the available API for the file name doesn't return a result.
I only work in black and sometimes very, very dark grey. (Batman)

snickers2k
Posts: 12
Joined: 05 Nov 2016, 15:13

Re: Naming files from local PLEX database

Post by snickers2k » 22 Aug 2019, 13:24

Thats true. But i personally have bad expierence without "-non-strict" mode, since there is not always a Year in the title. For example without -non-strict, Title "Baywatch" , without the Year it's doing nothing because of not being able to differentiate "Baywatch Nights". -non-strict is oppurtunistic enough to match "Baywatch".

But this can fail - and it does.

Another thing would be this example: "Noch.Drei.Maenner.noch.ein.Baby.1987.German.AC3D.DL.720p.WebHD.mkv". Filebot is not able to match this, altough i don't know why, because tmdb can find this title. But anyways, Plex had no Problem to recognize.
So being able to get those information from Plex directly would be great.

This is exactly what i'm looking for, but only embedded in filebot: https://github.com/rieck/perplex

devster
Posts: 332
Joined: 06 Jun 2017, 22:56

Re: Naming files from local PLEX database

Post by devster » 22 Aug 2019, 22:54

The script queries an sqlite3 DB.
I think you might be better off exporting it to another format and try using that to rename your files.
rednoah might be able to help more with this.
I only work in black and sometimes very, very dark grey. (Batman)

User avatar
rednoah
The Source
Posts: 16547
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Naming files from local PLEX database

Post by rednoah » 23 Aug 2019, 03:17

If you could rename the information you need via Groovy, either from the sqlite3 db directly or some text file, then you can use generic file mode, and assemble the destination file name with your own custom code:
viewtopic.php?f=3&t=2072

e.g. if you could write *.nfo files for each movie / episode files, then that would make writing custom formats easy (e.g. similar to the examples listed in the post above)
:idea: Please read the FAQ and How to Request Help.

devster
Posts: 332
Joined: 06 Jun 2017, 22:56

Re: Naming files from local PLEX database

Post by devster » 23 Aug 2019, 07:47

Kodi exports to nfo files, Plex unfortunately doesn't (natively).
Can FileBot script query an sqlite db without any additional dependencies?
If querying is possible, the process could be much simpler, as the DB should contain a line with the precise file name and path, and Plex has an API to update the DB afterwards).
I only work in black and sometimes very, very dark grey. (Batman)

User avatar
rednoah
The Source
Posts: 16547
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Naming files from local PLEX database

Post by rednoah » 23 Aug 2019, 09:23

devster wrote:
23 Aug 2019, 07:47
Can FileBot script query an sqlite db without any additional dependencies?
Not sure. Probably not though, since FileBot doesn't use sqlite internally. The JRE or Groovy runtime might include some sort of built-in API though.

@Grab should work in scripts to retrieve and load additional dependencies at Groovy runtime:
:arrow: http://docs.groovy-lang.org/latest/html ... grape.html
:arrow: http://www.octodecillion.com/groovy-with-sqlite/
:idea: Please read the FAQ and How to Request Help.

devster
Posts: 332
Joined: 06 Jun 2017, 22:56

Re: Naming files from local PLEX database

Post by devster » 23 Aug 2019, 10:01

I'll try, this could actually lead to some pretty interesting formats.
Dynamic class loading is one of the things that won't work with GraalVM though.
I only work in black and sometimes very, very dark grey. (Batman)

Post Reply