--def clean=y not working as it should?

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

--def clean=y not working as it should?

Post by stephen147 »

Here's my BAT file code:

Code: Select all

set "EXCLIST=amc_excludelist.groovy"
set "FOLDER_LOG=_AMC Log Files"
set "FOLDER_PROCESS=_To Process"
set "FOLDER_ROOT=Z:/Movies & TV/_Newly DL'd"
set "GROOVY_ANIME=Anime Format.groovy"
set "GROOVY_MOVIE=Movie Format.groovy"
set "GROOVY_TV=TV Format.groovy"
set "FILENAME_LOG=amc.log"

filebot -script fn:amc --output "%FOLDER_ROOT%" ^
--action move --conflict auto -non-strict "%FOLDER_ROOT%/%FOLDER_PROCESS%" ^
--def excludeList="%FOLDER_ROOT%/%FOLDER_PROCESS%/%FOLDER_LOG%/%EXCLIST%" ^
--def animeFormat=@"%FOLDER_ROOT%/%GROOVY_ANIME%" ^
--def movieFormat=@"%FOLDER_ROOT%/%GROOVY_MOVIE%" ^
--def seriesFormat=@"%FOLDER_ROOT%/%GROOVY_TV%" ^
--def artwork=%DL_EXTRAS_ANS% ^
--def target=folder ^
--def clean=y
--def deleteAfterExtract=y ^
--def extras=y ^
--def skipExtract=n ^
--def storeReport=y ^
--def unsorted=n ^
--def kodi=169.254.146.80:8080 ^
--log-file "%FOLDER_ROOT%/%FOLDER_PROCESS%/%FOLDER_LOG%/%FILENAME_LOG%"
When I run this the files are processed into a new seperate folder.

Thing is here's the old folder before and after.

BEFORE

Code: Select all

+---Movie (2014)
      Movie (2014).eng.srt
      Movie (2014).mp4
      clearart.png
      disc.png
      fanart.jpg
      folder.jpg
      imdb.url
      logo.png
      movie.nfo
      poster.jpg
      tmdb.url
      |
      \---extrafanart
            fanart1.jpg
            fanart2.jpg
            fanart3.jpg
AFTER

Code: Select all

+---Movie (2014)
      clearart.png
      disc.png
      fanart.jpg
      folder.jpg
      imdb.url
      logo.png
      movie.nfo
      poster.jpg
      tmdb.url
The only thing it's removing is extrafanart folder.

Should it not be cleaning all those remaining files. Any I missing something?
Last edited by stephen147 on 29 Apr 2019, 14:51, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: --def clean=y not working as it should?

Post by rednoah »

You can run the cleaner script directly on a few test folders, to narrow down why it might not be working for your particular folders.

Code: Select all

$ tree .
.
└── Clutter
    └── Test
        └── test.txt

2 directories, 1 file

Code: Select all

$ filebot -script fn:cleaner .
Delete Clutter/Test/test.txt
Delete Clutter/Test
Delete Clutter
Done ヾ(@⌒ー⌒@)ノ
:idea: Please read the FAQ and How to Request Help.
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: --def clean=y not working as it should?

Post by stephen147 »

It's going back to my other thread here: viewtopic.php?f=4&t=10687

This is not the same problem. There, I was trying to move that folder but here, if that folder exists, it prevents

Code: Select all

filebot -script fn:cleaner .
to work correctly.

Try this zip file of my folder hierarchy.
https://we.tl/t-PzcgPqy2XQ

The folder structure is:

Code: Select all

