Compare commits
4 Commits
77bd5f7ed9
...
40a7687606
| Author | SHA1 | Date | |
|---|---|---|---|
| 40a7687606 | |||
| ccb990675a | |||
| e22d2b63a2 | |||
| dce7e7a6bd |
@ -2082,6 +2082,7 @@ public class DownloadService(
|
||||
}
|
||||
|
||||
int oldCount = 0, newCount = 0;
|
||||
bool hasPaidPostMedia = false;
|
||||
|
||||
foreach (KeyValuePair<long, string> postKvp in post.SinglePosts)
|
||||
{
|
||||
@ -2089,11 +2090,23 @@ public class DownloadService(
|
||||
PostEntities.SinglePost? postInfo = mediaInfo == null
|
||||
? null
|
||||
: post.SinglePostObjects.FirstOrDefault(p => p.Media?.Contains(mediaInfo) == true);
|
||||
string filenameFormat = configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
||||
.PostFileNameFormat ?? "";
|
||||
string postPath = configService.CurrentConfig.FolderPerPost && postInfo != null && postInfo.Id != 0
|
||||
? $"/Posts/Free/{postInfo.Id} {postInfo.PostedAt:yyyy-MM-dd HH-mm-ss}"
|
||||
: "/Posts/Free";
|
||||
|
||||
bool isPaidPost = IsPaidSinglePost(postInfo);
|
||||
if (isPaidPost)
|
||||
{
|
||||
hasPaidPostMedia = true;
|
||||
}
|
||||
|
||||
string filenameFormat = hasPaidPostMedia
|
||||
? configService.CurrentConfig.GetCreatorFileNameFormatConfig(username).PaidPostFileNameFormat ?? ""
|
||||
: configService.CurrentConfig.GetCreatorFileNameFormatConfig(username).PostFileNameFormat ?? "";
|
||||
string postPath = hasPaidPostMedia
|
||||
? configService.CurrentConfig.FolderPerPaidPost && postInfo != null && postInfo.Id != 0
|
||||
? $"/Posts/Paid/{postInfo.Id} {postInfo.PostedAt:yyyy-MM-dd HH-mm-ss}"
|
||||
: "/Posts/Paid"
|
||||
: configService.CurrentConfig.FolderPerPost && postInfo != null && postInfo.Id != 0
|
||||
? $"/Posts/Free/{postInfo.Id} {postInfo.PostedAt:yyyy-MM-dd HH-mm-ss}"
|
||||
: "/Posts/Free";
|
||||
|
||||
bool isNew;
|
||||
if (postKvp.Value.Contains("cdn3.onlyfans.com/dash/files"))
|
||||
@ -2142,11 +2155,34 @@ public class DownloadService(
|
||||
TotalCount = post.SinglePosts.Count,
|
||||
NewDownloads = newCount,
|
||||
ExistingDownloads = oldCount,
|
||||
MediaType = "Posts",
|
||||
MediaType = hasPaidPostMedia ? "Paid Posts" : "Posts",
|
||||
Success = true
|
||||
};
|
||||
}
|
||||
|
||||
private static bool IsPaidSinglePost(PostEntities.SinglePost? postInfo)
|
||||
{
|
||||
if (postInfo == null || !postInfo.IsOpened)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(postInfo.Price))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string normalizedPrice = postInfo.Price.Trim();
|
||||
if (decimal.TryParse(normalizedPrice, NumberStyles.Any, CultureInfo.InvariantCulture, out decimal amount))
|
||||
{
|
||||
return amount > 0;
|
||||
}
|
||||
|
||||
return !string.Equals(normalizedPrice, "0", StringComparison.OrdinalIgnoreCase) &&
|
||||
!string.Equals(normalizedPrice, "0.0", StringComparison.OrdinalIgnoreCase) &&
|
||||
!string.Equals(normalizedPrice, "0.00", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Downloads a single paid message collection (including previews).
|
||||
/// </summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user