clragon / e1547

A sophisticated e621 browser
https://e1547.clynamic.net/
GNU General Public License v3.0
202 stars 15 forks source link

Cook your own download folder/file path #126

Open clragon opened 4 months ago

clragon commented 4 months ago

Is your feature request related to a problem? Please describe.

Users wish to decide where their downloaded files go and how they are named

Describe the solution you'd like

template string

We should provide a way for users to customize their folder and file paths! We can reuse a common idea where users provide a templated path and the app inserts variables based on context.

example

The app provides the following variables: [host, artists, id, ext] The user may enter any path, containing these variables prefixed with $, e.g. /$host/$artists - $id.$ext which for a post from e621 from the artist blitzdrachin with the id 4687398 and extension png would look like: /e621/blitzdrachin - 4687398.png

pools

Additionally, this could include a variable for the current pool the post is in. This only applies if the user is inside a search with a single pool tag.

In that case, the $pool variable would contain the name of the pool. This would allow users to specify e.g.

/$pool/$id.$ext

The variables could also include $index, which indicates which spot the post occupies in the pool, or maybe the surrounding search.

In cases where a variable is empty and the only part of a given path segment e.g. /$pool/, the segment should be skipped entirely (Should it work this way?).

Additionally, if a pool name contains characters which are not allowed in folder names, they should be removed (Which characters are allowed in folder names?).

folders

as seen in the example, the template path may contain folder names. if a folder does not exist, the app will create it. the last segment of the path is seen as the file name, regardless of whether it contains the extension variable or not.

clragon commented 4 months ago

One thing that this syntax does not let user express is conditionals.

E.g. a user cannot define a path that either sorts posts by artists or by pools. This might be an acceptable downside.