Rename Script

All your suggestions, requests and ideas for future development
Post Reply
Automator
Posts: 36
Joined: 30 Jul 2015, 10:17

Rename Script

Post by Automator »

Hi there,

I am trying to find out what I am doing wrong or if the script is having a bug?

Code: Select all

java -jar /usr/bin/filebot/FileBot.jar -script fn:renall "/home/downloads/Bibi.und.Tina.voll.Verhext.2014.German.1080p.BluRay.x264/" -non-strict --db TheMovieDB --def target=folder --action move --output "/mnt/temp/1080p/" --log info --log-file filebot.log

Sep 09, 2015 2:39:46 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Sep 09, 2015 2:39:52 PM net.filebot.web.TMDbClient getMovieInfo
WARNING: Movie data not found: Bibi und Tina: Voll Verhext! (2014) [354663 / -1]
CmdlineException: Unable to identify or process any files
Thanks for any advice

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

Re: Rename Script

Post by rednoah »

1.
filebot.sh is there for a reason. Use it.

2.
Have you tried --lang de yet?

If you process German-named files in English-mode then it won't necessarily work. Especially for the oddball movies.
:idea: Please read the FAQ and How to Request Help.
Automator
Posts: 36
Joined: 30 Jul 2015, 10:17

Re: Rename Script

Post by Automator »

Sorry, I thought there is more debug information with running it as a jar file...

Code: Select all

/usr/bin/filebot/filebot.sh -script fn:renall "/home/downloads/Bibi.und.Tina.voll.Verhext.2014.German.1080p.BluRay.x264/" -non-strict --lang de --db TheMovieDB --def target=folder --action move --output "/mnt/temp/1080p/" --log info --log-file filebot.log

Sep 09, 2015 5:55:38 PM net.filebot.web.TMDbClient getMovieInfo
WARNING: Movie data not found: Bibi und Tina: Voll Verhext! (2014) [354663 / -1]
CmdlineException: Unable to identify or process any files
Automator
Posts: 36
Joined: 30 Jul 2015, 10:17

Re: Rename Script

Post by Automator »

I am also trying to create my own groovy script with all the stuff I want... the biggest issue i have so far is how to move all the .srt and .idx and .sub files from a subfolder in the eachMediaFolder up to the eachMediaFolder

For example:

MovieName
------> Subs
----------> MovieName.en.srt
----------> MovieName.de.srt

and I want to move the two srt file up to the folder MovieName
Automator
Posts: 36
Joined: 30 Jul 2015, 10:17

Re: Rename Script

Post by Automator »

I just found out that with:

Code: Select all

args.getFiles{ it.isSubtitle()}
.each{
  println it
}
I can get all the subs :) but how do I move them now
User avatar
rednoah
The Source
Posts: 23931
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Script

Post by rednoah »

This should work:

Code: Select all

args.getFiles{ it.isSubtitle() }*.copyTo('/path/to/folder' as File)
:idea: Please read the FAQ and How to Request Help.
Automator
Posts: 36
Joined: 30 Jul 2015, 10:17

Re: Rename Script

Post by Automator »

I did it like this:

Code: Select all

//Get the Parent Folder
args.eachMediaFolder{
  ParentFolder = it
}
//Move all the Subtitles to the Parent Folder
args.getFiles{ it.isSubtitle()}
.each{
  rename(file:it,output:ParentFolder,format:"{fn}")
}
But I guess yours is cleaner :)
Automator
Posts: 36
Joined: 30 Jul 2015, 10:17

Re: Rename Script

Post by Automator »

I changed the code slightly :)

Code: Select all

SubFolder = null

args.getFiles{ it.isSubtitle() }
.each{
  SubFolder = new File(getMediaInfo(file:it, format:"{folder}"))
  it.moveTo(new File(getMediaInfo(file:it, format:ParentFolder+"/{fn}.{ext}")))
}

if (SubFolder != null && SubFolder.getFiles().isEmpty()) SubFolder.deleteDir()
but I have a new little issue... I sometimes have .sfv or what ever garbage files in the SubFolder... how can I remove them easly?

And did you see the output of the .sh run with --lang de? Still the same result...
User avatar
rednoah
The Source
Posts: 23931
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Script

Post by rednoah »

Simple Java/Groovy code will do:

Code: Select all

def folder = it.parentFile
Whatever you're doing, File.isSubtitle() certainly does not return true for *.sfv files.
:idea: Please read the FAQ and How to Request Help.
Automator
Posts: 36
Joined: 30 Jul 2015, 10:17

Re: Rename Script

Post by Automator »

I implemented a part of your cleanup script :) to get rid of the .sfv files and the sub folder after its empty.

What about the issue with the movie I posted?
User avatar
rednoah
The Source
Posts: 23931
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Script

Post by rednoah »

So I had a look at the HTTP Request/Response and it looks like TheTVDB is sending back conflicting data:

Code: Select all

{
	"page": 1,
	"results": [{
		"adult": false,
		"backdrop_path": null,
		"genre_ids": [],
		"id": 354663,
		"original_language": "de",
		"original_title": "Bibi und Tina: Voll Verhext!",
		"overview": "The Girl Witch Bibi Blocksberg and her best friend Tina seek out on their second adventure on a horse ranch.",
		"release_date": "2014-12-25",
		"poster_path": null,
		"popularity": 1.089,
		"title": "Bibi und Tina: Voll Verhext!",
		"video": false,
		"vote_average": 0.0,
		"vote_count": 0
	}, {
		"adult": false,
		"backdrop_path": "/8VLIDCmjwOMJs74IYhiQ2kmDwe2.jpg",
		"genre_ids": [12, 10751],
		"id": 301825,
		"original_language": "de",
		"original_title": "Bibi & Tina - Voll verhext!",
		"overview": "Sequel to the Movie \"Bibi & Tina - Der Film\" about a teen witch, her best friend and their horses.",
		"release_date": "2014-12-25",
		"poster_path": "/aV95CutQvY1pAdM044Md0a1T9lM.jpg",
		"popularity": 1.694438,
		"title": "Bibi & Tina - Voll verhext!",
		"video": false,
		"vote_average": 8.0,
		"vote_count": 1
	}],
	"total_pages": 1,
	"total_results": 2
}
Looks like it was somehow added twice, and one entry is now dead (though it somehow shows up during API search for some reason = bug).
:idea: Please read the FAQ and How to Request Help.
Post Reply