diff --git a/OF DL.Core/Services/DownloadService.cs b/OF DL.Core/Services/DownloadService.cs index a25d465..4051177 100644 --- a/OF DL.Core/Services/DownloadService.cs +++ b/OF DL.Core/Services/DownloadService.cs @@ -1,4 +1,3 @@ -using System.Diagnostics; using System.Globalization; using System.Security.Cryptography; using System.Text.RegularExpressions; @@ -2082,6 +2081,7 @@ public class DownloadService( } int oldCount = 0, newCount = 0; + bool hasPaidPostMedia = false; foreach (KeyValuePair postKvp in post.SinglePosts) { @@ -2089,11 +2089,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 +2154,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); + } + /// /// Downloads a single paid message collection (including previews). /// diff --git a/docs/installation/linux.md b/docs/installation/linux.md index faab242..123f973 100644 --- a/docs/installation/linux.md +++ b/docs/installation/linux.md @@ -1,4 +1,4 @@ -# Linux +# Linux A Linux release of OF-DL is not available at this time, however you can run OF-DL on Linux using Docker. Please refer to the [Docker](/installation/docker) page for instructions on how to run OF-DL in a Docker container. @@ -7,18 +7,17 @@ If you would like to run OF-DL natively on Linux, you can build it from source b ## Building from source -- Install the libicu library +- Install FFmpeg (and FFprobe) -```bash -sudo apt-get install libicu-dev -``` +Follow the installtion instructions from FFmpeg ([https://ffmpeg.org/download.html](https://ffmpeg.org/download.html)) for your distro (Ubuntu, Debian, Fedora, etc.) to install FFmpeg and FFprobe -- Install .NET version 8 +!!! warning -```bash - wget https://dot.net/v1/dotnet-install.sh - sudo bash dotnet-install.sh --architecture x64 --install-dir /usr/share/dotnet/ --runtime dotnet --version 8.0.7 -``` + Be sure to install FFmpeg version >= 6 and < 8. Other versions of FFmpeg may not decrypt DRM protected videos correctly. + +- Install .NET 10 + +Follow the installation instructions from Microsoft ([https://learn.microsoft.com/en-us/dotnet/core/install/linux](https://learn.microsoft.com/en-us/dotnet/core/install/linux)) for your distro (Ubuntu, Debian, Fedora, etc.) to install .NET 10. - Clone the repo @@ -27,15 +26,16 @@ git clone https://git.ofdl.tools/sim0n00ps/OF-DL.git cd 'OF-DL' ``` -- Build the project. Replace `%VERSION%` with the current version number of OF-DL (e.g. `1.7.68`). +- Build the project. Replace `%VERSION%` with the current version number of OF-DL (e.g. `1.9.20`). ```bash -dotnet publish -p:Version=%VERSION% -c Release -cd 'OF DL/bin/Release/net8.0' +dotnet publish "OF DL/OF DL.csproj" -p:Version=%VERSION% -p:PackageVersion=%VERSION% -c Release +cd 'OF DL/bin/Release/net10.0' ``` - Download the windows release as described on [here](/installation/windows#installation). -- Add the `config.json` and `rules.json` files as well as the `cdm` folder to the `OF DL/bin/Release/net8.0` folder. + +- Add the `config.conf` and `rules.json` files as well as the `cdm` folder to the `OF DL/bin/Release/net10.0` folder. - Run the application