mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-14 03:42:30 +02:00
some refactorings,
hls processing URI attribute
This commit is contained in:
@@ -90,7 +90,7 @@ async fn index(
|
||||
if let Some(web_ui_path) = &app_state.config.web_ui.as_ref().and_then(|c| c.path.as_ref()) {
|
||||
match tokio::fs::read_to_string(&path).await {
|
||||
Ok(content) => {
|
||||
let mut new_content = CONSTANTS.base_href.replace_all(&content, |caps: ®ex::Captures| {
|
||||
let mut new_content = CONSTANTS.re_base_href.replace_all(&content, |caps: ®ex::Captures| {
|
||||
format!(r#"{}="/{web_ui_path}/{}""#, &caps[1], &caps[2])
|
||||
}).to_string();
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ fn get_download_directory(download_cfg: &VideoDownloadConfig, filestem: &str) ->
|
||||
}
|
||||
}
|
||||
}
|
||||
let dir_name = CONSTANTS.remove_filename_ending.replace(stem, "");
|
||||
let dir_name = CONSTANTS.re_remove_filename_ending.replace(stem, "");
|
||||
let file_dir: PathBuf = [download_cfg.directory.as_ref().unwrap(), dir_name.as_ref()].iter().collect();
|
||||
file_dir
|
||||
} else {
|
||||
@@ -71,7 +71,7 @@ impl FileDownload {
|
||||
pub fn new(req_url: &str, req_filename: &str, download_cfg: &VideoDownloadConfig) -> Option<Self> {
|
||||
match reqwest::Url::parse(req_url) {
|
||||
Ok(url) => {
|
||||
let tmp_filename = CONSTANTS.filename.replace_all(&deunicode(req_filename)
|
||||
let tmp_filename = CONSTANTS.re_filename.replace_all(&deunicode(req_filename)
|
||||
.replace(' ', "_"), "")
|
||||
.replace("__", "_")
|
||||
.replace("_-_", "-");
|
||||
|
||||
Reference in New Issue
Block a user