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

MediaInfo::EnvironmentError (/usr/local/bin/mediainfo cannot be found. Are you sure mediainfo is installed?) #28

Closed
rgaufman opened this issue May 24, 2018 · 3 comments
Assignees

Comments

@rgaufman
Copy link

I have mediainfo installed:

$ which mediainfo
/usr/bin/mediainfo
$ /usr/bin/env mediainfo --version
MediaInfo Command line,
MediaInfoLib - v0.7.82

However the gem is looking for it in the wrong place:

irb(main):004:0> media_info = MediaInfo.from('./bad-video-hikvision.mkv')
Traceback (most recent call last):
        5: from /usr/bin/irb:11:in `<main>'
        4: from (irb):4
        3: from /var/lib/gems/2.5.0/gems/mediainfo-1.0.1/lib/mediainfo.rb:86:in `from'
        2: from /var/lib/gems/2.5.0/gems/mediainfo-1.0.1/lib/mediainfo.rb:45:in `run'
        1: from /var/lib/gems/2.5.0/gems/mediainfo-1.0.1/lib/mediainfo.rb:12:in `location'
MediaInfo::EnvironmentError (/usr/local/bin/mediainfo cannot be found. Are you sure mediainfo is installed?)

It would be good if it would find it using /usr/bin/env and only fallback to the hardcoded path.

@NorseGaud
Copy link
Collaborator

From the README:

You can specify an alternate path for the MediaInfo Binary:
ENV['MEDIAINFO_PATH'] = "/opt/local/bin/mediainfo"

I decided to use /usr/local/bin/mediainfo as it is the default installation directory when you compile MediaInfo. The goal is to support the majority with little configuration, while supplying the ability for the few to configure for specific/custom needs.

With that said, I think /usr/bin/env is a way better idea than using the absolute path. Please make a pull request and I'll be sure to bring it in.

Thanks!

@NorseGaud NorseGaud self-assigned this Jun 20, 2018
@tbhi
Copy link

tbhi commented Dec 31, 2018

https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby has a discussion on how to search the path. Can we use something from here? Perhaps the ptools gem?

@NorseGaud
Copy link
Collaborator

Including this in the next release. Thanks for the great code @tbhi

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

3 participants