Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

J. River Media Center Command Sender

Questions and comments specific to a particular plugin should go here.
jachin99
Experienced User
Posts: 614
Joined: Sat Feb 13, 2016 8:39 pm

Re: J. River Media Center Command Sender

Post by jachin99 »

I get the j. river media center is not installed message with the above. Here is a capture of how I made the change
Capture.JPG
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: J. River Media Center Command Sender

Post by kgschlosser »

change out

Code: Select all

except WindowsError:
    pass

with

Code: Select all

except WindowsError:
    raise
If you like the work I have been doing then feel free to Image
jachin99
Experienced User
Posts: 614
Joined: Sat Feb 13, 2016 8:39 pm

Re: J. River Media Center Command Sender

Post by jachin99 »

With that change, I get

Code: Select all

Traceback (most recent call last) (0.5.0-rc4):
  File "C:\Program Files (x86)\EventGhost\eg\Classes\PluginInstanceInfo.py", line 102, in CreateInstance
    plugin.__init__()
  File "C:\ProgramData\EventGhost\plugins\JRiverCommands\__init__.py", line 3202, in __init__
    key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, reg_path)
WindowsError: [Error 2] The system cannot find the file specified
User avatar
topix
Experienced User
Posts: 441
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

Re: J. River Media Center Command Sender

Post by topix »

I think you have a 64Bit installation of J.River Media Center. I've made small changes to access the registry on 64Bit. Please test the attached version.
Attachments
JRiverCommands_0.1c.egplugin
(18.83 KiB) Downloaded 71 times
jachin99
Experienced User
Posts: 614
Joined: Sat Feb 13, 2016 8:39 pm

Re: J. River Media Center Command Sender

Post by jachin99 »

I'm not using JRiver at the moment but I shared a download link on their forums. Thanks.
jachin99
Experienced User
Posts: 614
Joined: Sat Feb 13, 2016 8:39 pm

Re: J. River Media Center Command Sender

Post by jachin99 »

Any way you can upload that attachment? It was lost in the forum outrage. Thanks.
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: J. River Media Center Command Sender

Post by kgschlosser »

I re uploaded it to the first post.
If you like the work I have been doing then feel free to Image
jachin99
Experienced User
Posts: 614
Joined: Sat Feb 13, 2016 8:39 pm

Re: J. River Media Center Command Sender

Post by jachin99 »

topix wrote: Sun Feb 10, 2019 10:39 pm I think you have a 64Bit installation of J.River Media Center. I've made small changes to access the registry on 64Bit. Please test the attached version.
Sorry, I should have been more specific. I have the 64 bit version of JRMC 25 installed. Thanks.
jachin99
Experienced User
Posts: 614
Joined: Sat Feb 13, 2016 8:39 pm

Re: J. River Media Center Command Sender

Post by jachin99 »

I tried looking through this post and doing it on my own but I still get a JRiver not installed message. Here is what I have for enumerating the registry

Code: Select all

def _get_reg_value(path, key):
    d = _read_reg_values(path)
    if key in d:
        return d[key]

    return ''


def _read_reg_keys(key):
    if isinstance(key, tuple):
        root = key[0]
        key = key[1]
    else:
        root = _winreg.HKEY_LOCAL_MACHINE
        key = 'SOFTWARE\\Wow6432Node' + key

    try:
        handle = _winreg.OpenKeyEx(root, key)
    except _winreg.error:
        return []
    res = []

    for i in range(_winreg.QueryInfoKey(handle)[0]):
        res += [_winreg.EnumKey(handle, i)]

    return res


def _read_reg_values(key):
    if isinstance(key, tuple):
        root = key[0]
        key = key[1]
    else:
        root = _winreg.HKEY_LOCAL_MACHINE
        key = 'SOFTWARE\\Wow6432Node' + key

    try:
        handle = _winreg.OpenKeyEx(root, key)
    except _winreg.error:
        return {}
    res = {}
    for i in range(_winreg.QueryInfoKey(handle)[1]):
        name, value, _ = _winreg.EnumValue(handle, i)
        res[_convert_mbcs(name)] = _convert_mbcs(value)

    return res


def _convert_mbcs(s):
    dec = getattr(s, "decode", None)
    if dec is not None:
        try:
            s = dec("mbcs")
        except UnicodeError:
            pass
    return s


class JRiverCommand(eg.PluginBase):

    def __init__(self):

        high_version = (0, 0, 0)
        self.jriver_exe = None
        self.jriver_cwd = None

        reg_path = r'J. River\\Media Core\\Installations\\Media Center 25'

        for reg_key in _read_reg_keys(reg_path):
            version = _get_reg_value(reg_path + '\\' + reg_key, 'Version')
            if version:
                version = tuple(int(v) for v in version.split('.'))
                if (
                    version[0] > high_version[0] or
                    (
                        version[0] == high_version[0] and
                        version[1] > high_version[1]
                    ) or
                    (
                        version[0] == high_version[0] and
                        version[1] == high_version[1] and
                        version[2] > high_version[2]
                    )
                ):
                    self.jriver_exe = _get_reg_value(
                        reg_path + '\\' + reg_key,
                        'Launcher Name'
                    )
                    self.jriver_cwd = _get_reg_value(
                        reg_path + '\\' + reg_key,
                        'Path'
                    )

                    high_version = version

        if self.jriver_exe is None:
            eg.PrintError('J. River Media Center is not installed.')

        action_list = ()
        for command_description in sorted(COMMANDS.keys()):
            command_data = COMMANDS[command_description]
            code = command_data['code']
            value = command_data['value']
            class_name = 'fn' + command_description.replace(' ', '_').upper()
            action_list += ((
                SendCommand,
                class_name,
                command_description,
                command_description,
                [code, value]
            ),)

        self.AddActionsFromList(action_list)

    def __stop__(self):
        pass

    def __start__(self):
        pass
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: J. River Media Center Command Sender

Post by kgschlosser »

Removed
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: J. River Media Center Command Sender

Post by kgschlosser »

I updated the plugin on the first post. It should work now.
If you like the work I have been doing then feel free to Image
jachin99
Experienced User
Posts: 614
Joined: Sat Feb 13, 2016 8:39 pm

Re: J. River Media Center Command Sender

Post by jachin99 »

That did the trick!!! Thanks :D
Post Reply