diff --git a/Cargo.toml b/Cargo.toml index d3226dc..df8d0b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,11 +31,3 @@ async-trait = "0.1" unexpected_cfgs = "allow" # Or keep it as a warning but whitelist the cfg: # unexpected_cfgs = { level = "warn", check-cfg = ['cfg(has_error_description_deprecated)'] } - -# Enable a small amount of optimization in the dev profile. -[profile.dev] -opt-level = 1 - -# Enable a large amount of optimization in the dev profile for dependencies. -[profile.dev.package."*"] -opt-level = 3 diff --git a/src/providers/omgxxx.rs b/src/providers/omgxxx.rs index 1e05250..0a9cf3c 100644 --- a/src/providers/omgxxx.rs +++ b/src/providers/omgxxx.rs @@ -251,7 +251,7 @@ impl OmgxxxProvider { id: "sites".to_string(), title: "Sites".to_string(), description: "Filter for different Sites".to_string(), - systemImage: "list.bullet.indent".to_string(), + systemImage: "rectangle.stack".to_string(), colorName: "green".to_string(), options: sites, multiSelect: false, @@ -350,18 +350,18 @@ impl OmgxxxProvider { options: ServerOptions, ) -> Result> { let mut search_type = "search"; - if query.starts_with("@models:") { - search_type = "models"; + if query.starts_with("@") { + search_type = query.split(":").collect::>()[0].trim_start_matches("@"); } let video_url = format!( "{}/{}/{}/{}/", self.url, search_type, query + .split(":").collect::>()[1] .to_lowercase() .trim() - .replace(" ", "-") - .replace("@models:", ""), + .replace(" ", "-"), page ); // Check our Video Cache. If the result is younger than 1 hour, we return it. @@ -392,6 +392,18 @@ impl OmgxxxProvider { Ok(video_items) } + fn get_site_id_from_name(&self, site_name: &str) -> Option { + // site_name.to_lowercase().replace(" ", "") + for site in self.sites.read().unwrap().iter() { + if site.title.to_lowercase().replace(" ", "") == site_name.to_lowercase().replace(" ", "") { + return Some(site.id.clone()); + } + } + println!("Site not found for name: {}", site_name); + println!("All Sites: {:?}", self.sites.read().unwrap()); + return None; + } + fn get_video_items_from_html(&self, html: String) -> Vec { if html.is_empty() { println!("HTML is empty"); @@ -467,8 +479,10 @@ impl OmgxxxProvider { .split("\"") .collect::>()[0] .to_string(); - - let tags = match video_segment.contains("class=\"models\">") { + let site_name = title.split("]").collect::>().first().unwrap_or(&"").trim_start_matches("["); + let site_id = self.get_site_id_from_name(site_name).unwrap_or("".to_string()); + println!("Site: {}\nTitle: {}", site_id, title); + let mut tags = match video_segment.contains("class=\"models\">") { true => video_segment .split("class=\"models\">") .collect::>()[1] @@ -487,6 +501,9 @@ impl OmgxxxProvider { .to_vec(), false => vec![], }; + if !site_id.is_empty() { + tags.push(format!("@sites:{}", site_id)); + } let video_item = VideoItem::new( id,