From 2ce582044f6deb3cd170da572f497f9f30c13ee8 Mon Sep 17 00:00:00 2001 From: Brad Culwell Date: Wed, 2 Oct 2024 02:51:40 -0500 Subject: [PATCH] feat: add relative date and relative date short formats --- src/app.rs | 2 +- src/config.rs | 4 +++ src/source.rs | 66 +++++++++++++++++++++--------------- src/source/nyaa_html.rs | 48 ++++++++++++++++---------- src/source/nyaa_rss.rs | 37 +++++++++++--------- src/source/sukebei_nyaa.rs | 45 +++++++++++++++--------- src/source/torrent_galaxy.rs | 23 +++++++------ src/sync.rs | 10 +++--- src/util/conv.rs | 46 +++++++++++++++++++++++++ tests/common/mod.rs | 7 ++-- 10 files changed, 189 insertions(+), 99 deletions(-) diff --git a/src/app.rs b/src/app.rs index 4be5a3a..03295d0 100644 --- a/src/app.rs +++ b/src/app.rs @@ -407,7 +407,7 @@ impl App { search, ctx.config.sources.clone(), ctx.theme.clone(), - ctx.config.date_format.clone(), + ctx.config.clone().into(), )); last_load_abort = Some(task.abort_handle()); continue; // Redraw diff --git a/src/config.rs b/src/config.rs index c691f3c..d207a3f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -51,6 +51,8 @@ pub struct Config { pub source: Sources, pub download_client: Client, pub date_format: Option, + pub relative_date: Option, + pub relative_date_short: Option, pub request_proxy: Option, pub timeout: u64, pub scroll_padding: usize, @@ -75,6 +77,8 @@ impl Default for Config { download_client: Client::Cmd, theme: Theme::default().name, date_format: None, + relative_date: None, + relative_date_short: None, request_proxy: None, timeout: 30, scroll_padding: 3, diff --git a/src/source.rs b/src/source.rs index cf26d58..63ee761 100644 --- a/src/source.rs +++ b/src/source.rs @@ -9,6 +9,7 @@ use torrent_galaxy::TgxTheme; use crate::{ app::{Context, LoadType, Widgets}, + config::Config, results::{ResultResponse, ResultTable, Results}, sync::SearchQuery, theme::Theme, @@ -67,6 +68,22 @@ pub struct SourceConfig { pub tgx: Option, } +pub struct SourceExtraConfig { + pub date_format: Option, + pub relative_date: Option, + pub relative_date_short: Option, +} + +impl From for SourceExtraConfig { + fn from(c: Config) -> Self { + SourceExtraConfig { + date_format: c.date_format, + relative_date: c.relative_date, + relative_date_short: c.relative_date_short, + } + } +} + #[derive(Clone)] pub struct SourceInfo { pub cats: Vec, @@ -171,32 +188,32 @@ pub trait Source { client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> impl std::future::Future>> + Send; fn sort( client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> impl std::future::Future>> + Send; fn filter( client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> impl std::future::Future>> + Send; fn categorize( client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> impl std::future::Future>> + Send; fn solve( solution: String, client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> impl std::future::Future>> + Send; fn info() -> SourceInfo; fn load_config(config: &mut SourceConfig); @@ -221,61 +238,54 @@ impl Sources { client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> Result> { match self { Sources::Nyaa => match load_type { LoadType::Searching | LoadType::Sourcing => { - NyaaHtmlSource::search(client, search, config, date_format).await - } - LoadType::Sorting => { - NyaaHtmlSource::sort(client, search, config, date_format).await - } - LoadType::Filtering => { - NyaaHtmlSource::filter(client, search, config, date_format).await + NyaaHtmlSource::search(client, search, config, extra).await } + LoadType::Sorting => NyaaHtmlSource::sort(client, search, config, extra).await, + LoadType::Filtering => NyaaHtmlSource::filter(client, search, config, extra).await, LoadType::Categorizing => { - NyaaHtmlSource::categorize(client, search, config, date_format).await + NyaaHtmlSource::categorize(client, search, config, extra).await } LoadType::SolvingCaptcha(solution) => { - NyaaHtmlSource::solve(solution, client, search, config, date_format).await + NyaaHtmlSource::solve(solution, client, search, config, extra).await } LoadType::Downloading | LoadType::Batching => unreachable!(), }, Sources::SukebeiNyaa => match load_type { LoadType::Searching | LoadType::Sourcing => { - SukebeiHtmlSource::search(client, search, config, date_format).await - } - LoadType::Sorting => { - SukebeiHtmlSource::sort(client, search, config, date_format).await + SukebeiHtmlSource::search(client, search, config, extra).await } + LoadType::Sorting => SukebeiHtmlSource::sort(client, search, config, extra).await, LoadType::Filtering => { - SukebeiHtmlSource::filter(client, search, config, date_format).await + SukebeiHtmlSource::filter(client, search, config, extra).await } LoadType::Categorizing => { - SukebeiHtmlSource::categorize(client, search, config, date_format).await + SukebeiHtmlSource::categorize(client, search, config, extra).await } LoadType::SolvingCaptcha(solution) => { - SukebeiHtmlSource::solve(solution, client, search, config, date_format).await + SukebeiHtmlSource::solve(solution, client, search, config, extra).await } LoadType::Downloading | LoadType::Batching => unreachable!(), }, Sources::TorrentGalaxy => match load_type { LoadType::Searching | LoadType::Sourcing => { - TorrentGalaxyHtmlSource::search(client, search, config, date_format).await + TorrentGalaxyHtmlSource::search(client, search, config, extra).await } LoadType::Sorting => { - TorrentGalaxyHtmlSource::sort(client, search, config, date_format).await + TorrentGalaxyHtmlSource::sort(client, search, config, extra).await } LoadType::Filtering => { - TorrentGalaxyHtmlSource::filter(client, search, config, date_format).await + TorrentGalaxyHtmlSource::filter(client, search, config, extra).await } LoadType::Categorizing => { - TorrentGalaxyHtmlSource::categorize(client, search, config, date_format).await + TorrentGalaxyHtmlSource::categorize(client, search, config, extra).await } LoadType::SolvingCaptcha(solution) => { - TorrentGalaxyHtmlSource::solve(solution, client, search, config, date_format) - .await + TorrentGalaxyHtmlSource::solve(solution, client, search, config, extra).await } LoadType::Downloading | LoadType::Batching => unreachable!(), }, diff --git a/src/source/nyaa_html.rs b/src/source/nyaa_html.rs index 7bb2766..2fbd87b 100644 --- a/src/source/nyaa_html.rs +++ b/src/source/nyaa_html.rs @@ -1,3 +1,4 @@ +use std::fmt::Write; use std::{cmp::max, error::Error, time::Duration}; use chrono::{DateTime, Local, NaiveDateTime, TimeZone}; @@ -11,6 +12,7 @@ use serde::{Deserialize, Serialize}; use strum::{Display, FromRepr, VariantArray}; use urlencoding::encode; +use crate::util; use crate::{ cats, cond_vec, results::{ResultColumn, ResultHeader, ResultResponse, ResultRow, ResultTable}, @@ -26,7 +28,8 @@ use crate::{ }; use super::{ - add_protocol, nyaa_rss, Item, ItemType, Source, SourceConfig, SourceInfo, SourceResponse, + add_protocol, nyaa_rss, Item, ItemType, Source, SourceConfig, SourceExtraConfig, SourceInfo, + SourceResponse, }; #[derive(Serialize, Deserialize, Clone, Copy, Default)] @@ -273,7 +276,7 @@ impl Source for NyaaHtmlSource { client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> Result> { let nyaa = config.nyaa.to_owned().unwrap_or_default(); if nyaa.rss { @@ -282,7 +285,7 @@ impl Source for NyaaHtmlSource { nyaa.timeout, client, search, - date_format, + extra, ) .await; } @@ -370,13 +373,24 @@ impl Source for NyaaHtmlSource { let bytes = to_bytes(&size); const DEFAULT_DATE_FORMAT: &str = "%Y-%m-%d %H:%M"; - let mut date = inner(e, date_sel, ""); - let naive = - NaiveDateTime::parse_from_str(&date, DEFAULT_DATE_FORMAT).unwrap_or_default(); + let date_raw = inner(e, date_sel, ""); + let naive = NaiveDateTime::parse_from_str(&date_raw, DEFAULT_DATE_FORMAT) + .unwrap_or_default(); let date_time: DateTime = Local.from_utc_datetime(&naive); - date = date_time - .format(date_format.as_deref().unwrap_or(DEFAULT_DATE_FORMAT)) - .to_string(); + let date_format = extra.date_format.as_deref().unwrap_or(DEFAULT_DATE_FORMAT); + + let date = if extra.relative_date.unwrap_or(false) { + util::conv::to_relative_date( + date_time, + extra.relative_date_short.unwrap_or(false), + ) + } else { + let mut newstr = String::new(); + if write!(newstr, "{}", date_time.format(date_format)).is_err() { + newstr = format!("Invalid format string: `{}`", date_format); + } + newstr + }; let seeders = as_type(inner(e, seed_sel, "0")).unwrap_or_default(); let leechers = as_type(inner(e, leech_sel, "0")).unwrap_or_default(); @@ -429,11 +443,11 @@ impl Source for NyaaHtmlSource { client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> Result> { let nyaa = config.nyaa.to_owned().unwrap_or_default(); let sort = search.sort; - let mut res = NyaaHtmlSource::search(client, search, config, date_format).await; + let mut res = NyaaHtmlSource::search(client, search, config, extra).await; if nyaa.rss { if let Ok(SourceResponse::Results(res)) = &mut res { @@ -446,26 +460,26 @@ impl Source for NyaaHtmlSource { client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> Result> { - NyaaHtmlSource::search(client, search, config, date_format).await + NyaaHtmlSource::search(client, search, config, extra).await } async fn categorize( client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> Result> { - NyaaHtmlSource::search(client, search, config, date_format).await + NyaaHtmlSource::search(client, search, config, extra).await } async fn solve( _solution: String, client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> Result> { - NyaaHtmlSource::search(client, search, config, date_format).await + NyaaHtmlSource::search(client, search, config, extra).await } fn info() -> SourceInfo { diff --git a/src/source/nyaa_rss.rs b/src/source/nyaa_rss.rs index 4253c56..af87558 100644 --- a/src/source/nyaa_rss.rs +++ b/src/source/nyaa_rss.rs @@ -1,3 +1,4 @@ +use std::fmt::Write; use std::{cmp::Ordering, collections::BTreeMap, error::Error, str::FromStr, time::Duration}; use chrono::{DateTime, Local}; @@ -8,11 +9,13 @@ use urlencoding::encode; use crate::{ results::ResultResponse, sync::SearchQuery, - util::conv::to_bytes, + util::{self, conv::to_bytes}, widget::sort::{SelectedSort, SortDir}, }; -use super::{add_protocol, nyaa_html::NyaaSort, Item, ItemType, Source, SourceResponse}; +use super::{ + add_protocol, nyaa_html::NyaaSort, Item, ItemType, Source, SourceExtraConfig, SourceResponse, +}; type ExtensionMap = BTreeMap>; @@ -44,7 +47,7 @@ pub async fn search_rss( timeout: Option, client: &reqwest::Client, search: &SearchQuery, - date_format: Option, + extra: &SourceExtraConfig, ) -> Result> { let query = search.query.to_owned(); let cat = search.category; @@ -94,8 +97,8 @@ pub async fn search_rss( .replace('i', "") .replace("Bytes", "B"); let pub_date = item.pub_date().unwrap_or(""); - let date = DateTime::parse_from_rfc2822(pub_date).unwrap_or_default(); - let date = date.with_timezone(&Local); + let date_time = DateTime::parse_from_rfc2822(pub_date).unwrap_or_default(); + let date_time = date_time.with_timezone(&Local); let torrent_link = base_url .join(&format!("/download/{}.torrent", id)) .map(Into::into) @@ -107,13 +110,24 @@ pub async fn search_rss( (_, true) => ItemType::Remake, _ => ItemType::None, }; - let date_format = date_format + let date_format = extra + .date_format .to_owned() .unwrap_or("%Y-%m-%d %H:%M".to_owned()); + let date = if extra.relative_date.unwrap_or(false) { + util::conv::to_relative_date(date_time, extra.relative_date_short.unwrap_or(false)) + } else { + let mut newstr = String::new(); + if write!(newstr, "{}", date_time.format(&date_format)).is_err() { + newstr = format!("Invalid format string: `{}`", date_format); + } + newstr + }; + Some(Item { id: format!("nyaa-{}", id_usize), - date: date.format(&date_format).to_string(), + date, seeders: get_ext_value(ext, "seeders"), leechers: get_ext_value(ext, "leechers"), downloads: get_ext_value(ext, "downloads"), @@ -138,13 +152,4 @@ pub async fn search_rss( last_page, total_results, })) - // Ok(items) - // Ok(nyaa_table( - // items, - // &theme, - // &search.sort, - // nyaa.columns, - // last_page, - // total_results, - // )) } diff --git a/src/source/sukebei_nyaa.rs b/src/source/sukebei_nyaa.rs index 602d2e1..fc69aed 100644 --- a/src/source/sukebei_nyaa.rs +++ b/src/source/sukebei_nyaa.rs @@ -1,3 +1,4 @@ +use std::fmt::Write; use std::{error::Error, time::Duration}; use chrono::{DateTime, Local, NaiveDateTime, TimeZone}; @@ -15,6 +16,7 @@ use crate::{ sync::SearchQuery, theme::Theme, util::{ + self, colors::color_to_tui, conv::to_bytes, html::{attr, inner}, @@ -22,6 +24,7 @@ use crate::{ widget::sort::{SelectedSort, SortDir}, }; +use super::SourceExtraConfig; use super::{ add_protocol, nyaa_html::{nyaa_table, NyaaColumns, NyaaFilter, NyaaSort}, @@ -106,27 +109,27 @@ impl Source for SukebeiHtmlSource { client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> Result> { - SukebeiHtmlSource::search(client, search, config, date_format).await + SukebeiHtmlSource::search(client, search, config, extra).await } async fn categorize( client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> Result> { - SukebeiHtmlSource::search(client, search, config, date_format).await + SukebeiHtmlSource::search(client, search, config, extra).await } async fn sort( client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> Result> { let sukebei = config.sukebei.to_owned().unwrap_or_default(); let sort = search.sort; - let mut res = SukebeiHtmlSource::search(client, search, config, date_format).await; + let mut res = SukebeiHtmlSource::search(client, search, config, extra).await; if sukebei.rss { if let Ok(SourceResponse::Results(res)) = &mut res { @@ -140,7 +143,7 @@ impl Source for SukebeiHtmlSource { client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> Result> { let sukebei = config.sukebei.to_owned().unwrap_or_default(); if sukebei.rss { @@ -149,7 +152,7 @@ impl Source for SukebeiHtmlSource { sukebei.timeout, client, search, - date_format, + extra, ) .await; } @@ -233,13 +236,23 @@ impl Source for SukebeiHtmlSource { let bytes = to_bytes(&size); const DEFAULT_DATE_FORMAT: &str = "%Y-%m-%d %H:%M"; - let mut date = inner(e, date_sel, ""); - let naive = - NaiveDateTime::parse_from_str(&date, DEFAULT_DATE_FORMAT).unwrap_or_default(); + let date_format = extra.date_format.as_deref().unwrap_or(DEFAULT_DATE_FORMAT); + let date = inner(e, date_sel, ""); + let naive = NaiveDateTime::parse_from_str(&date, date_format).unwrap_or_default(); let date_time: DateTime = Local.from_utc_datetime(&naive); - date = date_time - .format(date_format.as_deref().unwrap_or(DEFAULT_DATE_FORMAT)) - .to_string(); + + let date = if extra.relative_date.unwrap_or(false) { + util::conv::to_relative_date( + date_time, + extra.relative_date_short.unwrap_or(false), + ) + } else { + let mut newstr = String::new(); + if write!(newstr, "{}", date_time.format(date_format)).is_err() { + newstr = format!("Invalid format string: `{}`", date_format); + } + newstr + }; let seeders = inner(e, seed_sel, "0").parse().unwrap_or(0); let leechers = inner(e, leech_sel, "0").parse().unwrap_or(0); @@ -297,9 +310,9 @@ impl Source for SukebeiHtmlSource { client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> Result> { - SukebeiHtmlSource::search(client, search, config, date_format).await + SukebeiHtmlSource::search(client, search, config, extra).await } fn info() -> SourceInfo { diff --git a/src/source/torrent_galaxy.rs b/src/source/torrent_galaxy.rs index 08b300b..e5cf148 100644 --- a/src/source/torrent_galaxy.rs +++ b/src/source/torrent_galaxy.rs @@ -29,7 +29,10 @@ use crate::{ widget::sort::{SelectedSort, SortDir}, }; -use super::{add_protocol, Item, ItemType, Source, SourceConfig, SourceInfo, SourceResponse}; +use super::{ + add_protocol, Item, ItemType, Source, SourceConfig, SourceExtraConfig, SourceInfo, + SourceResponse, +}; #[derive(Serialize, Deserialize, Clone, Copy, Default)] #[serde(default)] @@ -367,32 +370,32 @@ impl Source for TorrentGalaxyHtmlSource { client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> Result> { - TorrentGalaxyHtmlSource::search(client, search, config, date_format).await + TorrentGalaxyHtmlSource::search(client, search, config, extra).await } async fn categorize( client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> Result> { - TorrentGalaxyHtmlSource::search(client, search, config, date_format).await + TorrentGalaxyHtmlSource::search(client, search, config, extra).await } async fn sort( client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> Result> { - TorrentGalaxyHtmlSource::search(client, search, config, date_format).await + TorrentGalaxyHtmlSource::search(client, search, config, extra).await } async fn search( client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - _date_format: Option, + _extra: &SourceExtraConfig, ) -> Result> { let tgx = config.tgx.to_owned().unwrap_or_default(); let (base_url, url) = get_url(tgx.base_url.clone(), search)?; @@ -594,7 +597,7 @@ impl Source for TorrentGalaxyHtmlSource { client: &reqwest::Client, search: &SearchQuery, config: &SourceConfig, - date_format: Option, + extra: &SourceExtraConfig, ) -> Result> { let tgx = config.tgx.to_owned().unwrap_or_default(); let time = SystemTime::now().duration_since(UNIX_EPOCH)?.as_millis(); @@ -645,7 +648,7 @@ impl Source for TorrentGalaxyHtmlSource { .into()); } - TorrentGalaxyHtmlSource::search(client, search, config, date_format).await + TorrentGalaxyHtmlSource::search(client, search, config, extra).await } fn info() -> SourceInfo { diff --git a/src/sync.rs b/src/sync.rs index 6385001..6a29401 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -13,7 +13,7 @@ use crate::{ client::{Client, ClientConfig, DownloadClientResult}, config::CONFIG_FILE, results::Results, - source::{Item, SourceConfig, SourceResponse, SourceResults, Sources}, + source::{Item, SourceConfig, SourceExtraConfig, SourceResponse, SourceResults, Sources}, theme::{Theme, THEMES_PATH}, widget::sort::SelectedSort, }; @@ -29,7 +29,7 @@ pub trait EventSync { search: SearchQuery, config: SourceConfig, theme: Theme, - date_format: Option, + extra: SourceExtraConfig, ) -> impl std::future::Future + std::marker::Send + 'static; fn download( self, @@ -98,11 +98,9 @@ impl EventSync for AppSync { search: SearchQuery, config: SourceConfig, theme: Theme, - date_format: Option, + extra: SourceExtraConfig, ) { - let res = src - .load(load_type, &client, &search, &config, date_format) - .await; + let res = src.load(load_type, &client, &search, &config, &extra).await; let fmt = match res { Ok(SourceResponse::Results(res)) => Ok(SourceResults::Results(Results::new( search.clone(), diff --git a/src/util/conv.rs b/src/util/conv.rs index 0a63b14..ef95152 100644 --- a/src/util/conv.rs +++ b/src/util/conv.rs @@ -1,8 +1,54 @@ use std::error::Error; +use chrono::{DateTime, Local, Utc}; use crossterm::event::{KeyCode, KeyModifiers, MediaKeyCode, ModifierKeyCode}; use reqwest::Url; +static TIME_UNITS_LONG: [&str; 7] = [ + " year", " month", " week", " day", " hour", " minute", " second", +]; + +static TIME_UNITS_SHORT: [&str; 7] = ["y", "mo", "w", "d", "h", "m", "s"]; + +pub fn to_relative_date(time: DateTime, short: bool) -> String { + let delta = Utc::now().signed_duration_since(time); + let years = delta.num_days() / 365; + let months = delta.num_days() / 30 - (delta.num_days() / 365) * 12; + let weeks = delta.num_weeks() - ((delta.num_days() / 30) * 30) / 7; + let days = delta.num_days() - delta.num_weeks() * 7; + + let hours = delta.num_hours() - delta.num_days() * 24; + let minutes = delta.num_minutes() - delta.num_hours() * 60; + let seconds = delta.num_seconds() - delta.num_minutes() * 60; + + let (units, plural, sep, end) = if short { + (TIME_UNITS_SHORT, "", " ", "") + } else { + (TIME_UNITS_LONG, "s", ", ", " ago") + }; + + let time = [years, months, weeks, days, hours, minutes, seconds]; + + let rel_dates = time + .into_iter() + .zip(units) + .filter(|(amt, _)| amt.is_positive()) + .map(|(amt, unit)| { + if amt == 1 { + format!("{}{}", amt, unit) + } else { + format!("{}{}{}", amt, unit, plural) + } + }) + .take(2) + .collect::>(); + if !rel_dates.is_empty() { + format!("{}{}", rel_dates.join(sep), end) + } else { + "Now".to_string() + } +} + pub fn get_hash(magnet: String) -> Option { magnet .split_once("xt=urn:btih:") diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 8e8b8be..49670bc 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -6,7 +6,7 @@ use nyaa::{ client::{Client, ClientConfig, DownloadClientResult}, config::{Config, ConfigManager}, results::Results, - source::{Item, SourceResults}, + source::{Item, SourceExtraConfig, SourceResults}, sync::{EventSync, ReloadType}, }; use ratatui::{ @@ -170,11 +170,8 @@ impl EventSync for TestSync { _query: nyaa::sync::SearchQuery, _config: nyaa::source::SourceConfig, _theme: nyaa::theme::Theme, - _date_format: Option, + _extra: SourceExtraConfig, ) { - //let _ = tx_res - // .send(Ok(SourceResults::Results(Results::default()))) - // .await; } async fn read_event_loop(self, tx_evt: Sender) {