Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
biezhihua committed Jan 25, 2024
1 parent 91f8435 commit 16e6aab
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"edition": [
"CC",
"EE"
],
"version": [
"V\\d{1}"
],
Expand Down Expand Up @@ -108,7 +112,6 @@
"BBC",
"TVB",
"DC",
"CC",
"HQ",
"NF"
],
Expand Down Expand Up @@ -320,6 +323,7 @@
"FLUX",
"ZmWeb",
"ggwp",
"FRDS",
"glhf",
"ggez",
"WiKi",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
{
"src": "SP.",
"target": ""
},
{
"src": ".EE.",
"target": "."
}
],
"rules": [
Expand Down
1 change: 1 addition & 0 deletions soda_resource_tools_lib/src/soda/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,7 @@ pub struct MatchRule {

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct RegexRule {
pub edition: Vec<String>,
pub version: Vec<String>,
pub resolution_cn: Vec<String>,
pub episode_title_jp: Vec<String>,
Expand Down
14 changes: 14 additions & 0 deletions soda_resource_tools_lib/src/soda/meta/strong_match_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,10 @@ fn regex_item_audio_codec_multi(index: i32) -> String {
return regex_item_multi("audio_codec", index, &REGEX_RULES.audio_codec);
}

fn regex_item_edition() -> String {
return regex_item_multi("edition", 0, &REGEX_RULES.edition);
}

/// 匹配音频编码器
fn regex_item_audio_codec() -> String {
return regex_item_multi("audio_codec", 0, &REGEX_RULES.audio_codec);
Expand Down Expand Up @@ -1043,6 +1047,16 @@ pub fn input_before_process(before_token: &mut Token, input: &str) -> String {
}
}

// 使用正则移除edition
let version_regex = Regex::new(&&regex_item_edition()).unwrap();
if let Some(capture) = version_regex.captures(&new_input) {
if let Some(value) = capture.name("edition") {
let mut value = value.as_str().to_string();
tracing::debug!("edition = {}", value);
new_input = new_input.replace(&format!(".{}.", value), ".").to_string();
}
}

new_input
}

Expand Down
28 changes: 28 additions & 0 deletions soda_resource_tools_lib/tests/movie_and_tv_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -5964,6 +5964,34 @@
"release_group": "MNHD-FRD",
"container": "mkv"
}
},
{
"title": "Gone.with.the.Wind.1939.BluRay.1080p.x265.10bit.9Audio.MnHD-FRDS.mkv",
"metadata": {
"cn_name": "",
"en_name": "Gone with the Wind",
"year": "1939",
"resolution": "1080p",
"source": "BluRay",
"video_codec": "H.265",
"audio_codec": "9Audio",
"release_group": "MnHD-FRDS",
"container": "mkv"
}
},
{
"title": "A.One.and.a.Two.2000.CC.BluRay.1080p.x265.10bit.3Audio-FRDS.mkv",
"metadata": {
"cn_name": "",
"en_name": "A One and a Two",
"year": "2000",
"resolution": "1080p",
"source": "BluRay",
"video_codec": "H.265",
"audio_codec": "3Audio",
"release_group": "FRDS",
"container": "mkv"
}
}
]
}

0 comments on commit 16e6aab

Please sign in to comment.