Original file name:
Code: Select all
iron-sky-the-coming-race26.webpCode: Select all
Iron Sky The Coming Race (2019).webpCode: Select all
iron-sky-the-coming-race26.webpCode: Select all
Iron Sky The Coming Race (2019).webpFormat: Select all
{ csv('/path/to/spreadsheet.tsv')[fn] }Code: Select all
xyz	Avatar (2009)Code: Select all
/Media/{f.path.match(/Badini/).upperInitial()}/{any { anime ? 'Anime' : '' }{ genres =~ /Animation/ ? 'Animation' : '' }}/{any {f.path.match(/Documentary/).upperInitial()}{ genre =~ /Documentary/ ? 'Documentary' : '' }}/{info.OriginalLanguage.toLocale().displayLanguage}/{~jellyfin.id}You cannot (easily) do that. You can however (easily) process files based on already previously processed files.hama4reall wrote: ↑04 Oct 2023, 09:48 In a nutshell i want to extract information from TMDB and rename the files based on them, my sheet doesn't have all the info needed so I'm trying to use FileBot for that matter
And for matching the files with tmdb i have three columns (Movie Name, Release Year, TMDBid)
Format: Select all
{
	// get movie ID for poster file at hand (assuming <TMDBID>.webp naming)
	// TIP: you could directly lookup the TMDB ID from your spreadsheet for the given *.webp file, 
	//      but you didn't provide a sample for your spreadsheet so we can't write code that reads that spreadsheet,
	//      so we assume file name = TMDB ID for example purposes here
	def mid = fn as int
	// find previously processed movie file with that ID and return the corresponding file path
	csv('/path/to/Movies').findResult{ f, m -> if (mid == m.id) f.dir / f.nameWithoutExtension }
}
-posterCode: Select all
19995.webpCode: Select all
/path/to/Movies/Avatar (2009)/Avatar (2009).mp4Format: Select all
{
	def mid = csv('/path/to/ids.tsv')[f.name] as int
	csv('/path/to/Movies').findResult{ f, m -> if (mid == m.id) f.dir / f.nameWithoutExtension }
}
-posterCode: Select all
chernobyl.webp	87108Code: Select all
Expression yields empty value: Cannot invoke "java.lang.Integer.intValue()" because "Code: Select all
{
	def mid = csv('/files/Movies.tsv')[f.name] as int
	csv('/Media/Movies/').findResult{ f, m -> if (mid == m.id) f.dir / 'poster' }
}Code: Select all
/Media/{f.path.match(/Badini/).upperInitial()}/{ hd == /UHD/ ? '4K Movies' : 'Movies' }/{f.path.match(/Short/).upperInitial}/{ genres =~ /Animation/ ? 'Animation' : '' }/{ genre =~ /Documentary/ ? 'Documentary' : '' }/{info.OriginalLanguage.toLocale().displayLanguage}/{~jellyfin.id}Code: Select all
/Media/Movies/{Movie Language}/{Movie Name} ({Year}) [tmdbid-{TMDBID}]/poster.jpgGroovy: Select all
{
	def key = fn
	def value = csv('/files/Movies.tsv')[key]
	if (value == null) {
		throw new Exception("File '$key' is not on the list")
	}
	def mid = value as int
	def movieFile = csv('/Media/Movies/').findResult{ f, m -> if (mid == m.id) f }
	if (movieFile == null) {
		throw new Exception("ID '$mid' does not correspond to any file")
	}
	return movieFile.dir / 'poster'
}Code: Select all
romeo-and-the-black-brothers	35832Code: Select all
`{
	def mid = csv('/files/unsorted/Shows.tsv')[f.name] as int
	csv('/Media/Shows/').findResult{ f, m -> if (mid == m.id) f.dir/ 'poster' }
}`Code: Select all
`/Media/{f.path.match(/Badini/).upperInitial()}/{ hd == /UHD/ ? '4K' : 'Shows'}/{any { anime ? 'Anime' : '' }{ genres =~ /Animation/ ? 'Animation' : '' }{f.path.match(/Documentary/).upperInitial()}{ genre =~ /Documentary/ ? 'Documentary' : '' }{info.OriginalLanguage.toLocale().displayLanguage}}/{~jellyfin.id}`Format: Select all
{
	def index = csv('/Media/TV Shows')
	def tsv = csv('/Files/Series.tsv')
	def key = f.name
	def value = tsv[key]
	if (value == null) {
		throw new Exception("File '$key' is not on the list")
	}
	def sid = value as int
	def episodeFile = index.findResult{ f, m -> if (sid == m.seriesInfo.id) f }
	if (episodeFile == null) {
		throw new Exception("ID '$sid' does not correspond to any file")
	}
	return episodeFile.dir.dir / 'poster'
}