Import pipeline: probe, hardlink, rename, layout (#82)
This commit was merged in pull request #82.
This commit is contained in:
@@ -332,6 +332,27 @@ pub fn parse(name: &str) -> NameClaims {
|
||||
claims
|
||||
}
|
||||
|
||||
/// Collapse a release name to the blacklist key (`DESIGN.md` §6.3): lowercase,
|
||||
/// every run of non-alphanumerics as one dot. The same release reappearing
|
||||
/// with different separators or a different infohash still matches.
|
||||
#[must_use]
|
||||
pub fn normalise(name: &str) -> String {
|
||||
let mut out = String::with_capacity(name.len());
|
||||
let mut pending_gap = false;
|
||||
for character in name.chars() {
|
||||
if character.is_alphanumeric() {
|
||||
if pending_gap && !out.is_empty() {
|
||||
out.push('.');
|
||||
}
|
||||
pending_gap = false;
|
||||
out.extend(character.to_lowercase());
|
||||
} else {
|
||||
pending_gap = true;
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
fn apply_marker(claims: &mut NameClaims, sources: &mut Vec<Source>, m: Marker) {
|
||||
match m {
|
||||
Marker::Resolution(r) => {
|
||||
|
||||
Reference in New Issue
Block a user