Page 2 of 2
Re: Naming files from local PLEX database
Posted: 02 May 2021, 10:46
by snickers2k
but still, i don't understand why this is not possible with filebot .. emby/plex is often the only place where stuff is organized in messed up libraries .. so converting back from plex/emby db's seems like a obvious thing to do :/
well thanks anyway
Re: Naming files from local PLEX database
Posted: 02 May 2021, 11:57
by rednoah
Why not go with the previously suggested solution though? The XML file does seem to include the file paths for each file in the library, no?
viewtopic.php?p=54468#p54468
1. Use Tautulli to export the information we need as easy-to-read XML file
2. Use custom Plain File Format to generate nice file paths based on the information in the XML file
3. Done
Re: Naming files from local PLEX database
Posted: 02 May 2021, 16:33
by kim
snickers2k wrote: ↑01 May 2021, 20:35
yeah i'm sorry but i found out too late that there is no filepath exported to work with :/
e.g.
Code: Select all
<location>/mnt/media/Spielshows/Denn sie wissen nicht was passiert/Denn.sie.wissen.nicht.was.passiert.S03E04.GERMAN.1080p.HDTV.x264-aWake-xpost/awa-desiwiniwapas03e04xd.mkv</location>
or
Code: Select all
...file="/mnt/media/Spielshows/Denn sie wissen nicht was passiert/Denn.sie.wissen.nicht.was.passiert.S03E04.GERMAN.1080p.HDTV.x264-aWake-xpost/awa-desiwiniwapas03e04xd.mkv"...
path changed? just search / replace = EASY!!!
Re: Naming files from local PLEX database
Posted: 03 May 2021, 05:36
by rednoah
kim wrote: ↑02 May 2021, 16:33
path changed? just search / replace = EASY!!!
Well, I guess Plex wouldn't be able to find / play the file it wasn't where Plex thinks it is anyway.
But even if we were to use the exported XML file from a remote server, and then run FileBot on the local Desktop, the file name alone is probably unique enough to establish a 1:1 link so we don't need to rely on an exact file path match:
Code: Select all
dom.show.season.episode.media.part.find{ it.'@file'.text().toFile().name == f.name }
e.g.
Code: Select all
{
// find <part> element for the file at hand
def dom = xml('/path/to/library.xml')
def part = dom.show.season.episode.media.part.find{ it.'@file'.text().toFile().name == f.name }
// navigate parent elements and access attributes
def n = part.'..'.'..'.'..'.'..'.'@title'.text()
def s = part.'..'.'..'.'..'.'@index'.text() as int
def e = part.'..'.'..'.'@index'.text() as int
def t = part.'..'.'..'.'@title'.text()
// generate file name
"${n} - S${s.pad 2}E${e.pad 2} - ${t}"
}