feat: support static server
This commit is contained in:
@@ -268,8 +268,8 @@ mod tests {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn test_torrent_ep_parser(raw_name: &str, expected: &str) {
|
||||
let extname = Path::new(raw_name)
|
||||
pub fn test_torrent_ep_parser(origin_name: &str, expected: &str) {
|
||||
let extname = Path::new(origin_name)
|
||||
.extension()
|
||||
.map(|e| format!(".{e}"))
|
||||
.unwrap_or_default()
|
||||
@@ -278,7 +278,7 @@ mod tests {
|
||||
if extname == ".srt" || extname == ".ass" {
|
||||
let expected: Option<TorrentEpisodeSubtitleMeta> = serde_json::from_str(expected).ok();
|
||||
let found_raw =
|
||||
parse_episode_subtitle_meta_from_torrent(Path::new(raw_name), None, None);
|
||||
parse_episode_subtitle_meta_from_torrent(Path::new(origin_name), None, None);
|
||||
let found = found_raw.as_ref().ok().cloned();
|
||||
|
||||
if expected != found {
|
||||
@@ -299,7 +299,8 @@ mod tests {
|
||||
assert_eq!(expected, found);
|
||||
} else {
|
||||
let expected: Option<TorrentEpisodeMediaMeta> = serde_json::from_str(expected).ok();
|
||||
let found_raw = parse_episode_media_meta_from_torrent(Path::new(raw_name), None, None);
|
||||
let found_raw =
|
||||
parse_episode_media_meta_from_torrent(Path::new(origin_name), None, None);
|
||||
let found = found_raw.as_ref().ok().cloned();
|
||||
|
||||
if expected != found {
|
||||
|
||||
@@ -741,13 +741,11 @@ pub async fn scrape_mikan_poster_meta_from_image_url(
|
||||
mikan_client: &MikanClient,
|
||||
storage_service: &StorageService,
|
||||
origin_poster_src_url: Url,
|
||||
subscriber_id: i32,
|
||||
) -> RecorderResult<MikanBangumiPosterMeta> {
|
||||
if let Some(poster_src) = storage_service
|
||||
.exists(
|
||||
storage_service.build_subscriber_object_path(
|
||||
storage_service.build_public_object_path(
|
||||
StorageContentCategory::Image,
|
||||
subscriber_id,
|
||||
MIKAN_POSTER_BUCKET_KEY,
|
||||
&origin_poster_src_url
|
||||
.path()
|
||||
@@ -768,9 +766,8 @@ pub async fn scrape_mikan_poster_meta_from_image_url(
|
||||
|
||||
let poster_str = storage_service
|
||||
.write(
|
||||
storage_service.build_subscriber_object_path(
|
||||
storage_service.build_public_object_path(
|
||||
StorageContentCategory::Image,
|
||||
subscriber_id,
|
||||
MIKAN_POSTER_BUCKET_KEY,
|
||||
&origin_poster_src_url
|
||||
.path()
|
||||
@@ -1084,15 +1081,13 @@ mod test {
|
||||
&mikan_client,
|
||||
&storage_service,
|
||||
bangumi_poster_url,
|
||||
1,
|
||||
)
|
||||
.await?;
|
||||
|
||||
resources_mock.shared_resource_mock.expect(1);
|
||||
|
||||
let storage_fullname = storage_service.build_subscriber_object_path(
|
||||
let storage_fullname = storage_service.build_public_object_path(
|
||||
StorageContentCategory::Image,
|
||||
1,
|
||||
MIKAN_POSTER_BUCKET_KEY,
|
||||
"202309/5ce9fed1.jpg",
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
pub mod bittorrent;
|
||||
pub mod defs;
|
||||
pub mod html;
|
||||
pub mod http;
|
||||
pub mod media;
|
||||
pub mod mikan;
|
||||
pub mod rawname;
|
||||
pub mod bittorrent;
|
||||
pub mod origin;
|
||||
|
||||
5
apps/recorder/src/extract/origin/mod.rs
Normal file
5
apps/recorder/src/extract/origin/mod.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
pub mod parser;
|
||||
|
||||
pub use parser::{
|
||||
RawEpisodeMeta, extract_episode_meta_from_origin_name, extract_season_from_title_body,
|
||||
};
|
||||
@@ -261,7 +261,7 @@ pub fn check_is_movie(title: &str) -> bool {
|
||||
MOVIE_TITLE_RE.is_match(title)
|
||||
}
|
||||
|
||||
pub fn extract_episode_meta_from_raw_name(s: &str) -> RecorderResult<RawEpisodeMeta> {
|
||||
pub fn extract_episode_meta_from_origin_name(s: &str) -> RecorderResult<RawEpisodeMeta> {
|
||||
let raw_title = s.trim();
|
||||
let raw_title_without_ch_brackets = replace_ch_bracket_to_en(raw_title);
|
||||
let fansub = extract_fansub(&raw_title_without_ch_brackets);
|
||||
@@ -321,11 +321,11 @@ pub fn extract_episode_meta_from_raw_name(s: &str) -> RecorderResult<RawEpisodeM
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use super::{RawEpisodeMeta, extract_episode_meta_from_raw_name};
|
||||
use super::{RawEpisodeMeta, extract_episode_meta_from_origin_name};
|
||||
|
||||
fn test_raw_ep_parser_case(raw_name: &str, expected: &str) {
|
||||
let expected: Option<RawEpisodeMeta> = serde_json::from_str(expected).unwrap_or_default();
|
||||
let found = extract_episode_meta_from_raw_name(raw_name).ok();
|
||||
let found = extract_episode_meta_from_origin_name(raw_name).ok();
|
||||
|
||||
if expected != found {
|
||||
println!(
|
||||
@@ -1,5 +0,0 @@
|
||||
pub mod parser;
|
||||
|
||||
pub use parser::{
|
||||
RawEpisodeMeta, extract_episode_meta_from_raw_name, extract_season_from_title_body,
|
||||
};
|
||||
Reference in New Issue
Block a user