fix: pre_chunks schema + TMDb movie name extraction
- pre_chunks: add chunk_type, text_content columns; drop NOT NULL on coordinate_type/coordinate_index (INSERT statements reference these columns but CREATE TABLE was missing them) - run_migrations: add ALTER TABLE for existing databases - extract_movie_name: filter noise words (youtube, fps, 24fps, 1080p, pure digits) so 'Charade_YouTube_24fps' → 'Charade' - run-server-3002.sh: add companion worker startup (matching 3003 script)
This commit is contained in:
+25
-2
@@ -45,14 +45,37 @@ fn extract_movie_name(filename: &str) -> Option<String> {
|
||||
.file_stem()
|
||||
.and_then(|s| s.to_str())?;
|
||||
|
||||
// Take only the part before year patterns or separators
|
||||
let noise_words = [
|
||||
"youtube", "yt", "fps", "hd", "full", "movie", "official",
|
||||
"trailer", "teaser", "4k",
|
||||
];
|
||||
|
||||
let cleaned = name
|
||||
.replace(['.', '_'], " ")
|
||||
.split(|c: char| c == '(' || c == '[' || c == '│' || c == '|')
|
||||
.next()
|
||||
.unwrap_or(&name)
|
||||
.trim()
|
||||
.to_string();
|
||||
.split_whitespace()
|
||||
.filter(|w| {
|
||||
let lower = w.to_lowercase();
|
||||
if noise_words.contains(&lower.as_str()) {
|
||||
return false;
|
||||
}
|
||||
if w.chars().all(|c| c.is_ascii_digit()) {
|
||||
return false;
|
||||
}
|
||||
// Strip tokens like "24fps", "1080p", "60fps", "720p"
|
||||
if lower.ends_with("fps") || lower.ends_with('p') {
|
||||
let prefix = lower.trim_end_matches('p').trim_end_matches("fps");
|
||||
if prefix.chars().all(|c| c.is_ascii_digit()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
true
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ");
|
||||
|
||||
if cleaned.is_empty() || cleaned.len() < 3 {
|
||||
return None;
|
||||
|
||||
Reference in New Issue
Block a user