aetaric / checkrr

Checkrr Scans your library files for corrupt media and replace the files via sonarr and radarr
MIT License
206 stars 10 forks source link

Suggestion: support skipping scanning of certain file extensions #2

Closed Emstar closed 1 year ago

Emstar commented 1 year ago

This is a great utility, thank you for releasing it.

In my tests I noticed that the scanner will add .ini files to the list of bad files. It might be nice if there was a way to skip scanning of specific file types. In a mixed OS environment there are various legit non-media files that may end up scattered around the media directories, and they clutter the list of bad files.

Emstar commented 1 year ago

In thinking about this more, a flag to skip processing unrecognized files might be good enough, and probably easier to implement.

Anyway, thanks again, about to let 'er rip!

aetaric commented 1 year ago

I don't think a list of extensions to ignore would be too complex. filepath.Ext() seems like it would do the job well, then just loop over the provided extensions in the config.

clunkclunk commented 1 year ago

While we're at it - what about skipping hidden directories and files? I have a few macOS cruft that takes a few seconds to error on: .AppleDB/, .AppleDesktop/, .DSStore, ..DS_Store, .apdisk.

Emstar commented 1 year ago

It looks like most of the files I want to skip are actually hidden files too--at least when viewed in Windows Explorer.

aetaric commented 1 year ago

Hidden files are interesting. The UNIX/Linux method of "hiding" a file is to prepend a . to the start of a file name. In windows land the check would require using a syscall.GetFileAttributes() call. This would require build constraints to pull in the right logic for the OS build in question. It's definitely possible, but it's a bit messy. Will look around for a more elegant solution.

aetaric commented 1 year ago

@Emstar @clunkclunk if either of you have go installed and use windows... would you mind pulling down the 1.2.0 branch and test the hidden files on windows? I've confirmed it works for Linux already.

Emstar commented 1 year ago

@aetaric Sadly I don't have Go but I'll keep testing binaries.

aetaric commented 1 year ago

checkrr-1.2.0-beta.zip @Emstar well, in that case, I built it for windows via cross-compile.

Emstar commented 1 year ago

@aetaric I'll try to check it out today. Windows Defender nuked it, said it's a virus, so I will have to fight it first, haha.

aetaric commented 1 year ago

Ah yes, the joys of windows.

aetaric commented 1 year ago

I was able to confirm this works via a Windows VM. I'll go ahead and close this out since the code seems to work as expected if you still want to mess around with it feel free, but 1.2.0 seems to be right around the corner.

Emstar commented 1 year ago

I didn't get to it in time, appreciate it! Looking forward to 1.2.0.

Emstar commented 1 year ago

Hey @aetaric sorry for the dumb question, but what is the yaml config file syntax for the new ignoreExt option? I see it is a string array like checkpath but I'm not doing something right.

aetaric commented 1 year ago

Should look a bit like this:

ignoreexts:
  - .txt
  - .nfo
  - .DS_Store
Emstar commented 1 year ago

Weird... I am doing it right, but it really looks like the directive is not being used. I'll open a new issue to keep things tidy and hopefully I am just making a dumb mistake.