Use relative path when running ffprobe.
Avoids problems where directory name starts with something that looks like and unknown protocol, i.e. 'AVP: Alien vs. Predator (2004)'
This commit is contained in:
parent
6f579326b5
commit
297124eedb
@ -234,7 +234,7 @@ pub struct MovieLibrary {
|
||||
root: String,
|
||||
}
|
||||
|
||||
fn json_metadata_for_path<P: AsRef<OsStr>>(path: P) -> Result<String, Error> {
|
||||
fn json_metadata_for_path<P: AsRef<Path> + AsRef<OsStr>>(path: P) -> Result<String, Error> {
|
||||
let mut cmd = Command::new("ffprobe");
|
||||
// TODO(wathiede): maybe add "-select_streams v"
|
||||
cmd.args(&[
|
||||
@ -245,8 +245,9 @@ fn json_metadata_for_path<P: AsRef<OsStr>>(path: P) -> Result<String, Error> {
|
||||
"-show_format",
|
||||
"-show_error",
|
||||
"-show_streams",
|
||||
"-i",
|
||||
])
|
||||
.arg(path);
|
||||
.arg(Path::new("./").join(path));
|
||||
info!(target: "json", "cmd {:?}", cmd);
|
||||
let output = cmd.output()?;
|
||||
if output.status.success() {
|
||||
@ -385,6 +386,9 @@ impl MovieLibrary {
|
||||
|
||||
pub fn update_metadata(&self) -> Result<Vec<String>, Error> {
|
||||
let path = Path::new(&self.root).join(FULL_METADATA_FILENAME);
|
||||
// TODO(wathiede): if we fail to parse the old file (i.e. file not found), create an empty
|
||||
// old_metadata and keep going.
|
||||
|
||||
// Open the file in read-only mode with buffer.
|
||||
let f = File::open(&path).context(format!("open {}", path.display()))?;
|
||||
let r = BufReader::new(f);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user