Regex for tags and removal for "Unknown" values in file name

If there's a feature you think HDoujin is missing, share your ideas here!
Post Reply
Hunger4837
Posts: 9
Joined: Wed Jun 05, 2024 12:58 pm

Regex for tags and removal for "Unknown" values in file name

Post by Hunger4837 » Wed Jun 05, 2024 1:03 pm

Is it possible to get the same sort of regex editor that exists for the file name added to tags? Some tags I'm receiving seem to have the sites count for that tag existing and that really doesn't make sense to store in the metadata file.
Also not sure if I should create a different request for this, but in the file name if something comes back as unknown is it possible to not write that to the file name at all? Right now I'm using "[%ARTIST%] %TITLE% (%Magazine%)" for the file name, but if its not from a magazine I would like to not write any value for that part of the file name (and ideally not the parenthesis I have around it as well).

User avatar
Squidy
Site Admin
Posts: 1463
Joined: Fri Mar 10, 2017 9:28 pm
Contact:

Re: Regex for tags and removal for "Unknown" values in file name

Post by Squidy » Wed Jun 05, 2024 3:13 pm

Hunger4837 wrote:
Wed Jun 05, 2024 1:03 pm
Is it possible to get the same sort of regex editor that exists for the file name added to tags? Some tags I'm receiving seem to have the sites count for that tag existing and that really doesn't make sense to store in the metadata file.
What sites does this happen with? This was happening with HentaiNexus recently, but I uploaded a fix the other day. This is something I feel should be fixed at the module level instead of forcing the user to remove them with a regex.
Hunger4837 wrote:
Wed Jun 05, 2024 1:03 pm
Also not sure if I should create a different request for this, but in the file name if something comes back as unknown is it possible to not write that to the file name at all? Right now I'm using "[%ARTIST%] %TITLE% (%Magazine%)" for the file name, but if its not from a magazine I would like to not write any value for that part of the file name (and ideally not the parenthesis I have around it as well).
Something like this should work:

Code: Select all

[%artist%] %title% %if(%magazine%,"("%magazine%")")%
The if token can be used to check if a value is "unknown" or not. In this case, it checks if it has a value, and if it does, outputs the following argument ("("%magazine%")"). The quotes around the parentheses are just there to avoid confusing the parser and won't be in the output.
I'm the admin and developer of HDoujin Downloader.

Hunger4837
Posts: 9
Joined: Wed Jun 05, 2024 12:58 pm

Re: Regex for tags and removal for "Unknown" values in file name

Post by Hunger4837 » Wed Jun 05, 2024 6:39 pm

Yes it was specifically HentaiNexus and it appears I am using the latest version.

User avatar
Squidy
Site Admin
Posts: 1463
Joined: Fri Mar 10, 2017 9:28 pm
Contact:

Re: Regex for tags and removal for "Unknown" values in file name

Post by Squidy » Thu Jun 06, 2024 3:02 am

Did you add the URLs to the download queue prior to the fix? Metadata is extracted as soon as a URL is added, so if it already has malformed tags they'll remain that way.

You can can re-add the URLs, effectively refreshing their metadata, by selecting everything, right-clicking, and going to Remove > Remove and enqueue again. I would copy the URLs first just in case any of them fail to be added again (Ctrl+C).
I'm the admin and developer of HDoujin Downloader.

Hunger4837
Posts: 9
Joined: Wed Jun 05, 2024 12:58 pm

Re: Regex for tags and removal for "Unknown" values in file name

Post by Hunger4837 » Thu Jun 06, 2024 2:54 pm

Nope I didnt know that was the workflow, I have done so now. I have noticed thought that %convention% does not appear to show for hentainexus, it looks like they use event for that on the page. Is there a different flag I should be using? This is what Im trying to do with the file name, (Im trying to match a quasi e-hentai naming convention):
%if(%convention%,"("%convention%") ")%[%if(%circle%,""%circle%" (")%%artist%%if(%circle%,")")%] %title%%if(%magazine%," ("%magazine%")")%

User avatar
Squidy
Site Admin
Posts: 1463
Joined: Fri Mar 10, 2017 9:28 pm
Contact:

Re: Regex for tags and removal for "Unknown" values in file name

Post by Squidy » Fri Jun 07, 2024 2:36 am

That's the right token to use. I actually hadn't added support for convention metadata to the Lua API, which is used to implement the HentaiNexus module.

I'll do that-- Expect it to be working with the program update, which I hope to have available soon. I'm sorry for the wait!
I'm the admin and developer of HDoujin Downloader.

Hunger4837
Posts: 9
Joined: Wed Jun 05, 2024 12:58 pm

Re: Regex for tags and removal for "Unknown" values in file name

Post by Hunger4837 » Fri Jun 07, 2024 11:21 am

No worries, Im new to using the program and you have been very helpful. Thanks

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests