mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-01 05:22:28 +02:00
fixed rename issue, added perists filename output
This commit is contained in:
Regular → Executable
+1
-1
@@ -64,7 +64,7 @@ fn exec_rename(pli: &m3u::PlaylistItem, rename: &Vec<config::ConfigRename>) -> O
|
||||
if rename.len() > 0 {
|
||||
let mut result = pli.clone();
|
||||
for r in rename {
|
||||
let value = get_field_value(pli, &r.field);
|
||||
let value = get_field_value(&result, &r.field);
|
||||
let cap = r.re.as_ref().unwrap().replace_all(value, &r.new_name);
|
||||
let value = cap.into_owned();
|
||||
set_field_value(&mut result, &r.field, value);
|
||||
|
||||
+5
-4
@@ -79,12 +79,13 @@ fn download_content(url: Url, persist_file: Option<PathBuf>) -> Result<Vec<Strin
|
||||
fn persists_playlist(persist_file: Option<PathBuf>, text: &String) {
|
||||
match persist_file {
|
||||
Some(path_buf) => {
|
||||
match std::fs::File::create(path_buf) {
|
||||
let filename = &path_buf.to_str().unwrap_or("?");
|
||||
match std::fs::File::create(&path_buf) {
|
||||
Ok(mut file) => match file.write_all(text.as_bytes()) {
|
||||
Ok(_) => {},
|
||||
Err(e) => println!("failed to persist file {}", e)
|
||||
Ok(_) => println!("persisted: {}", filename),
|
||||
Err(e) => println!("failed to persist file {}, {}", filename, e)
|
||||
},
|
||||
Err(e) => println!("failed to persist file {}", e)
|
||||
Err(e) => println!("failed to persist file {}, {}", filename, e)
|
||||
}
|
||||
},
|
||||
None => {}
|
||||
|
||||
Reference in New Issue
Block a user