Skip to content

Commit

Permalink
Merge pull request #369 from ddirty830/feat/per-creator-config
Browse files Browse the repository at this point in the history
feat: Add the ability to define filename formats per creator
  • Loading branch information
sim0n00ps authored Jun 2, 2024
2 parents 0d9ea37 + d3bf32e commit fd93562
Show file tree
Hide file tree
Showing 12 changed files with 731 additions and 595 deletions.
40 changes: 38 additions & 2 deletions OF DL/Entities/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,61 @@

namespace OF_DL.Entities
{
public class Config

public class Config : IDownloadConfig, IFileNameFormatConfig
{
[ToggleableConfig]
public bool DownloadAvatarHeaderPhoto { get; set; }
[ToggleableConfig]
public bool DownloadPaidPosts { get; set; }
[ToggleableConfig]
public bool DownloadPosts { get; set; }
[ToggleableConfig]
public bool DownloadArchived { get; set; }
[ToggleableConfig]
public bool DownloadStreams { get; set; }
[ToggleableConfig]
public bool DownloadStories { get; set; }
[ToggleableConfig]
public bool DownloadHighlights { get; set; }
[ToggleableConfig]
public bool DownloadMessages { get; set; }
[ToggleableConfig]
public bool DownloadPaidMessages { get; set; }
[ToggleableConfig]
public bool DownloadImages { get; set; }
[ToggleableConfig]
public bool DownloadVideos { get; set; }
[ToggleableConfig]
public bool DownloadAudios { get; set; }
[ToggleableConfig]
public bool IncludeExpiredSubscriptions { get; set; }
[ToggleableConfig]
public bool IncludeRestrictedSubscriptions { get; set; }
[ToggleableConfig]
public bool SkipAds { get; set; } = false;
public string? DownloadPath { get; set; } = string.Empty;
public string? PaidPostFileNameFormat { get; set; } = string.Empty;
public string? PostFileNameFormat { get; set; } = string.Empty;
public string? PaidMessageFileNameFormat { get; set; } = string.Empty;
public string? MessageFileNameFormat { get; set; } = string.Empty;
[ToggleableConfig]
public bool RenameExistingFilesWhenCustomFormatIsSelected { get; set; } = false;
public int? Timeout { get; set; } = -1;
[ToggleableConfig]
public bool FolderPerPaidPost { get; set; } = false;
[ToggleableConfig]
public bool FolderPerPost { get; set; } = false;
[ToggleableConfig]
public bool FolderPerPaidMessage { get; set; } = false;
[ToggleableConfig]
public bool FolderPerMessage { get; set; } = false;
[ToggleableConfig]
public bool LimitDownloadRate { get; set; } = false;
public int DownloadLimitInMbPerSec { get; set; } = 4;

// Indicates if you want to download only on specific dates.
[ToggleableConfig]
public bool DownloadOnlySpecificDates { get; set; } = false;

// This enum will define if we want data from before or after the CustomDate.
Expand All @@ -46,14 +69,27 @@ public class Config
[JsonConverter(typeof(ShortDateConverter))]
public DateTime? CustomDate { get; set; } = null;

[ToggleableConfig]
public bool ShowScrapeSize { get; set; } = true;

[ToggleableConfig]
public bool DownloadPostsIncrementally { get; set; } = false;
public bool NonInteractiveMode { get; set; } = false;

public bool NonInteractiveMode { get; set; } = false;
public string NonInteractiveModeListName { get; set; } = string.Empty;
[ToggleableConfig]
public bool NonInteractiveModePurchasedTab { get; set; } = false;
public string? FFmpegPath { get; set; } = string.Empty;

public Dictionary<string, CreatorConfig> CreatorConfigs { get; set; } = new Dictionary<string, CreatorConfig>();
}

public class CreatorConfig : IFileNameFormatConfig
{
public string? PaidPostFileNameFormat { get; set; }
public string? PostFileNameFormat { get; set; }
public string? PaidMessageFileNameFormat { get; set; }
public string? MessageFileNameFormat { get; set; }
}

}
11 changes: 11 additions & 0 deletions OF DL/Entities/FileNameFormatConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace OF_DL.Entities
{
public class FileNameFormatConfig : IFileNameFormatConfig
{
public string? PaidPostFileNameFormat { get; set; }
public string? PostFileNameFormat { get; set; }
public string? PaidMessageFileNameFormat { get; set; }
public string? MessageFileNameFormat { get; set; }
}

}
48 changes: 48 additions & 0 deletions OF DL/Entities/IDownloadConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using OF_DL.Enumerations;

namespace OF_DL.Entities
{
public interface IDownloadConfig
{
bool DownloadAvatarHeaderPhoto { get; set; }
bool DownloadPaidPosts { get; set; }
bool DownloadPosts { get; set; }
bool DownloadArchived { get; set; }
bool DownloadStreams { get; set; }
bool DownloadStories { get; set; }
bool DownloadHighlights { get; set; }
bool DownloadMessages { get; set; }
bool DownloadPaidMessages { get; set; }
bool DownloadImages { get; set; }
bool DownloadVideos { get; set; }
bool DownloadAudios { get; set; }

int? Timeout { get; set; }
bool FolderPerPaidPost { get; set; }
bool FolderPerPost { get; set; }
bool FolderPerPaidMessage { get; set; }
bool FolderPerMessage { get; set; }

bool RenameExistingFilesWhenCustomFormatIsSelected { get; set; }
bool ShowScrapeSize { get; set; }
bool LimitDownloadRate { get; set; }
int DownloadLimitInMbPerSec { get; set; }
string? FFmpegPath { get; set; }

bool SkipAds { get; set; }

#region Download Date Configurations

bool DownloadOnlySpecificDates { get; set; }

// This enum will define if we want data from before or after the CustomDate.
DownloadDateSelection DownloadDateSelection { get; set; }

// This is the specific date used in combination with the above enum.
DateTime? CustomDate { get; set; }
#endregion

bool DownloadPostsIncrementally { get; set; }
}

}
11 changes: 11 additions & 0 deletions OF DL/Entities/IFileNameFormatConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace OF_DL.Entities
{
public interface IFileNameFormatConfig
{
string? PaidPostFileNameFormat { get; set; }
string? PostFileNameFormat { get; set; }
string? PaidMessageFileNameFormat { get; set; }
string? MessageFileNameFormat { get; set; }
}

}
8 changes: 8 additions & 0 deletions OF DL/Entities/ToggleableConfigAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace OF_DL.Entities
{
[AttributeUsage(AttributeTargets.Property)]
internal class ToggleableConfigAttribute : Attribute
{
}

}
Loading

0 comments on commit fd93562

Please sign in to comment.