refactor: rewrite qbit downlaoder

This commit is contained in:
2025-04-03 02:22:26 +08:00
parent 234441e6a3
commit 27b52f7fd1
76 changed files with 1501 additions and 955 deletions

View File

@@ -0,0 +1,2 @@
pub const BITTORRENT_MIME_TYPE: &str = "application/x-bittorrent";
pub const MAGNET_SCHEMA: &str = "magnet";

View File

@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
use snafu::{OptionExt, whatever};
use crate::{
errors::{RError, RResult},
errors::app_error::{RError, RResult},
extract::defs::SUBTITLE_LANG,
};

View File

@@ -0,0 +1,6 @@
pub mod core;
pub mod extract;
pub use core::{BITTORRENT_MIME_TYPE, MAGNET_SCHEMA};
pub use extract::*;

View File

@@ -6,7 +6,7 @@ use url::Url;
use super::MikanConfig;
use crate::{
errors::RError,
errors::app_error::RError,
fetch::{HttpClient, HttpClientTrait, client::HttpClientCookiesAuth},
};

View File

@@ -8,11 +8,13 @@ use tracing::instrument;
use url::Url;
use crate::{
downloader::core::BITTORRENT_MIME_TYPE,
errors::{RError, RResult},
extract::mikan::{
MikanClient,
web_extract::{MikanEpisodeHomepage, extract_mikan_episode_id_from_homepage},
errors::app_error::{RError, RResult},
extract::{
bittorrent::BITTORRENT_MIME_TYPE,
mikan::{
MikanClient,
web_extract::{MikanEpisodeHomepage, extract_mikan_episode_id_from_homepage},
},
},
fetch::bytes::fetch_bytes,
};
@@ -338,11 +340,13 @@ mod tests {
use url::Url;
use crate::{
downloader::core::BITTORRENT_MIME_TYPE,
errors::RResult,
extract::mikan::{
MikanBangumiAggregationRssChannel, MikanBangumiRssChannel, MikanRssChannel,
extract_mikan_rss_channel_from_rss_link,
errors::app_error::RResult,
extract::{
bittorrent::BITTORRENT_MIME_TYPE,
mikan::{
MikanBangumiAggregationRssChannel, MikanBangumiRssChannel, MikanRssChannel,
extract_mikan_rss_channel_from_rss_link,
},
},
test_utils::mikan::build_testing_mikan_client,
};

View File

@@ -15,7 +15,7 @@ use super::{
};
use crate::{
app::AppContextTrait,
errors::{RError, RResult},
errors::app_error::{RError, RResult},
extract::{
html::{extract_background_image_src_from_style_attr, extract_inner_text_from_element_ref},
media::extract_image_src_from_str,

View File

@@ -4,4 +4,4 @@ pub mod http;
pub mod media;
pub mod mikan;
pub mod rawname;
pub mod torrent;
pub mod bittorrent;

View File

@@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize};
use snafu::whatever;
use crate::{
errors::RResult,
errors::app_error::RResult,
extract::defs::{DIGIT_1PLUS_REG, ZH_NUM_MAP, ZH_NUM_RE},
};

View File

@@ -1,3 +0,0 @@
mod parser;
pub use parser::*;