Z:\MOVIES & TV\_TO PROCESS\1408 (2007) (DIRECTOR'S CUT) 1080P BLURAY DTS 5.1CH X264
|   banner.jpg
|   clearart.png
|   disc.png
|   discart.png
|   fanart.jpg
|   folder.jpg
|   imdb.url
|   landscape.jpg
|   logo.png
|   movie.nfo
|   poster.jpg
|   tmdb.url
|
\---Theme
        1408 (2007) Are You Ready For Our Express Checkout Soundbite_TVTunesTheme.mp3
Once you delete the Theme folder. The command works.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: --def clean=y not working as it should?

Post by rednoah »

The cleaner script of course won't let you accidentally delete your entire video & music collection. :lol:


Here's the default "clutter" types:
https://github.com/filebot/scripts/blob ... .groovy#L7


You can pass in your own though, if you know what you're doing. ;)
viewtopic.php?f=4&t=5#p1341


The cleaner script explicitly won't touch any files or folders where there's still a nearby video / audio file:
rednoah wrote: 21 Jul 2012, 09:50 Description:
  1. Delete clutter files like artwork, samples, etc in folders that have been left over after moving video files.
  2. Won't touch any file in folders where there is at least one video file (that is larger than minsize).

If you just want to delete all *.nfo / *.png / *.mp3 / etc files without any kind of context, then you can just use any generic batch delete tool.
:idea: Please read the FAQ and How to Request Help.
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: --def clean=y not working as it should?

Post by stephen147 »

rednoah wrote: 30 Apr 2019, 04:17 The cleaner script of course won't let you accidentally delete your entire video & music collection. :lol:
Yes, that would be bad times. :lol:
rednoah wrote: 30 Apr 2019, 04:17 Here's the default "clutter" types:
https://github.com/filebot/scripts/blob ... .groovy#L7
I see. I understand.
rednoah wrote: 30 Apr 2019, 04:17 You can pass in your own though, if you know what you're doing. ;)
viewtopic.php?f=4&t=5#p1341
It'was easy.

Code: Select all

filebot -script fn:cleaner "Z:/Movies & TV/_Newly DL'd/_To Process/" ^
--def root=n ^
--def terms="Theme"
rednoah wrote: 30 Apr 2019, 04:17 Delete clutter files like artwork, samples, etc in folders that have been left over after moving video files.
Well, I'd be forgiven for thinking it was only video files. :mrgreen:

BTW, I know enough to try to see if I can make a custom modification to the amc script to include such folders such as the Theme folder I'm having to deal with.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: --def clean=y not working as it should?

Post by rednoah »

The easiest way would be to have your own post-processing commands. Go through the history, check which files are still there, process them according to your preferences.

If you don't to import the extras into the new structure, and really just wanna delete them, then just do that:

Code: Select all

filebot -script fn:amc ...
filebot -script fn:cleaner ...
:!: Modifying the amc script is an option, but there's basically not benefit AFAIK, and really just results in you never updating the amc script ever again, because you'd have to merge in your changes every time.
:idea: Please read the FAQ and How to Request Help.
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: --def clean=y not working as it should?

Post by stephen147 »

rednoah wrote: 30 Apr 2019, 10:54 The easiest way would be to have your own post-processing commands. Go through the history, check which files are still there, process them according to your preferences
Going this route. I wouldn't know where to start.
rednoah wrote: 30 Apr 2019, 10:54 If you don't to import the extras into the new structure, and really just wanna delete them, then just do that:

Code: Select all

filebot -script fn:amc ...
filebot -script fn:cleaner ...
I was planning on doing this anyway. Once I maybe got the amc script working/modified.
rednoah wrote: 30 Apr 2019, 10:54 :!: Modifying the amc script is an option, but there's basically not benefit AFAIK, and really just results in you never updating the amc script ever again, because you'd have to merge in your changes every time.
:!: This is the option I would like. I'm going to be running this amc script now on my existing libray and probably not be doing it again for quite some time. Now is there a link to read up on modifying these files and merge them?

Thanks.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: --def clean=y not working as it should?

Post by rednoah »

Not really. Most scripts are quite easy, but the amc script is bloated with a few hundred lines by now, and so it doesn't lend it self to customization anymore, so some Groovy programming background is probably required if you're gonna make modifications.
:idea: Please read the FAQ and How to Request Help.
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: --def clean=y not working as it should?

Post by stephen147 »

That's fine. Nothing I can't handle. I've learned in a couple of days how to write javascript for Photoshop. So I'm sure I could add this ability for amc script. After all, I'll be the only one using it and take full reasonability for any F'ups I do :)
Post Reply