From 75dfe74bd11b66f49f3a4e82222444cc51c3f6f1 Mon Sep 17 00:00:00 2001 From: Brad Culwell Date: Sun, 9 Jun 2024 05:41:55 -0500 Subject: [PATCH] revert: revert use of transmission-rpc fork --- Cargo.lock | 253 ++++++++++++++++------------------- Cargo.toml | 10 +- default.nix | 17 ++- src/client.rs | 8 +- src/client/qbit.rs | 2 +- src/client/transmission.rs | 12 +- src/source.rs | 13 ++ src/source/nyaa_html.rs | 34 ++--- src/source/sukebei_nyaa.rs | 14 +- src/source/torrent_galaxy.rs | 74 +++++----- src/theme.rs | 28 +--- src/widget.rs | 3 +- 12 files changed, 233 insertions(+), 235 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 643a5cb..4a7cc4f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -165,6 +165,12 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "base64" version = "0.22.1" @@ -293,7 +299,6 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", - "serde", "wasm-bindgen", "windows-targets 0.52.4", ] @@ -380,6 +385,16 @@ dependencies = [ "url", ] +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.6" @@ -945,6 +960,25 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "half" version = "2.4.1" @@ -1008,9 +1042,9 @@ dependencies = [ [[package]] name = "http" -version = "1.1.0" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes", "fnv", @@ -1019,24 +1053,12 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" -dependencies = [ - "bytes", - "http", -] - -[[package]] -name = "http-body-util" -version = "0.1.1" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "futures-core", "http", - "http-body", "pin-project-lite", ] @@ -1046,6 +1068,12 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + [[package]] name = "human_bytes" version = "0.4.3" @@ -1054,58 +1082,40 @@ checksum = "91f255a4535024abf7640cb288260811fc14794f62b063652ed349f9a6c2348e" [[package]] name = "hyper" -version = "1.3.1" +version = "0.14.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +checksum = "f361cde2f109281a220d4307746cdfd5ee3f410da58a70377762396775634b33" dependencies = [ "bytes", "futures-channel", + "futures-core", "futures-util", + "h2", "http", "http-body", "httparse", + "httpdate", "itoa", "pin-project-lite", - "smallvec", + "socket2", "tokio", + "tower-service", + "tracing", "want", ] [[package]] name = "hyper-rustls" -version = "0.26.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http", "hyper", - "hyper-util", "rustls", - "rustls-pki-types", "tokio", "tokio-rustls", - "tower-service", -] - -[[package]] -name = "hyper-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "hyper", - "pin-project-lite", - "socket2", - "tokio", - "tower", - "tower-service", - "tracing", ] [[package]] @@ -1794,26 +1804,6 @@ dependencies = [ "siphasher", ] -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.52", -] - [[package]] name = "pin-project-lite" version = "0.2.13" @@ -2007,7 +1997,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07d1ed81eabd67488a23fd502b770dc09106918d32ec1746cd20ccc7dd46937f" dependencies = [ - "base64", + "base64 0.22.1", "dyn-clone", "icy_sixel", "image", @@ -2137,23 +2127,23 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.12.4" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "async-compression", - "base64", + "base64 0.21.7", "bytes", "cookie", "cookie_store", + "encoding_rs", "futures-core", "futures-util", + "h2", "http", "http-body", - "http-body-util", "hyper", "hyper-rustls", - "hyper-util", "ipnet", "js-sys", "log", @@ -2163,11 +2153,11 @@ dependencies = [ "pin-project-lite", "rustls", "rustls-pemfile", - "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", + "system-configuration", "tokio", "tokio-rustls", "tokio-socks", @@ -2238,42 +2228,32 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.4" +version = "0.21.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", "ring", - "rustls-pki-types", "rustls-webpki", - "subtle", - "zeroize", + "sct", ] [[package]] name = "rustls-pemfile" -version = "2.1.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64", - "rustls-pki-types", + "base64 0.21.7", ] -[[package]] -name = "rustls-pki-types" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" - [[package]] name = "rustls-webpki" -version = "0.102.4" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ "ring", - "rustls-pki-types", "untrusted", ] @@ -2311,6 +2291,16 @@ dependencies = [ "tendril", ] +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "selectors" version = "0.25.0" @@ -2462,6 +2452,15 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.13.1" @@ -2581,12 +2580,6 @@ dependencies = [ "syn 2.0.52", ] -[[package]] -name = "subtle" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" - [[package]] name = "syn" version = "1.0.109" @@ -2615,6 +2608,27 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "system-deps" version = "6.2.2" @@ -2775,12 +2789,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.25.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ "rustls", - "rustls-pki-types", "tokio", ] @@ -2843,27 +2856,6 @@ dependencies = [ "winnow", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" - [[package]] name = "tower-service" version = "0.3.2" @@ -2892,9 +2884,9 @@ dependencies = [ [[package]] name = "transmission-rpc" version = "0.4.2" -source = "git+https://github.com/Beastwick18/transmission-rpc?branch=stable#f120048a058be2f45aaaf45f2d43f75c6f6ec674" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbec9f959829f5f2088246adbca5f1d36120cb173cdb20ed86dcfdd58659ff8" dependencies = [ - "chrono", "enum-iterator", "log", "reqwest", @@ -3175,12 +3167,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.2" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c452ad30530b54a4d8e71952716a212b08efd0f3562baa66c29a618b07da7c3" -dependencies = [ - "rustls-pki-types", -] +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "weezl" @@ -3371,9 +3360,9 @@ dependencies = [ [[package]] name = "winreg" -version = "0.52.0" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ "cfg-if", "windows-sys 0.48.0", @@ -3454,12 +3443,6 @@ dependencies = [ "syn 2.0.52", ] -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" - [[package]] name = "zune-core" version = "0.4.12" diff --git a/Cargo.toml b/Cargo.toml index 894d109..2d87681 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,13 @@ strip = true lto = true [dependencies] -reqwest = { version = "0.12.4", features = [ +# reqwest2 = { package = "reqwest", version = "0.11.27", features = [ +# "gzip", +# "rustls-tls", +# "socks", +# "cookies", +# ], default-features = false } +reqwest = { version = "0.11.27", features = [ "gzip", "rustls-tls", "socks", @@ -36,7 +42,7 @@ scraper = "0.19.0" regex = "1.10.4" rss = "2.0.8" chrono = "0.4.38" -transmission-rpc = { git = "https://github.com/Beastwick18/transmission-rpc", branch = "stable" } +transmission-rpc = { version = "0.4.2" } open = "5.1.4" cli-clipboard = "0.4.0" dirs = "5.0.1" diff --git a/default.nix b/default.nix index e6c8f14..23c5af3 100644 --- a/default.nix +++ b/default.nix @@ -1,12 +1,15 @@ {pkgs ? import {}}: pkgs.rustPlatform.buildRustPackage rec { pname = "nyaa"; - version = "0.1"; - cargoLock = { - lockFile = ./Cargo.lock; - outputHashes = { - "transmission-rpc-0.4.2" = "sha256-3na/LUlcCk1MTbFXMtugK8YiLMdwF3m8QnpSKl3B4I8="; - }; - }; + version = "0.9.0"; + + # src = fetchFromGitHub { + # owner = "Beastwick18"; + # repo = "nyaa"; + # rev = "v${version}"; + # hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; + # }; + + cargoLock.lockFile = ./Cargo.lock; src = pkgs.lib.cleanSource ./.; } diff --git a/src/client.rs b/src/client.rs index 145188e..d429d85 100644 --- a/src/client.rs +++ b/src/client.rs @@ -81,7 +81,7 @@ pub enum Client { #[strum(serialize = "qBittorrent")] Qbit = 0, - #[serde(rename = "transmission")] + #[serde(rename = "Transmission")] #[strum(serialize = "Transmission")] Transmission = 1, @@ -89,15 +89,15 @@ pub enum Client { #[strum(serialize = "rqbit")] Rqbit = 2, - #[serde(rename = "default_app")] + #[serde(rename = "DefaultApp")] #[strum(serialize = "Default App")] DefaultApp = 3, - #[serde(rename = "download")] + #[serde(rename = "DownloadTorrentFile")] #[strum(serialize = "Download Torrent File")] Download = 4, - #[serde(rename = "command")] + #[serde(rename = "RunCommand")] #[strum(serialize = "Run Command")] Cmd = 5, } diff --git a/src/client/qbit.rs b/src/client/qbit.rs index c30d19f..fc09547 100644 --- a/src/client/qbit.rs +++ b/src/client/qbit.rs @@ -19,7 +19,7 @@ pub struct QbitConfig { pub use_magnet: Option, pub savepath: Option, pub category: Option, // Single category - pub tags: Option>, // Comma seperated joined + pub tags: Option>, // Comma separated joined pub skip_checking: Option, pub paused: Option, pub create_root_folder: Option, // root_folder: String diff --git a/src/client/transmission.rs b/src/client/transmission.rs index f16bb25..d041da9 100644 --- a/src/client/transmission.rs +++ b/src/client/transmission.rs @@ -1,7 +1,7 @@ use reqwest::Url; use serde::{Deserialize, Serialize}; use transmission_rpc::{ - types::{BasicAuth, Priority, TorrentAddArgs}, + types::{BasicAuth, TorrentAddArgs}, TransClient, }; @@ -9,6 +9,14 @@ use crate::{app::Context, source::Item, util::conv::add_protocol}; use super::{multidownload, ClientConfig, DownloadClient, DownloadError, DownloadResult}; +#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i8)] +pub enum Priority { + Low = -1, + Normal = 0, + High = 1, +} + #[derive(Serialize, Deserialize, Clone)] #[serde(default)] pub struct TransmissionConfig { @@ -49,7 +57,7 @@ impl TransmissionConfig { paused: self.paused, peer_limit: self.peer_limit, download_dir: self.download_dir.to_owned(), - bandwidth_priority: self.bandwidth_priority, + bandwidth_priority: self.bandwidth_priority.map(|r| r as i64), ..Default::default() } } diff --git a/src/source.rs b/src/source.rs index 151dca4..2d10c30 100644 --- a/src/source.rs +++ b/src/source.rs @@ -1,8 +1,11 @@ use std::{collections::HashMap, error::Error, sync::Arc, time::Duration}; +use nyaa_html::NyaaTheme; use reqwest::{cookie::Jar, Proxy}; use serde::{Deserialize, Serialize}; use strum::{Display, VariantArray}; +use sukebei_nyaa::SukebeiTheme; +use torrent_galaxy::TgxTheme; use crate::{ app::{Context, LoadType, Widgets}, @@ -44,6 +47,16 @@ pub enum SourceResponse { Captcha(Box), } +#[derive(Serialize, Deserialize, Clone, Copy, Default)] +pub struct SourceTheme { + #[serde(default)] + pub nyaa: NyaaTheme, + #[serde(default)] + pub sukebei: SukebeiTheme, + #[serde(default, rename = "torrentgalaxy")] + pub tgx: TgxTheme, +} + #[derive(Serialize, Deserialize, Clone, Default)] #[serde(default)] pub struct SourceConfig { diff --git a/src/source/nyaa_html.rs b/src/source/nyaa_html.rs index 827b490..d858f93 100644 --- a/src/source/nyaa_html.rs +++ b/src/source/nyaa_html.rs @@ -474,38 +474,38 @@ impl Source for NyaaHtmlSource { } "Anime" => { 10 => ("Ani", "All Anime", "AllAnime", fg); - 12 => ("Sub", "English Translated", "AnimeEnglishTranslated", nyaa.cat.anime_english_translated); - 13 => ("Sub", "Non-English Translated", "AnimeNonEnglishTranslated", nyaa.cat.anime_non_english_translated); - 14 => ("Raw", "Raw", "AnimeRaw", nyaa.cat.anime_raw); - 11 => ("AMV", "Anime Music Video", "AnimeMusicVideo", nyaa.cat.anime_music_video); + 12 => ("Sub", "English Translated", "AnimeEnglishTranslated", source.nyaa.cat.anime_english_translated); + 13 => ("Sub", "Non-English Translated", "AnimeNonEnglishTranslated", source.nyaa.cat.anime_non_english_translated); + 14 => ("Raw", "Raw", "AnimeRaw", source.nyaa.cat.anime_raw); + 11 => ("AMV", "Anime Music Video", "AnimeMusicVideo", source.nyaa.cat.anime_music_video); } "Audio" => { 20 => ("Aud", "All Audio", "AllAudio", fg); - 21 => ("Aud", "Lossless", "AudioLossless", nyaa.cat.audio_lossless); - 22 => ("Aud", "Lossy", "AudioLossy", nyaa.cat.audio_lossy); + 21 => ("Aud", "Lossless", "AudioLossless", source.nyaa.cat.audio_lossless); + 22 => ("Aud", "Lossy", "AudioLossy", source.nyaa.cat.audio_lossy); } "Literature" => { 30 => ("Lit", "All Literature", "AllLiterature", fg); - 31 => ("Lit", "English Translated", "LitEnglishTranslated", nyaa.cat.literature_english_translated); - 32 => ("Lit", "Non-English Translated", "LitNonEnglishTranslated", nyaa.cat.literature_non_english_translated); - 33 => ("Lit", "Raw", "LitRaw", nyaa.cat.literature_raw); + 31 => ("Lit", "English Translated", "LitEnglishTranslated", source.nyaa.cat.literature_english_translated); + 32 => ("Lit", "Non-English Translated", "LitNonEnglishTranslated", source.nyaa.cat.literature_non_english_translated); + 33 => ("Lit", "Raw", "LitRaw", source.nyaa.cat.literature_raw); } "Live Action" => { 40 => ("Liv", "All Live Action", "AllLiveAction", fg); - 41 => ("Liv", "English Translated", "LiveEnglishTranslated", nyaa.cat.live_english_translated); - 43 => ("Liv", "Non-English Translated", "LiveNonEnglishTranslated", nyaa.cat.live_non_english_translated); - 42 => ("Liv", "Idol/Promo Video", "LiveIdolPromoVideo", nyaa.cat.live_idol_promo_video); - 44 => ("Liv", "Raw", "LiveRaw", nyaa.cat.live_raw); + 41 => ("Liv", "English Translated", "LiveEnglishTranslated", source.nyaa.cat.live_english_translated); + 43 => ("Liv", "Non-English Translated", "LiveNonEnglishTranslated", source.nyaa.cat.live_non_english_translated); + 42 => ("Liv", "Idol/Promo Video", "LiveIdolPromoVideo", source.nyaa.cat.live_idol_promo_video); + 44 => ("Liv", "Raw", "LiveRaw", source.nyaa.cat.live_raw); } "Pictures" => { 50 => ("Pic", "All Pictures", "AllPictures", fg); - 51 => ("Pic", "Graphics", "PicGraphics", nyaa.cat.picture_graphics); - 52 => ("Pic", "Photos", "PicPhotos", nyaa.cat.picture_photos); + 51 => ("Pic", "Graphics", "PicGraphics", source.nyaa.cat.picture_graphics); + 52 => ("Pic", "Photos", "PicPhotos", source.nyaa.cat.picture_photos); } "Software" => { 60 => ("Sof", "All Software", "AllSoftware", fg); - 61 => ("Sof", "Applications", "SoftApplications", nyaa.cat.software_applications); - 62 => ("Sof", "Games", "SoftGames", nyaa.cat.software_games); + 61 => ("Sof", "Applications", "SoftApplications", source.nyaa.cat.software_applications); + 62 => ("Sof", "Games", "SoftGames", source.nyaa.cat.software_games); } }; SourceInfo { diff --git a/src/source/sukebei_nyaa.rs b/src/source/sukebei_nyaa.rs index 187928b..2971be0 100644 --- a/src/source/sukebei_nyaa.rs +++ b/src/source/sukebei_nyaa.rs @@ -308,16 +308,16 @@ impl Source for SukebeiHtmlSource { } "Art" => { 10 => ("Art", "All Art", "AllArt", fg); - 11 => ("Ani", "Anime", "ArtAnime", sukebei.cat.art_anime); - 12 => ("Dou", "Doujinshi", "ArtDoujinshi", sukebei.cat.art_doujinshi); - 13 => ("Gam", "Games", "ArtGames", sukebei.cat.art_games); - 14 => ("Man", "Manga", "ArtManga", sukebei.cat.art_manga); - 15 => ("Pic", "Pictures", "ArtPictures", sukebei.cat.art_pictures); + 11 => ("Ani", "Anime", "ArtAnime", source.sukebei.cat.art_anime); + 12 => ("Dou", "Doujinshi", "ArtDoujinshi", source.sukebei.cat.art_doujinshi); + 13 => ("Gam", "Games", "ArtGames", source.sukebei.cat.art_games); + 14 => ("Man", "Manga", "ArtManga", source.sukebei.cat.art_manga); + 15 => ("Pic", "Pictures", "ArtPictures", source.sukebei.cat.art_pictures); } "Real Life" => { 20 => ("Rea", "All Real Life", "AllReal", fg); - 21 => ("Pho", "Photobooks and Pictures", "RealPhotos", sukebei.cat.real_photos); - 22 => ("Vid", "Videos", "RealVideos", sukebei.cat.real_videos); + 21 => ("Pho", "Photobooks and Pictures", "RealPhotos", source.sukebei.cat.real_photos); + 22 => ("Vid", "Videos", "RealVideos", source.sukebei.cat.real_videos); } }; SourceInfo { diff --git a/src/source/torrent_galaxy.rs b/src/source/torrent_galaxy.rs index 4304364..fadb410 100644 --- a/src/source/torrent_galaxy.rs +++ b/src/source/torrent_galaxy.rs @@ -649,43 +649,43 @@ impl Source for TorrentGalaxyHtmlSource { fn info() -> SourceInfo { let cats = cats! { - "All Categories" => { 0 => ("---", "All Categories", "AllCategories", tgx.cat.all_categories); } - "Movies" => {3 => ("4kM", "4K UHD Movies", "4kMovies", tgx.cat.movies_4k); - 46 => ("Bly", "Bollywood", "Bollywood Movies", tgx.cat.movies_bollywood); - 45 => ("Cam", "Cam/TS", "CamMovies", tgx.cat.movies_cam); - 42 => ("HdM", "HD Movies", "HdMovies", tgx.cat.movies_hd); - 4 => ("PkM", "Movie Packs", "PackMovies", tgx.cat.movies_pack); - 1 => ("SdM", "SD Movies", "SdMovies", tgx.cat.movies_sd);} - "TV" => {41 => ("HdT", "TV HD", "HdTV", tgx.cat.tv_hd); - 5 => ("SdT", "TV SD", "SdTV", tgx.cat.tv_sd); - 11 => ("4kT", "TV 4k", "4kTV", tgx.cat.tv_4k); - 6 => ("PkT", "TV Packs", "PacksTV", tgx.cat.tv_pack); - 7 => ("Spo", "Sports", "SportsTV", tgx.cat.tv_sports);} - "Anime" => {28 => ("Ani", "All Anime", "Anime", tgx.cat.anime);} - "Apps" => {20 => ("Mob", "Mobile Apps", "AppsMobile", tgx.cat.apps_mobile); - 21 => ("App", "Other Apps", "AppsOther", tgx.cat.apps_other); - 18 => ("Win", "Windows Apps", "AppsWindows", tgx.cat.apps_windows);} - "Books" => {13 => ("Abk", "Audiobooks", "Audiobooks", tgx.cat.audiobooks); - 19 => ("Com", "Comics", "Comics", tgx.cat.comics); - 12 => ("Ebk", "Ebooks", "Ebooks", tgx.cat.ebooks); - 14 => ("Edu", "Educational", "Educational", tgx.cat.educational); - 15 => ("Mag", "Magazines", "Magazines", tgx.cat.magazines);} - "Documentaries" => {9 => ("Doc", "All Documentaries", "Documentaries", tgx.cat.documentaries);} - "Games" => {10 => ("Wgm", "Windows Games", "WindowsGames", tgx.cat.games_windows); - 43 => ("Ogm", "Other Games", "OtherGames", tgx.cat.games_other);} - "Music" => {22 => ("Alb", "Music Albums", "AlbumsMusic", tgx.cat.music_albums); - 26 => ("Dis", "Music Discography", "DiscographyMusic", tgx.cat.music_discography); - 23 => ("Los", "Music Lossless", "LosslessMusic", tgx.cat.music_lossless); - 25 => ("MV ", "Music Video", "MusicVideo", tgx.cat.music_video); - 24 => ("Sin", "Music Singles", "SinglesMusic", tgx.cat.music_singles);} - "Other" => {17 => ("Aud", "Other Audio", "AudioOther", tgx.cat.audio_other); - 40 => ("Pic", "Other Pictures", "PicturesOther", tgx.cat.pictures_other); - 37 => ("Tra", "Other Training", "TrainingOther", tgx.cat.training_other); - 33 => ("Oth", "Other", "Other", tgx.cat.other);} - "XXX" => {48 => ("4kX", "XXX 4k", "4kXXX", tgx.cat.xxx_4k); - 35 => ("HdX", "XXX HD", "HdXXX", tgx.cat.xxx_hd); - 47 => ("MsX", "XXX Misc", "MiscXXX", tgx.cat.xxx_misc); - 34 => ("SdX", "XXX SD", "SdXXX", tgx.cat.xxx_sd);} + "All Categories" => { 0 => ("---", "All Categories", "AllCategories", source.tgx.cat.all_categories); } + "Movies" => {3 => ("4kM", "4K UHD Movies", "4kMovies", source.tgx.cat.movies_4k); + 46 => ("Bly", "Bollywood", "Bollywood Movies", source.tgx.cat.movies_bollywood); + 45 => ("Cam", "Cam/TS", "CamMovies", source.tgx.cat.movies_cam); + 42 => ("HdM", "HD Movies", "HdMovies", source.tgx.cat.movies_hd); + 4 => ("PkM", "Movie Packs", "PackMovies", source.tgx.cat.movies_pack); + 1 => ("SdM", "SD Movies", "SdMovies", source.tgx.cat.movies_sd);} + "TV" => {41 => ("HdT", "TV HD", "HdTV", source.tgx.cat.tv_hd); + 5 => ("SdT", "TV SD", "SdTV", source.tgx.cat.tv_sd); + 11 => ("4kT", "TV 4k", "4kTV", source.tgx.cat.tv_4k); + 6 => ("PkT", "TV Packs", "PacksTV", source.tgx.cat.tv_pack); + 7 => ("Spo", "Sports", "SportsTV", source.tgx.cat.tv_sports);} + "Anime" => {28 => ("Ani", "All Anime", "Anime", source.tgx.cat.anime);} + "Apps" => {20 => ("Mob", "Mobile Apps", "AppsMobile", source.tgx.cat.apps_mobile); + 21 => ("App", "Other Apps", "AppsOther", source.tgx.cat.apps_other); + 18 => ("Win", "Windows Apps", "AppsWindows", source.tgx.cat.apps_windows);} + "Books" => {13 => ("Abk", "Audiobooks", "Audiobooks", source.tgx.cat.audiobooks); + 19 => ("Com", "Comics", "Comics", source.tgx.cat.comics); + 12 => ("Ebk", "Ebooks", "Ebooks", source.tgx.cat.ebooks); + 14 => ("Edu", "Educational", "Educational", source.tgx.cat.educational); + 15 => ("Mag", "Magazines", "Magazines", source.tgx.cat.magazines);} + "Documentaries" => {9 => ("Doc", "All Documentaries", "Documentaries", source.tgx.cat.documentaries);} + "Games" => {10 => ("Wgm", "Windows Games", "WindowsGames", source.tgx.cat.games_windows); + 43 => ("Ogm", "Other Games", "OtherGames", source.tgx.cat.games_other);} + "Music" => {22 => ("Alb", "Music Albums", "AlbumsMusic", source.tgx.cat.music_albums); + 26 => ("Dis", "Music Discography", "DiscographyMusic", source.tgx.cat.music_discography); + 23 => ("Los", "Music Lossless", "LosslessMusic", source.tgx.cat.music_lossless); + 25 => ("MV ", "Music Video", "MusicVideo", source.tgx.cat.music_video); + 24 => ("Sin", "Music Singles", "SinglesMusic", source.tgx.cat.music_singles);} + "Other" => {17 => ("Aud", "Other Audio", "AudioOther", source.tgx.cat.audio_other); + 40 => ("Pic", "Other Pictures", "PicturesOther", source.tgx.cat.pictures_other); + 37 => ("Tra", "Other Training", "TrainingOther", source.tgx.cat.training_other); + 33 => ("Oth", "Other", "Other", source.tgx.cat.other);} + "XXX" => {48 => ("4kX", "XXX 4k", "4kXXX", source.tgx.cat.xxx_4k); + 35 => ("HdX", "XXX HD", "HdXXX", source.tgx.cat.xxx_hd); + 47 => ("MsX", "XXX Misc", "MiscXXX", source.tgx.cat.xxx_misc); + 34 => ("SdX", "XXX SD", "SdXXX", source.tgx.cat.xxx_sd);} }; SourceInfo { cats, diff --git a/src/theme.rs b/src/theme.rs index 3fec527..3f340c4 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -8,11 +8,7 @@ use indexmap::IndexMap; use ratatui::{style::Color, widgets::BorderType}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use crate::{ - app::Context, - collection, config, - source::{nyaa_html::NyaaTheme, sukebei_nyaa::SukebeiTheme, torrent_galaxy::TgxTheme}, -}; +use crate::{app::Context, collection, config, source::SourceTheme}; #[derive(Clone, Serialize, Deserialize)] pub struct Theme { @@ -42,11 +38,7 @@ pub struct Theme { pub error: Color, #[serde(default)] - pub nyaa: NyaaTheme, - #[serde(default)] - pub sukebei: SukebeiTheme, - #[serde(default, rename = "torrent_galaxy")] - pub tgx: TgxTheme, + pub source: SourceTheme, } pub fn load_user_themes(ctx: &mut Context, config_path: PathBuf) -> Result<(), String> { @@ -142,9 +134,7 @@ impl Default for Theme { solid_fg: Color::Black, success: Color::Green, error: Color::Red, - nyaa: Default::default(), - sukebei: Default::default(), - tgx: Default::default(), + source: Default::default(), } } } @@ -170,9 +160,7 @@ pub fn default_themes() -> IndexMap { solid_bg: Color::Rgb(139, 233, 253), success: Color::Rgb(80, 250, 123), error: Color::Rgb(255, 85, 85), - nyaa: Default::default(), - sukebei: Default::default(), - tgx: Default::default(), + source: Default::default(), }, "Gruvbox".to_owned() => Theme { name: "Gruvbox".to_owned(), @@ -186,9 +174,7 @@ pub fn default_themes() -> IndexMap { solid_fg: Color::Rgb(235, 219, 178), success: Color::Rgb(152, 151, 26), error: Color::Rgb(204, 36, 29), - nyaa: Default::default(), - sukebei: Default::default(), - tgx: Default::default(), + source: Default::default(), }, "Catppuccin Macchiato".to_owned() => Theme { name: "Catppuccin Macchiato".to_owned(), @@ -202,9 +188,7 @@ pub fn default_themes() -> IndexMap { solid_fg: Color::Rgb(24, 25, 38), success: Color::Rgb(166, 218, 149), error: Color::Rgb(237, 135, 150), - nyaa: Default::default(), - sukebei: Default::default(), - tgx: Default::default(), + source: Default::default(), }, ] } diff --git a/src/widget.rs b/src/widget.rs index 48865ce..d219c66 100644 --- a/src/widget.rs +++ b/src/widget.rs @@ -17,9 +17,10 @@ use unicode_width::UnicodeWidthStr as _; use crate::{app::Context, style, theme::Theme}; -pub mod batch; #[cfg(feature = "captcha")] pub mod captcha; + +pub mod batch; pub mod category; pub mod clients; pub mod filter;