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

feat: Add the ability to define filename formats per creator #369

Merged
merged 2 commits into from
Jun 2, 2024

Conversation

ddirty830
Copy link
Contributor

@ddirty830 ddirty830 commented Jun 1, 2024

I found I kept swapping filename formats depending on who the creator was. So I made these changes.

{
"PaidPostFileNameFormat": "{postedAt}.{filename}",
"PostFileNameFormat": "{postedAt}.{filename}",
"PaidMessageFileNameFormat": "{createdAt}.{filename}",
"MessageFileNameFormat": "{createdAt}.{filename}",
"CreatorConfigs": {
  "creatorUserName1": {
    "PaidPostFileNameFormat": "{postedAt}.{rawText}",
    "PostFileNameFormat": "{postedAt}.{rawText}",
    "PaidMessageFileNameFormat": "{postedAt}.{rawText}",
    "MessageFileNameFormat": "{postedAt}.{rawText}"
  },
  "creatorUserName2": {
    "PaidPostFileNameFormat": "{postedAt}.{rawText}",
    "PostFileNameFormat": "{postedAt}.{rawText}",
    "PaidMessageFileNameFormat": "{postedAt}.{rawText}",
    "MessageFileNameFormat": "{postedAt}.{rawText}"
  }
}

If a creator isn't in the CreatorConfigs, or that creator doesn't have a format defined, it'll fall back to the root format.

@ddirty830
Copy link
Contributor Author

Did a quick rebase to capture the latest changes from master.

@@ -57,7 +59,8 @@ public async static Task Main(string[] args)
Console.Write("OF-DL requires Windows 10 or higher when being run on Windows. Your reported version is: {0}\n\n", os.VersionString);
Console.Write("Press any key to continue.\n");
Log.Error("Windows version prior to 10.x: {0}", os.VersionString);
if (!Config.NonInteractiveMode)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works before, becaue the Config always set NonInteractiveMode to False in the constructor before. If never really mattered what the Config's value was, because it hadn't been parsed yet.

@ddirty830
Copy link
Contributor Author

Some other changes I made:

  • I reworked a lot of the static members for Auth and Config, so they're instanced and passed to class constructors instead of grabbing globals.
  • I removed extraneous method parameters since the classes had access to Auth/Config directly now
  • Retooled the Config screen so if new options are added in the future, the new Property in the Config class just needs to be decorated with the [ToggleableConfig] to show up and be editable

@melithine
Copy link
Collaborator

I like this; I think it makes #341 moot, as I can just use this functionality to achieve the same goal.

@sim0n00ps sim0n00ps merged commit fd93562 into sim0n00ps:master Jun 2, 2024
@ddirty830 ddirty830 deleted the feat/per-creator-config branch June 2, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants