-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Album Name regex ? #106
Comments
So you have one folder per day and would like to only create an album based on the title following the date? I agree a regex_replace function might be the most straight-forward solution. I think it makes sense to apply that at the end of |
ok, glad my need is not so terribly wrong :) yes my classic folder structure carries the date as a prefix (as most other tools can nod sort by its (exif-) content) I made a try attempt #110 with two arguments to see if its handy to use it. one argument in sed style would be also nice, however not as easy to implement in python.
I would expect escaping issues and questions from other users (?) Let me know what you think and feel free to tweak as it matches your code style. Out of curiosity, how does immich/your script knows that an album already exist? |
Nice, looks pretty much as I expected it to.
After building the list of albums from the assets, the script fetches the complete list of existing albums from the API here: immich-folder-album-creator/immich_auto_album.py Line 1908 in 93357eb
|
yes, it worked in my situation. I will do some testing with/without/replace and do the documentation part. yes. ENV, Args and so on smells of escaping issue sooner or later :) - maybe config file/json/yaml would be better? (as a long term idea..) |
Yes, I've thought of that a couple of time in the past. It would make it much easier for people trying to serve multiple users (and thus need multiple API keys) with Docker. Instead of spinning up multiple containers, a single one with a config file for different API keys and different settings would suffice. |
Hello, I came here to check for nearly exactly that feature, except I would need multiple RegEx chained. My folder structure and naming convention is nearly the same as yours — except I am using underscores in names instead spaces, to make shell scripting easier. So, my structure is:
…and I would, in a first step, replace That would be great! |
@ratti i think this can be done with one regex as intended. Please make some test caseses in your python console e.g.
|
I don't speak Python, but I'd guess that puts a space at the beginning of every album name. However, that's just one specific case. I just think having an option for chaining RegEx's will increase the power of that feature a lot with minor additional effort. Chaining matching expression with EDIT: Ah, I didn't notice the "strip" at the end, however, if I get that feature right, I could only hand over a RegEx, not running fully chained python methods, right? So this wouldn't help? |
I do understand where @ratti is coming from. His example could work with a single regexp if the script would implicitly apply |
sorry was absent for some work. well.. then... something like:
it is repetitive as much you want. I got rid of the replace flag which is now the 2nd value which can be optional. just don't ask me how this can be integrated into ENV :-) |
That's pretty cool! Thanks for implementing! docker run \
-e ROOT_PATH="/mnt/library" \n
-e API_URL=" http://localhost:2283/api" \n
-e API_KEY="<key>" \n
-e LOG_LEVEL="DEBUG" \n
-e ALBUM_LEVELS="2" \n
-e ALBUM_SEPARATOR="" \n
-e ALBUM_NAME_POST_REGEX1="[\d]+_|\d+\s\w{3}" \n
-e ALBUM_NAME_POST_REGEX2="'_' ' '" The YAML example for ---
services:
immich-folder-album-creator:
container_name: immich_folder_album_creator
image: salvoxia/immich-folder-album-creator:latest
restart: unless-stopped
environment:
API_URL: http://immich_server:2283/api
API_KEY: <key>
ROOT_PATH: /external_libs/photos
ALBUM_LEVELS: 2
ALBUM_SEPARATOR: ""
# backslashes must be escaped in YAML
ALBUM_NAME_POST_REGEX1: "[\\d]+_|\\d+\\s\\w{3}"
ALBUM_NAME_POST_REGEX2: "'_' ' '"
LOG_LEVEL: DEBUG
CRON_EXPRESSION: "0 * * * *"
TZ: Europe/Berlin The shell script that translates env variables to CLI arguments is set up to dynamically parse environment variables If you guys @ratti @Bierchermuesli think that's a feasible solution, I'll create a PR to @Bierchermuesli 's branch the PR is based on with the changes to |
sounds good. do bash loop over ALBUM_NAME_POST_REGEX* ENVs? |
That's what the script effectively does, but it's not that straight forwards. It lists all ENV variables, loops over them and performs regex matching with |
Hey very nice script, kudos for you!
I have a
YYYY\YYYYMMDD Some Album Name '95
folder structure.Not sure if I overlooked the documentation but I actually only want
Some Album Name '95
as album name.I think I could implement a simple regex flag for search replace in create_album_name function - or what do you suggest?
Thanks
The text was updated successfully, but these errors were encountered: