Remove SimpleInterfaces.cs to avoid duplicate class definitions

This commit is contained in:
MasterDraco 2025-03-12 22:08:13 +00:00
parent b11193795b
commit 6dff6103d9

View File

@ -1,183 +0,0 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
namespace TransmissionRssManager.Core
{
public class TorrentInfo
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
public double PercentDone { get; set; }
public long TotalSize { get; set; }
public string DownloadDir { get; set; } = string.Empty;
public bool IsFinished => PercentDone >= 1.0;
public DateTime? AddedDate { get; set; }
public DateTime? CompletedDate { get; set; }
public long DownloadedEver { get; set; }
public long UploadedEver { get; set; }
public int UploadRatio { get; set; }
public string ErrorString { get; set; } = string.Empty;
public bool IsError => !string.IsNullOrEmpty(ErrorString);
public int Priority { get; set; }
public string HashString { get; set; } = string.Empty;
public int PeersConnected { get; set; }
public double DownloadSpeed { get; set; }
public double UploadSpeed { get; set; }
public string Category { get; set; } = string.Empty;
public bool HasMetadata { get; set; }
public string TransmissionInstance { get; set; } = "default";
public string SourceFeedId { get; set; } = string.Empty;
public bool IsPostProcessed { get; set; }
}
public class AppConfig
{
public TransmissionConfig Transmission { get; set; } = new TransmissionConfig();
public Dictionary<string, TransmissionConfig> TransmissionInstances { get; set; } = new Dictionary<string, TransmissionConfig>();
public List<RssFeed> Feeds { get; set; } = new List<RssFeed>();
public bool AutoDownloadEnabled { get; set; }
public int CheckIntervalMinutes { get; set; } = 30;
public string DownloadDirectory { get; set; } = string.Empty;
public string MediaLibraryPath { get; set; } = string.Empty;
public PostProcessingConfig PostProcessing { get; set; } = new PostProcessingConfig();
public bool EnableDetailedLogging { get; set; } = false;
public UserPreferences UserPreferences { get; set; } = new UserPreferences();
}
public class TransmissionConfig
{
public string Host { get; set; } = "localhost";
public int Port { get; set; } = 9091;
public string Username { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public bool UseHttps { get; set; } = false;
public string Url => $"{(UseHttps ? "https" : "http")}://{Host}:{Port}/transmission/rpc";
}
public class RssFeed
{
public string Id { get; set; } = string.Empty;
public string Url { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public List<string> Rules { get; set; } = new List<string>();
public List<RssFeedRule> AdvancedRules { get; set; } = new List<RssFeedRule>();
public bool AutoDownload { get; set; }
public DateTime LastChecked { get; set; }
public string TransmissionInstanceId { get; set; } = "default";
public string Schedule { get; set; } = "*/30 * * * *"; // Default is every 30 minutes (cron expression)
public bool Enabled { get; set; } = true;
public int MaxHistoryItems { get; set; } = 100;
public string DefaultCategory { get; set; } = string.Empty;
public int ErrorCount { get; set; } = 0;
public DateTime? LastError { get; set; }
public string LastErrorMessage { get; set; } = string.Empty;
}
public class RssFeedRule
{
public string Id { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public string Pattern { get; set; } = string.Empty;
public bool IsRegex { get; set; } = false;
public bool IsEnabled { get; set; } = true;
public bool IsCaseSensitive { get; set; } = false;
public string Category { get; set; } = string.Empty;
public int Priority { get; set; } = 0;
public string Action { get; set; } = "download"; // download, notify, ignore
public string DestinationFolder { get; set; } = string.Empty;
}
public class PostProcessingConfig
{
public bool Enabled { get; set; } = false;
public bool ExtractArchives { get; set; } = true;
public bool OrganizeMedia { get; set; } = true;
public int MinimumSeedRatio { get; set; } = 1;
public List<string> MediaExtensions { get; set; } = new List<string> { ".mp4", ".mkv", ".avi" };
public bool AutoOrganizeByMediaType { get; set; } = true;
public bool RenameFiles { get; set; } = false;
public bool CompressCompletedFiles { get; set; } = false;
public int DeleteCompletedAfterDays { get; set; } = 0; // 0 = never delete
}
public class UserPreferences
{
public bool EnableDarkMode { get; set; } = false;
public bool AutoRefreshUIEnabled { get; set; } = true;
public int AutoRefreshIntervalSeconds { get; set; } = 30;
public bool NotificationsEnabled { get; set; } = true;
public List<string> NotificationEvents { get; set; } = new List<string>
{
"torrent-added",
"torrent-completed",
"torrent-error"
};
public string DefaultView { get; set; } = "dashboard";
public bool ConfirmBeforeDelete { get; set; } = true;
public int MaxItemsPerPage { get; set; } = 25;
public string DateTimeFormat { get; set; } = "yyyy-MM-dd HH:mm:ss";
public bool ShowCompletedTorrents { get; set; } = true;
public int KeepHistoryDays { get; set; } = 30;
}
public interface IConfigService
{
AppConfig GetConfiguration();
Task SaveConfigurationAsync(AppConfig config);
}
public interface ITransmissionClient
{
Task<List<TorrentInfo>> GetTorrentsAsync();
Task<int> AddTorrentAsync(string torrentUrl, string downloadDir);
Task RemoveTorrentAsync(int id, bool deleteLocalData);
Task StartTorrentAsync(int id);
Task StopTorrentAsync(int id);
}
public interface IRssFeedManager
{
Task<List<RssFeedItem>> GetAllItemsAsync();
Task<List<RssFeedItem>> GetMatchedItemsAsync();
Task<List<RssFeed>> GetFeedsAsync();
Task AddFeedAsync(RssFeed feed);
Task RemoveFeedAsync(string feedId);
Task UpdateFeedAsync(RssFeed feed);
Task RefreshFeedsAsync(CancellationToken cancellationToken);
Task RefreshFeedAsync(string feedId, CancellationToken cancellationToken);
Task MarkItemAsDownloadedAsync(string itemId);
}
public interface IPostProcessor
{
Task ProcessCompletedDownloadsAsync(CancellationToken cancellationToken);
Task ProcessTorrentAsync(TorrentInfo torrent);
}
public class RssFeedItem
{
public string Id { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public string Link { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public DateTime PublishDate { get; set; }
public string TorrentUrl { get; set; } = string.Empty;
public bool IsDownloaded { get; set; }
public bool IsMatched { get; set; }
public string MatchedRule { get; set; } = string.Empty;
public string FeedId { get; set; } = string.Empty;
public string Category { get; set; } = string.Empty;
public long Size { get; set; }
public string Author { get; set; } = string.Empty;
public List<string> Categories { get; set; } = new List<string>();
public Dictionary<string, string> AdditionalMetadata { get; set; } = new Dictionary<string, string>();
public DateTime? DownloadDate { get; set; }
public int? TorrentId { get; set; }
public string RejectionReason { get; set; } = string.Empty;
public bool IsRejected => !string.IsNullOrEmpty(RejectionReason);
}
}