h265ize icon indicating copy to clipboard operation
h265ize copied to clipboard

[Idea] Ignore folder and subfolders if .h265Ignore file exist

Open azsde opened this issue 8 years ago • 4 comments

I have some files that I don't want to encode in h265, would it be possible to add some kind of filter on an empty file to skip encoding the folder and its subfolders ?

azsde avatar Dec 30 '16 11:12 azsde

I made an ugly patch that allow me to do so, i couldn't figure out how your recursive file finding was working, that's why my patch is ugly

In helpers.js :

// Check if each file is a video
_.each(files, function(file) {
    if (isSupportedFileType(file) && !shouldBeIgnored(file)) {
        videos.push(file);
    }
});
function shouldBeIgnored(file) {
  // Check if folder should be ignored
  if (fs.existsSync(Path.join(require('path').dirname(file), 'h265ize.ignore'))) {
      console.log('File ' + colors.yellow(file) + ' is in a folder that has a h265ize.ignore file, skipping it....');
      return true;
  } else
      return false;
}

The best way to implement this feature would be not adding files to the file list if the "h265ize.ignore" file exists at the root of a subfolder, but since I have zero nodejs background, I can't figure out how to do so

Also maybe add an argument option to override the existence of the "h265ize.ignore" file

Edit: ok so I understand a little bit better how it works, it uses "recursive-readdir" to list all files, the thing is that we can't ignore properly a folder without modifying this lib

azsde avatar Feb 16 '17 11:02 azsde

I made an ugly patch

I've seen worse lol

In order to do this correctly we should use minimatch. We would have h265ize.ignore files that may contain an number of glob patterns to ignore. We simply read the h265ize.ignore and compare each glob to the file path. If it matches we don't add the file.

Also maybe add an argument option to override the existence of the "h265ize.ignore" file

This may be more of an edge case

On a side note: I've wanted to rewrite h265ize again for a while now. This time with gui in mind. I'm going to put together an issue for ideas for h265ize@next, feel free to chime in.

FallingSnow avatar Feb 16 '17 18:02 FallingSnow

I actually started working on my own version, but this time a C++ /Qt one

Github Repo : https://github.com/azsde/qt-h265ize

So far nothing interesting, but when I find the time I'll code more and more features into it

azsde avatar Feb 17 '17 09:02 azsde

Awesome!

Let me know if there's anything I can do to make it easier on you.

FallingSnow avatar Feb 17 '17 21:02 FallingSnow