diff --git a/src/source/nyaa_html.rs b/src/source/nyaa_html.rs index 22c74fa..c9659cf 100644 --- a/src/source/nyaa_html.rs +++ b/src/source/nyaa_html.rs @@ -27,9 +27,16 @@ use super::{ add_protocol, nyaa_rss, Item, ItemType, Source, SourceConfig, SourceInfo, SourceResponse, }; -#[derive(Serialize, Deserialize, Clone, Copy)] +#[derive(Serialize, Deserialize, Clone, Copy, Default)] #[serde(default)] pub struct NyaaTheme { + #[serde(rename = "categories")] + cat: NyaaCategoryTheme, +} + +#[derive(Serialize, Deserialize, Clone, Copy)] +#[serde(default)] +pub struct NyaaCategoryTheme { #[serde(with = "color_to_tui")] pub anime_english_translated: Color, #[serde(with = "color_to_tui")] @@ -66,7 +73,7 @@ pub struct NyaaTheme { pub software_games: Color, } -impl Default for NyaaTheme { +impl Default for NyaaCategoryTheme { fn default() -> Self { use Color::*; Self { @@ -455,38 +462,38 @@ impl Source for NyaaHtmlSource { } "Anime" => { 10 => ("Ani", "All Anime", "AllAnime", fg); - 12 => ("Sub", "English Translated", "AnimeEnglishTranslated", nyaa.anime_english_translated); - 13 => ("Sub", "Non-English Translated", "AnimeNonEnglishTranslated", nyaa.anime_non_english_translated); - 14 => ("Raw", "Raw", "AnimeRaw", nyaa.anime_raw); - 11 => ("AMV", "Anime Music Video", "AnimeMusicVideo", nyaa.anime_music_video); + 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); } "Audio" => { 20 => ("Aud", "All Audio", "AllAudio", fg); - 21 => ("Aud", "Lossless", "AudioLossless", nyaa.audio_lossless); - 22 => ("Aud", "Lossy", "AudioLossy", nyaa.audio_lossy); + 21 => ("Aud", "Lossless", "AudioLossless", nyaa.cat.audio_lossless); + 22 => ("Aud", "Lossy", "AudioLossy", nyaa.cat.audio_lossy); } "Literature" => { 30 => ("Lit", "All Literature", "AllLiterature", fg); - 31 => ("Lit", "English Translated", "LitEnglishTranslated", nyaa.literature_english_translated); - 32 => ("Lit", "Non-English Translated", "LitNonEnglishTranslated", nyaa.literature_non_english_translated); - 33 => ("Lit", "Raw", "LitRaw", nyaa.literature_raw); + 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); } "Live Action" => { 40 => ("Liv", "All Live Action", "AllLiveAction", fg); - 41 => ("Liv", "English Translated", "LiveEnglishTranslated", nyaa.live_english_translated); - 43 => ("Liv", "Non-English Translated", "LiveNonEnglishTranslated", nyaa.live_non_english_translated); - 42 => ("Liv", "Idol/Promo Video", "LiveIdolPromoVideo", nyaa.live_idol_promo_video); - 44 => ("Liv", "Raw", "LiveRaw", nyaa.live_raw); + 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); } "Pictures" => { 50 => ("Pic", "All Pictures", "AllPictures", fg); - 51 => ("Pic", "Graphics", "PicGraphics", nyaa.picture_graphics); - 52 => ("Pic", "Photos", "PicPhotos", nyaa.picture_photos); + 51 => ("Pic", "Graphics", "PicGraphics", nyaa.cat.picture_graphics); + 52 => ("Pic", "Photos", "PicPhotos", nyaa.cat.picture_photos); } "Software" => { 60 => ("Sof", "All Software", "AllSoftware", fg); - 61 => ("Sof", "Applications", "SoftApplications", nyaa.software_applications); - 62 => ("Sof", "Games", "SoftGames", nyaa.software_games); + 61 => ("Sof", "Applications", "SoftApplications", nyaa.cat.software_applications); + 62 => ("Sof", "Games", "SoftGames", nyaa.cat.software_games); } }; SourceInfo { diff --git a/src/source/sukebei_nyaa.rs b/src/source/sukebei_nyaa.rs index ec5e74b..d673e6f 100644 --- a/src/source/sukebei_nyaa.rs +++ b/src/source/sukebei_nyaa.rs @@ -26,9 +26,16 @@ use super::{ nyaa_rss, Item, ItemType, ResultTable, Source, SourceConfig, SourceInfo, SourceResponse, }; -#[derive(Serialize, Deserialize, Clone, Copy)] +#[derive(Serialize, Deserialize, Clone, Copy, Default)] #[serde(default)] pub struct SukebeiTheme { + #[serde(rename = "categories")] + pub cat: SukebeiCategoryTheme, +} + +#[derive(Serialize, Deserialize, Clone, Copy)] +#[serde(default)] +pub struct SukebeiCategoryTheme { #[serde(with = "color_to_tui")] pub art_anime: Color, #[serde(with = "color_to_tui")] @@ -45,7 +52,7 @@ pub struct SukebeiTheme { pub real_videos: Color, } -impl Default for SukebeiTheme { +impl Default for SukebeiCategoryTheme { fn default() -> Self { use Color::*; Self { @@ -298,16 +305,16 @@ impl Source for SukebeiHtmlSource { } "Art" => { 10 => ("Art", "All Art", "AllArt", fg); - 11 => ("Ani", "Anime", "ArtAnime", sukebei.art_anime); - 12 => ("Dou", "Doujinshi", "ArtDoujinshi", sukebei.art_doujinshi); - 13 => ("Gam", "Games", "ArtGames", sukebei.art_games); - 14 => ("Man", "Manga", "ArtManga", sukebei.art_manga); - 15 => ("Pic", "Pictures", "ArtPictures", sukebei.art_pictures); + 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); } "Real Life" => { 20 => ("Rea", "All Real Life", "AllReal", fg); - 21 => ("Pho", "Photobooks and Pictures", "RealPhotos", sukebei.real_photos); - 22 => ("Vid", "Videos", "RealVideos", sukebei.real_videos); + 21 => ("Pho", "Photobooks and Pictures", "RealPhotos", sukebei.cat.real_photos); + 22 => ("Vid", "Videos", "RealVideos", sukebei.cat.real_videos); } }; SourceInfo { diff --git a/src/source/torrent_galaxy.rs b/src/source/torrent_galaxy.rs index 5410740..6ec419b 100644 --- a/src/source/torrent_galaxy.rs +++ b/src/source/torrent_galaxy.rs @@ -29,9 +29,16 @@ use crate::{ use super::{add_protocol, Item, ItemType, Source, SourceConfig, SourceInfo, SourceResponse}; -#[derive(Serialize, Deserialize, Clone, Copy)] +#[derive(Serialize, Deserialize, Clone, Copy, Default)] #[serde(default)] pub struct TgxTheme { + #[serde(rename = "categories")] + pub cat: TgxCategoryTheme, +} + +#[derive(Serialize, Deserialize, Clone, Copy)] +#[serde(default)] +pub struct TgxCategoryTheme { #[serde(with = "color_to_tui")] pub all_categories: Color, #[serde(with = "color_to_tui")] @@ -108,7 +115,7 @@ pub struct TgxTheme { pub xxx_sd: Color, } -impl Default for TgxTheme { +impl Default for TgxCategoryTheme { fn default() -> Self { use Color::*; Self { @@ -603,43 +610,43 @@ impl Source for TorrentGalaxyHtmlSource { fn info() -> SourceInfo { let cats = cats! { - "All Categories" => { 0 => ("---", "All Categories", "AllCategories", tgx.all_categories); } - "Movies" => {3 => ("4kM", "4K UHD Movies", "4kMovies", tgx.movies_4k); - 46 => ("Bly", "Bollywood", "Bollywood Movies", tgx.movies_bollywood); - 45 => ("Cam", "Cam/TS", "CamMovies", tgx.movies_cam); - 42 => ("HdM", "HD Movies", "HdMovies", tgx.movies_hd); - 4 => ("PkM", "Movie Packs", "PackMovies", tgx.movies_pack); - 1 => ("SdM", "SD Movies", "SdMovies", tgx.movies_sd);} - "TV" => {41 => ("HdT", "TV HD", "HdTV", tgx.tv_hd); - 5 => ("SdT", "TV SD", "SdTV", tgx.tv_sd); - 11 => ("4kT", "TV 4k", "4kTV", tgx.tv_4k); - 6 => ("PkT", "TV Packs", "PacksTV", tgx.tv_pack); - 7 => ("Spo", "Sports", "SportsTV", tgx.tv_sports);} - "Anime" => {28 => ("Ani", "All Anime", "Anime", tgx.anime);} - "Apps" => {20 => ("Mob", "Mobile Apps", "AppsMobile", tgx.apps_mobile); - 21 => ("App", "Other Apps", "AppsOther", tgx.apps_other); - 18 => ("Win", "Windows Apps", "AppsWindows", tgx.apps_windows);} - "Books" => {13 => ("Abk", "Audiobooks", "Audiobooks", tgx.audiobooks); - 19 => ("Com", "Comics", "Comics", tgx.comics); - 12 => ("Ebk", "Ebooks", "Ebooks", tgx.ebooks); - 14 => ("Edu", "Educational", "Educational", tgx.educational); - 15 => ("Mag", "Magazines", "Magazines", tgx.magazines);} - "Documentaries" => {9 => ("Doc", "All Documentaries", "Documentaries", tgx.documentaries);} - "Games" => {10 => ("Wgm", "Windows Games", "WindowsGames", tgx.games_windows); - 43 => ("Ogm", "Other Games", "OtherGames", tgx.games_other);} - "Music" => {22 => ("Alb", "Music Albums", "AlbumsMusic", tgx.music_albums); - 26 => ("Dis", "Music Discography", "DiscographyMusic", tgx.music_discography); - 23 => ("Los", "Music Lossless", "LosslessMusic", tgx.music_lossless); - 25 => ("MV ", "Music Video", "MusicVideo", tgx.music_video); - 24 => ("Sin", "Music Singles", "SinglesMusic", tgx.music_singles);} - "Other" => {17 => ("Aud", "Other Audio", "AudioOther", tgx.audio_other); - 40 => ("Pic", "Other Pictures", "PicturesOther", tgx.pictures_other); - 37 => ("Tra", "Other Training", "TrainingOther", tgx.training_other); - 33 => ("Oth", "Other", "Other", tgx.other);} - "XXX" => {48 => ("4kX", "XXX 4k", "4kXXX", tgx.xxx_4k); - 35 => ("HdX", "XXX HD", "HdXXX", tgx.xxx_hd); - 47 => ("MsX", "XXX Misc", "MiscXXX", tgx.xxx_misc); - 34 => ("SdX", "XXX SD", "SdXXX", tgx.xxx_sd);} + "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);} }; SourceInfo { cats,