Page 1 of 1

CLI treating folders as files

Posted: 07 May 2015, 20:23
by Dfects
Hiya,

I'm still working on a script to clean up my stored media. The problem I'm having currently is that filebot seems to be treating some folders as files and I can't see an option to change that?

Code: Select all

filebot --action test -non-strict -rename /media/shared/vault/Movies/ --format "/media/shared/vault/Movies/{n.space('.').replaceAll(/[!?.]+$/).replaceAll(/[``´´‘’ʻʻ'']/)}{'.'+y}{'.'+vf}{'.'+source}{'.'+vc}{'.'+ac}" --db TheMovieDB
This seems to pick up one of the folders and try and convert it to a movie, when it in fact contains lots of movies I tell it to rename later:

Code: Select all

Auto-detect movie from context: [/media/shared/vault/Movies/Ghibli]
...
[TEST] Rename [/media/shared/vault/Movies/Ghibli] to [/media/shared/vault/Movies/Ghibli.The.Miyazaki.Temple.2005.720p.BDRip.x264.DTS]
Is there any way to control this? I just want it to leave folders alone

Re: CLI treating folders as files

Posted: 08 May 2015, 14:10
by rednoah
Are you using the latest version?
Release Notes wrote:* Do not treat folders with "movie.nfo" as single units like disk folders anymore
The current release should only treat VCD/DVD/BRD folders as single units. Already organized folders that already contain movie.nfo or tvshow.nfo should not receive special handling anymore now.

@see viewtopic.php?f=7&t=2034#p13588

Re: CLI treating folders as files

Posted: 08 May 2015, 14:20
by Dfects
Thanks for the reply. Looks like I'm on the newest version:

Code: Select all

FileBot 4.5.6 (r2818) / Java(TM) SE Runtime Environment 1.8.0_45 (headless)
I've checked the folder with "ls -a" and it only contains about 15 .mkv files, nothing else.

Re: CLI treating folders as files

Posted: 08 May 2015, 14:35
by rednoah
As long as nothing matches this pattern it shouldn't be treated as disk folder:

Code: Select all

BDMV|HVDVD_TS|VIDEO_TS|AUDIO_TS|VCD|MovieObject.bdmv|VIDEO_TS.VOB
Post the output of ls -a on pastebin or somewhere so I can have a look.

Re: CLI treating folders as files

Posted: 08 May 2015, 14:57
by Dfects
Sure :) Thanks for taking a look:

Code: Select all

http://pastebin.com/3zDn3vaF
Just to add, this is happening to 4 out of 5 folders in this parent folder.

Further bit of info, the folders are:

Code: Select all

Auto-detect movie from context: [/media/shared/vault/Movies/DVD Backups]
Auto-detect movie from context: [/media/shared/vault/Movies/Bourne Trilogy]
Auto-detect movie from context: [/media/shared/vault/Movies/Lord Of The Rings]
Auto-detect movie from context: [/media/shared/vault/Movies/Ghibli]
Auto-detect movie from context: [/media/shared/vault/Movies/Juno]

Re: CLI treating folders as files

Posted: 08 May 2015, 15:30
by rednoah
Sorry, but it works as expected here (http://pastebin.com/AXuhzNu5).

Not sure what might be different in your cases. It's very strange. Looking at the code I don't understand how that could happen...

Judging by the code this would happen if `file.isDirectory()` was to return false for the Ghibli folder. Sometimes remote filesystems are buggy but this would be rather serious. Are your files on a local filesystem? Or on a shared drive? Maybe some odd permission issues?

Re: CLI treating folders as files

Posted: 08 May 2015, 15:54
by Dfects
Its on a USB 3 drive attached to a headless server. Should be formatted to EXT4. The only possible weird thing is that its running against a bind mount rather than the actual structure directly. I wonder if that's causing it to get confused. I'll try hitting the folder direct.

-- Edit: scrap that, its actually just a normal mount:

Code: Select all

LABEL=vault     /media/shared/vault     ext4    rw,defaults     0       0

Re: CLI treating folders as files

Posted: 08 May 2015, 16:00
by Dfects
Oh, actually the only difference I can see is you're running it directly in the Ghibli folder, where My script is running it in the parent folder and renaming the ghibli folder... so:

Code: Select all

filebot --action test -non-strict -rename /Users/reinhard/Test/AMC-TEST/Movies/ --format "/media/shared/vault/Movies/{n.space('.').replaceAll(/[!?.]+$/).replaceAll(/[``´´‘’ʻʻ'']/)}{'.'+y}{'.'+vf}{'.'+source}{'.'+vc}{'.'+ac}" --db TheMovieDB

Re: CLI treating folders as files

Posted: 08 May 2015, 16:31
by rednoah
Aha! Now I get the same.

You need to specify -r option for that to work.

Though that it's processing something when it should just say "No files" is definitely a bug...

EDIT: that does not seem to occur in the latest revision... consider it fixed for the next release.

Re: CLI treating folders as files

Posted: 08 May 2015, 17:41
by Dfects
Thanks for the reply! That does seem to stop it from renaming the folders, but I didn't actually want it to recurse into the sub folders as I'm controlling that via a bash script (some folders shouldn't be processed at all). Is there any way to tell it to just ignore folders altogether?

Re: CLI treating folders as files

Posted: 08 May 2015, 21:05
by rednoah
Have you tried the latest and greatest?
https://sourceforge.net/projects/filebo ... ebot/HEAD/

Other than that you can always just pass in the files. If you only pass in files then it definitely won't process any folders. :D

Re: CLI treating folders as files

Posted: 08 May 2015, 23:42
by Dfects
I tried doing it file by file, wow it works but boy its slow :D To be expected though

So I downloaded the filebot.jar from your link and ran it via:

Code: Select all

java -jar filebot.jar --action test -non-strict -rename /media/shared/vault/Movies/ --format "/media/shared/vault/Movies/{n.space('.').replaceAll(/[!?.]+$/).replaceAll(/[``´´‘’ʻʻ'']/)}{'.'+y}{'.'+vf}{'.'+source}{'.'+vc}{'. '+ac}" --db TheMovieDB
Low and behold, it doesn't try and rename any folders! Spot on :D will run it straight from the jar for the time being until 4.5.7 is final.

Thanks for your help.

Re: CLI treating folders as files

Posted: 09 May 2015, 18:36
by rednoah
1)
Don't use the jar. Use the filebot.sh launch script. Running the jar is not recommended.

2)
You can pass up to ~ 65.000 cmdline arguments. So by passing each file I mean calling filebot once and passing many files, not one call per file.

~ find files | xargs | filebot

Re: CLI treating folders as files

Posted: 09 May 2015, 18:58
by Dfects
1, Whoops! Just ran it over all my files direct from the jar... worked fine though it seems! Will grab the script and launch from that from now on.

2, Haha yes, I can see how that would be much quicker! :D

Thanks again for your help and this great tool. Very much appreciated. My media collection has never been so neat!