Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to automatically play DVD or Blu-ray ISO files? #13712

Closed
Solarunit opened this issue Mar 16, 2024 · 9 comments
Closed

How to automatically play DVD or Blu-ray ISO files? #13712

Solarunit opened this issue Mar 16, 2024 · 9 comments

Comments

@Solarunit
Copy link

Solarunit commented Mar 16, 2024

I figured out how to play DVD or Blu-ray ISO files from the terminal using:

mpv bd:// --bluray-device=[path-to-bluray-iso] for Blu-ray ISO

and

mpv dvd:// --dvd-device=[path-to-dvd-iso] for DVD ISO

The question is how to play those iso files automatically? Like mpv [path-to-iso] will detect if it's DVD ISO or Blu-ray ISO and will play it.

Is there a condition I can put into mpv.conf?
Or maybe it's possible with some lua script? Maybe there is already such script?

@dyphire
Copy link
Contributor

dyphire commented Mar 26, 2024

For the lua script, you can refer to the relevant implementation in the open_dialog.lua script.

@Solarunit
Copy link
Author

Solarunit commented Mar 26, 2024

@dyphire interesting, I will check it out, thanks.

@Solarunit
Copy link
Author

Solarunit commented Mar 28, 2024

I am new to lua, how to get file path/basename in mpv [file-path]?
I am trying mp.get_property(path) without success so far

@guidocella
Copy link
Contributor

mp.get_property('filename')

@Solarunit
Copy link
Author

when printing print(mp.get_property('filename')):

nil property unavailable

@guidocella
Copy link
Contributor

mp.register_event('file-loaded', function()
    print(mp.get_property('filename'))
end)

@Solarunit
Copy link
Author

Solarunit commented Mar 28, 2024

it doesn't print anything for me :(

it works! Thanks!

@Solarunit
Copy link
Author

Solarunit commented Mar 28, 2024

with my test lua script I can redirect dvd iso file to

local function open_dvd(path)
    mp.set_property('dvd-device', path)
    mp.commandv('loadfile', 'dvd://')
end

but not for bluray iso 😢

[file] Opening file.iso
....

[cplayer] Opening failed or was aborted: file.iso
...

[cplayer] finished playback, unrecognized file format (reason 4)

Unlike dvd iso it can't start playback bluray iso file, so we will never get to this point in lua script:

mp.register_event('file-loaded', function()

update: I have some progress with 'start-file' event

mp.register_event('start-file', function()

@Solarunit
Copy link
Author

I have some progress with the script. I can redirect bluray iso file to open_bluray(path) function too.
What is the proper way to get parent directory of some directory in lua?

Like: path = /dir1/dir2/

and I need to get /dir1/ path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants