Skip to content
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

Add "%r" placeholder to wrap parts of the path #1170

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Paullitsch
Copy link

@Paullitsch Paullitsch commented Dec 6, 2023

…be set recursively. #1123. e.g.: "\%G\%r%P – %T%r\%p – %C.html"

Closes #1123

…be set recursively. Tyrrrz#1123. e.g.: "\%G\%r%P – %T%r\%p – %C.html"
@CanePlayz
Copy link
Contributor

What would this placeholder do? I'm not sure I get the idea behind it...

@Paullitsch
Copy link
Author

Paullitsch commented Dec 6, 2023

Sorry - this lacks a little description.

The idea was to evaluate some parts of the export path-schema recursively (iterating through the parent channels).
See #1123 - here it was discussed that we can not use "%T" to put Threads into the same folder as the owner Channel.
With this recursive call you can achieve this now because the code will update the output path as the following:

Inital path pattern: \%G\%P – %T\%p – %C.html
updated path pattern: \%G\%r%P – %T%r\%p – %C.html

so on the first iteration will find the regex group: %P – %T
the value of the group will be forwarded again to "FormatPath" with the parent-channel as context - which than look like:
\%G\{Channel.Parent.Parent.Position} - {Channel.Parent.Parent.Name}\%p – %C.html

the updated path will than be used to replace the leftover placeholder values:
\{Guild.Name}\{Channel.Parent.Parent.Position} - {Channel.Parent.Parent.Name}\{Channel.Position} – {Channel.Name}.html

After looking through it today again this could be more optimized but i think the conceptional idea / solution is still fine

@CanePlayz
Copy link
Contributor

CanePlayz commented Dec 6, 2023

Thanks for the thorough explanation. It is certainly an interesting approach.

What I originally wanted to achieve was this:

Server name (folder)
|
|-- Category name 1 (folder)
      |
      |-- Channel name 1 (file)
      |
      |-- Channel name 2 (file)
      |
      |-- Channel name 1 (folder)
            |
            |-- Thread of channel 1 (file)

Or differently expressed: Would %r%P – %r%T result in
.../Category Pos – Category Name/Parent Channel Pos – Parent Channel Name/Thread.json for a thread?

Edit:

Just tested it now that it has been built, and I get it now. This puts the threads into the same folder as the parent channel with the thread having the same naming structure as its parent channel. Rather than creating another folder inside the same directory as that of the parent channel, which is what I had imagined in the initial issue and above.

It would after all still limit the options of how you can format the parent channel part since its structure would be inherited from the category structure, but I don't think that would be an issue as most people have these symmetrical approaches anyways.

@Tyrrrz Tyrrrz added the bug label Dec 7, 2023
nulldg added a commit to nulldg/DiscordChatExporterPlus that referenced this pull request Dec 10, 2023
@Tyrrrz Tyrrrz changed the title Added "%r" placeholder to wrap parts of the path. Wrapped parts will … Add "%r" placeholder to wrap parts of the path Dec 11, 2023
@Tyrrrz
Copy link
Owner

Tyrrrz commented Dec 28, 2023

@CanePlayz can you comment whether this PR fully addresses #1123, as reported by you?

@CanePlayz
Copy link
Contributor

This puts the threads into the same folder as the parent channel with the thread having the same naming structure as its parent channel. Rather than creating another folder inside the same directory as that of the parent channel, which is what I had imagined in the initial issue and above.

Unfortunately not. I guess it'd still be an enhancement, but:

This new method puts the thread files into the same folder as the parent channel files with the thread having the same naming structure as its parent channel. What I had imagined in the initial issue was creating another folder inside the same directory as that of the parent channel where all the threads would be stored (you can see that desired structure above).

@CanePlayz
Copy link
Contributor

CanePlayz commented Jan 23, 2024

However, a possible solution to this could be introducing new parameters that are thread-exclusive (meaning if the channel being processed is a normal one, they are just being ignored, but if the channel is a thread, they are indeed being resolved to for example the name of the parent channel or its position.

I should be able to code this myself, will update you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make template tokens work properly for export paths of threads
4 participants