There's all this wonderful information that rename() is willing to populate into a new filename based on format - e.g., episode number, special number, part number, actors, director, etc.
How do I get access to the object that has this information in my script? I see that there are functions for parsing out a few of these pieces of information from the name of the file, but there isn't anything for others - like telling if a file is a special.
Episode Metadata From Within Script
Re: Episode Metadata From Within Script
rename() is way too complicated and that nice metadata is only available after lots of processing.
If xattr is enabled then rename() will store primary metadata via xattr. So after rename() you can read the information via File.xattr.metadata (JSON String) or File.metadata (FileBot Episode/Movie Object).
To get extended metadata like director and actors you'd have to further hook into internal APIs.
If xattr is enabled then rename() will store primary metadata via xattr. So after rename() you can read the information via File.xattr.metadata (JSON String) or File.metadata (FileBot Episode/Movie Object).
To get extended metadata like director and actors you'd have to further hook into internal APIs.
Re: Episode Metadata From Within Script
The latest SVN revision makes this easier. Like so:
Code: Select all
def e = '''{"@type":"net.sourceforge.filebot.web.Episode","seriesName":"Firefly","seriesStartDate":{"year":2002,"month":9,"day":20},"season":1,"episode":1,"title":"Serenity","absolute":1,"special":null,"airdate":{"year":2002,"month":12,"day":20},"series":{"@type":"net.sourceforge.filebot.web.TheTVDBSearchResult","seriesId":78874,"name":"Firefly","aliasNames":[]}}'''
def m = '''{"@type":"net.sourceforge.filebot.web.MoviePart","partIndex":1,"partCount":2,"year":2009,"imdbId":-1,"tmdbId":19995,"name":"Avatar","aliasNames":[]}'''
e = e.jsonToObject()
m = m.jsonToObject()
println e.mediaBinding.name
println m.mediaBinding.name
def f = /path/ as File
println f
println f.mediaBinding.name
println f.mediaBinding.fileName