projectM-visualizer / frontend-sdl-cpp

Standalone application based on libSDL that turns your desktop audio into awesome visuals. Available on most platforms supported by both libprojectM and libSDL.
GNU General Public License v3.0
66 stars 35 forks source link

Preset filter and block list #45

Closed nzoschke closed 1 year ago

nzoschke commented 2 years ago

Note this builds on #46 and #44

nzoschke commented 2 years ago

Moving some of the original PR questions to a comment. Questions:

Where should a frontend store state? Is a local text file ok?

Answer: Text file in app preferences folder is ok.

How to best interact with projectm?

Currently doing this which feels hacky:

Answer: The new playlist management kblaschke is working on

...could provide an API call to set a list of filter strings for the current playlist, which is then applied whenever a file is added.

So eventually this should pass the inclusion and exclusion filter strings to projectm and it will take care of building the playlist.

nzoschke commented 2 years ago

Demo

Playlist only has items that match filter:

% ./src/projectMSDL -p ~/src/presets-cream-of-the-crop --presetFilter 'Dancer/Aurora' 
2022-11-13 12:34:05.109 projectMSDL[21329:4839537] INFO: Config dir '/Users/noah/Library/Preferences/projectMSDL/'
2022-11-13 12:34:05.306 projectMSDL[21329:4839537] INFO: Preset include filter 'Dancer/Aurora'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/suksma - shifter - urchin kali echos - moish dt r3.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/suksma - shifter - urchin kali echos - moish dt r3 nz+.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/suksma - shifter - urchin kali echos - bowel roams nz3.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/suksma - shifter - urchin kali echos - bowel roams nz.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/suksma - shifter - urchin kali echos - bowel roams nz+.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/suksma - shifter - urchin kali echos - bowel nz.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/suksma - shifter - urchin kali echos - bowel nz+.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/shifter - urchin.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/shifter - urchin mod_1.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/shifter - urchin mod.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/shifter - urchin mod deli + nz+.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/shifter - urchin kali.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/shifter - urchin kali mod.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/shifter - urchin kali echos.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/shifter - urchin kali b.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/Jc - Lungs.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/Jc - Flower.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/Jc - Crystal Shards.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/271 nz+ m1 w2 i love life so much i can't stand it.milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/$$$ Royal - Mashup (259).milk'
2022-11-13 12:34:05.337 projectMSDL[21329:4839537] INFO: Preset include '/Users/noah/src/presets-cream-of-the-crop/Dancer/Aurora/$$$ Royal - Mashup (257).milk'
2022-11-13 12:35:28.744 projectMSDL[21344:4840086] INFO: Displaying preset 0 / 21: $$$ Royal - Mashup (257).milk

Pressing minus adds one to exclude list and moves to next preset:

2022-11-13 12:35:28.744 projectMSDL[21344:4840086] INFO: Displaying preset 0 / 21: $$$ Royal - Mashup (257).milk
2022-11-13 12:35:30.724 projectMSDL[21344:4840086] INFO: Add exclusion /Users/noah/Library/Preferences/projectMSDL/exclude.txt $$$ Royal - Mashup (257).milk
2022-11-13 12:35:30.804 projectMSDL[21344:4840086] INFO: Displaying preset 0 / 20: $$$ Royal - Mashup (259).milk

Next run pattern is excluded

% ./src/projectMSDL -p ~/src/presets-cream-of-the-crop --presetFilter 'Dancer/Aurora'
2022-11-13 12:36:21.731 projectMSDL[21372:4840837] INFO: Preset exclude config '/Users/noah/Library/Preferences/projectMSDL/exclude.txt'
2022-11-13 12:36:21.731 projectMSDL[21372:4840837] INFO: Preset exclude '$$$ Royal - Mashup (257).milk'
2022-11-13 12:36:51.312 projectMSDL[21372:4840837] INFO: Displaying preset 0 / 20: $$$ Royal - Mashup (259).milk
kblaschke commented 2 years ago

Added preset filtering in the new playlist library:

https://github.com/projectM-visualizer/projectm/pull/672/commits/9ea98bf01e484340d096fcba9a8d35fac6c351ca

The application still has to set the filter list, but the playlist manager will take care of filtering the files. The filter syntax is implemented as .gitignore-style glob matching, which allows to more clearly specify path and filename matches. The filter list can have include and exclude filters (exclude is default), which are matched in order. So it's possible to exclude a whole directory tree except a few selected presets by first adding the presets to keep, then specify the exclude filter for the directory tree.

API interface requires just a single function call if you only want to apply a loaded flter list, projectm_playlist_set_filter().

kblaschke commented 1 year ago

No activity for four months on this draft PR, so closing it for now.

Please feel free to reopen or create a new PR if there are changes that need merging.