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

Honor the default video application on Linux #9

Open
probonopd opened this issue Jan 5, 2019 · 4 comments
Open

Honor the default video application on Linux #9

probonopd opened this issue Jan 5, 2019 · 4 comments

Comments

@probonopd
Copy link
Contributor

Instead of defaulting to VLC which may or may not be installed on the system, default to the system's default media player which can be queried like this:

me@host:~$ xdg-mime query default video/mp4
parole.desktop
@adamreichold
Copy link
Owner

The problem is that I pass a URL to this application and I need to be sure that it is able to handle streaming via e.g. HTTP in addition to the video format itself (which might also not be MPEG4).

Also having to start with a desktop file more or less implies that I have to parse that and understand its placeholder syntax to be able to execute the application and pass it that URL. (Well this somewhat answers the above question as I could look for %u instead of %f to determine whether streaming would be possible.) Is this functionality packaged up in the xdg utils somehow?

It might actually be simpler to hard-code a list of useful media players and check until a suitable one is found on the system?

@probonopd
Copy link
Contributor Author

probonopd commented Jan 6, 2019

I think it's OK to query like I do above for mp4 and use that video player as the default for all types of video.

It might actually be simpler to hard-code a list of useful media players and check until a suitable one is found on the system?

No, because there may be many on the system but only one is defined as the default by the user (or distribution).

@probonopd
Copy link
Contributor Author

probonopd commented Jan 6, 2019

Also having to start with a desktop file more or less implies that I have to parse that and understand its placeholder syntax to be able to execute the application and pass it that URL.

Simply find the desktop file, get the content of the Exec= key up to the first blank, and use that. Should work in 99% of time ;-)

I think it's better as a default than hardcoding vlc. Users can still change it.

@adamreichold
Copy link
Owner

adamreichold commented Jan 6, 2019

I agree that it is better to be correct 95% of the time than to be wrong albeit in a deterministic manner. So I basically introduced some shell in #12 to implement your above suggestions and fallback to the hard-coded VLC otherwise. Could please give the PR a try?

(And yes, I relented and switch to using uploadtool so there will be a transer.sh link on the PR page. (Running Travis locally is surprisingly complicated compared to GitLab CI. I should probably move this repository there when I have the time as this will simplify these things considerably due to the integrated artifact storage and such...))

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

No branches or pull requests

2 participants