Page 2 of 2

Re: J. River Media Center Command Sender

Posted: Fri Aug 10, 2018 1:08 am
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

Re: J. River Media Center Command Sender

Posted: Fri Aug 10, 2018 1:38 am
by kgschlosser
change out

Code: Select all

except WindowsError:
    pass

with

Code: Select all

except WindowsError:
    raise

Re: J. River Media Center Command Sender

Posted: Fri Aug 10, 2018 2:07 am
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

Re: J. River Media Center Command Sender

Posted: Sun Feb 10, 2019 10:39 pm
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.

Re: J. River Media Center Command Sender

Posted: Mon Feb 11, 2019 7:17 pm
by jachin99
I'm not using JRiver at the moment but I shared a download link on their forums. Thanks.

Re: J. River Media Center Command Sender

Posted: Wed Jul 17, 2019 2:38 am
by jachin99
Any way you can upload that attachment? It was lost in the forum outrage. Thanks.

Re: J. River Media Center Command Sender

Posted: Wed Jul 17, 2019 7:34 am
by kgschlosser
I re uploaded it to the first post.

Re: J. River Media Center Command Sender

Posted: Wed Jul 17, 2019 4:21 pm
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.

Re: J. River Media Center Command Sender

Posted: Wed Jul 17, 2019 8:24 pm
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

Re: J. River Media Center Command Sender

Posted: Thu Jul 18, 2019 8:12 am
by kgschlosser
Removed

Re: J. River Media Center Command Sender

Posted: Thu Jul 18, 2019 8:31 am
by kgschlosser
I updated the plugin on the first post. It should work now.

Re: J. River Media Center Command Sender

Posted: Thu Jul 18, 2019 3:01 pm
by jachin99
That did the trick!!! Thanks :D