9001 / 9001/copyparty

Allow multiple entries for flags taking a regex argument(`unlist`, `no-idx`, `srch-excl`, etc.)

Open
#293 0 comments 1 reaction 1 assignee Claimed by @9001 View on GitHub
enhancement
Dominant language
Python
Stars
46.6k
Forks
1.9k
Avg merge
10d 16h
Merged PRs (30d)
5

Description

While configuring Copyparty, I came across a gap in functionality which would make the software even more amazing. In my various folders I have mapped, there are many different kinds of files which I do not want to show up in the browser at all(not just hidden from search results), leading me to the `unlist` flag. This flag(as well as others such as `no-idx`, and `srch-excl`) takes a regex argument, which is then used to remove matching files from the file listing and index. Great!

However, in my use case I have a certain set of excludes I would like to globally ignore, and then additional sets for specific volumes as well. I noticed that only the most recent instance of the flag is used, meaning the globally ignored files I defined in the `[global]` section via `unlist: (eaDir|\.nfo$)` are totally ignored when I also specify `unlist: \.lrc$` within the `[flags]` section of a specified volume.

My proposal is as follows:
1. Respect both the `unlist` flag specified in the `[global]` section as well as the volume flag specified in the volume's config section
2. Support multiple instances of the `unlist` flag within the global config as well as the volume flags config. If supporting multiple instances of this flag is not possible due to the way config parsing works, then come up with another way to specify a list of regex strings to ignore.

Currently there is no good way to specify multiple ignore patterns, so if you want to exclude all `.nfo` files, all `.lrc` files, as well as any files containing the term `eaDir`, you must build a single regex encompassing all of these constraints. While that isn't very difficult when you only have a few exclude rules, it gets significantly more complicated as you add more exclusion rules to this.

Ideally we could specify multiple rules for `unlist`(but this really applies to all regex rules) something like so:
```
[global]
...
unlist: \.nfo$
unlist: eaDir

[/music]
...
[flags]
unlist: \.lrc$
unlist: cover.jpg
```

Or as an array-like argument
```
[global]
...
unlist: [ "\.nfo$", "eaDir" ]

[/music]
...
[flags]
unlist: [ "\.lrc$", "cover.jpg" ]
```

The above would then globally exclude all `*.nfo` files and any files containing the term `eaDir`, while the `/music` volume would exclude the aforementioned files specified in the `[global]` section _as well as_ all `*.lrc` files and any file named `cover.jpg`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.