CLI treating folders as files

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Dfects
Posts: 12
Joined: 30 Mar 2015, 22:29

CLI treating folders as files

Post 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
User avatar
rednoah
The Source
Posts: 23950
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: CLI treating folders as files

Post 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
:idea: Please read the FAQ and How to Request Help.
Dfects
Posts: 12
Joined: 30 Mar 2015, 22:29

Re: CLI treating folders as files

Post 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.
User avatar
rednoah
The Source
Posts: 23950
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: CLI treating folders as files

Post 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.
:idea: Please read the FAQ and How to Request Help.
Dfects
Posts: 12
Joined: 30 Mar 2015, 22:29

Re: CLI treating folders as files

Post 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]
User avatar
rednoah
The Source
Posts: 23950
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: CLI treating folders as files

Post 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?
:idea: Please read the FAQ and How to Request Help.
Dfects
Posts: 12
Joined: 30 Mar 2015, 22:29

Re: CLI treating folders as files

Post 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
Dfects
Posts: 12
Joined: 30 Mar 2015, 22:29

Re: CLI treating folders as files

Post 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
User avatar
rednoah
The Source
Posts: 23950
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: CLI treating folders as files

Post 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.
:idea: Please read the FAQ and How to Request Help.
Dfects
Posts: 12
Joined: 30 Mar 2015, 22:29

Re: CLI treating folders as files

Post 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?
User avatar
rednoah
The Source
Posts: 23950
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: CLI treating folders as files

Post 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
:idea: Please read the FAQ and How to Request Help.
Dfects
Posts: 12
Joined: 30 Mar 2015, 22:29

Re: CLI treating folders as files

Post 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.
User avatar
rednoah
The Source
Posts: 23950
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: CLI treating folders as files

Post 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
:idea: Please read the FAQ and How to Request Help.
Dfects
Posts: 12
Joined: 30 Mar 2015, 22:29

Re: CLI treating folders as files

Post 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!
Post Reply