ParadoxSpiral / libmpv-rs

A libmpv abstraction written in rust that's easy to use and provides the ability to read next to all video and audio codecs.
GNU Lesser General Public License v2.1
99 stars 35 forks source link

Broken `playlist_load_files` with mpv `v0.38.0` due to changed `loadfile` arguments #39

Open marco-04 opened 5 months ago

marco-04 commented 5 months ago

The current version of mpv changed the loadfile instruction to take these arguments:

loadfile <url> [<flags> [<index> [<options>]]]

(from https://mpv.io/manual/stable/#command-interface-[%3Coptions%3E]]]) where index is a newly added argument.

The current implementation of playlist_load_files is

    pub fn playlist_load_files(&self, files: &[(&str, FileState, Option<&str>)]) -> Result<()> {
        for (i, elem) in files.iter().enumerate() {
            let args = elem.2.unwrap_or("");

            let ret = self.command(
                "loadfile",
                &[&format!("\"{}\"", elem.0), elem.1.val(), args],
            );

            if let Err(err) = ret {
                return Err(Error::Loadfiles {
                    index: i,
                    error: ::std::rc::Rc::new(err),
                });
            }
        }
        Ok(())
    }

and the args variable now takes the place of the new index argument.

(for reference, this was the old specification: https://web.archive.org/web/20240414164307/https://mpv.io/manual/stable/#command-interface-[%3Coptions%3E]])