INTERACT FORUM

More => Old Versions => JRiver Media Center 24 for Linux => Topic started by: mogman on May 21, 2018, 08:07:34 am

Title: MC24 wont run on startup in Debian stretch
Post by: mogman on May 21, 2018, 08:07:34 am
I have MediaCenter 24 installed on Debian 9 Stretch. In Options I have selected in Linux Startup to have Media Center run. Media Center does not run on Startup. Anyone else have this issue?
Title: Re: MC24 wont run on startup in Debian stretch
Post by: Awesome Donkey on May 21, 2018, 08:30:00 am
The startup options in MC don't work under Linux, only Windows and Mac. In my opinion, these options should be hidden on Linux since they don't do anything. It may be difficult to supporting startup options within MC on Linux due to the differences in desktop environments, X or Wayland being used, systemd being used (or not being used), might/likely would require root/sudo to add/enable things like systemd scripts, etc.

If you're using GNOME, the easiest way to start MC on Linux startup is to install the Tweak Tool (gnome-tweak-tool), open it and go to Startup Applications and manually add MC there.
Title: Re: MC24 wont run on startup in Debian stretch
Post by: geier22 on May 21, 2018, 08:52:39 am
You can create a desktop file and copy it to the folder.
~ / .config / autostart /
That should work in all surfaces.
The delay can be a bit shorter. In any case, the desktop should be fully charged first.
For Xfce ~/.config/autostart/Mediacenter 24.desktop:
Code: [Select]
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=Mediacenter 24
Comment=
Exec=sh -c "sleep 20; /usr/bin/mediacenter24"
StartupNotify=false
Terminal=false
Hidden=false
Title: Re: MC24 wont run on startup in Debian stretch
Post by: bob on May 21, 2018, 08:58:47 am
The startup options in MC don't work under Linux, only Windows and Mac. In my opinion, these options should be hidden on Linux since they don't do anything. It may be difficult to supporting startup options within MC on Linux due to the differences in desktop environments, X or Wayland being used, systemd being used (or not being used), might/likely would require root/sudo to add/enable things like systemd scripts, etc.

If you're using GNOME, the easiest way to start MC on Linux startup is to install the Tweak Tool (gnome-tweak-tool), open it and go to Startup Applications and manually add MC there.
Agreed. I'll remove them.
Title: Re: MC24 wont run on startup in Debian stretch
Post by: Awesome Donkey on May 21, 2018, 09:06:02 am
You could also create a systemd service, something like mwillems posted here: https://yabb.jriver.com/interact/index.php/topic,115514.0.html
Title: Re: MC24 wont run on startup in Debian stretch
Post by: Awesome Donkey on May 21, 2018, 09:10:27 am
Agreed. I'll remove them.

Actually, if indeed adding a Media Center 24.desktop file to ~/.config/autostart/ works for all desktop environments, X and Wayland (with XWayland), you might be able to add support for startup options on Linux. Just would need a normal entry (like geier22 posted above) and one for /MediaServer. Of course, if a Media Center 24.desktop already existed in that folder, it'd have to be overridden (or removed) when changing that option. Adding a startup delay (for the sleep variable) might be useful too on Linux.

This would need to be tested, obviously, but in theory it *should* work and it shouldn't require root/sudo to add a .desktop file to that directory - not sure if you'd have to set specific permissions for the file though so it could be edited/removed within MC if desired.

I'll test this right now and see if it works.
Title: Re: MC24 wont run on startup in Debian stretch
Post by: bob on May 21, 2018, 09:22:50 am
Actually, if indeed adding a Media Center 24.desktop file to ~/.config/autostart/ works for all desktop environments, X and Wayland (with XWayland), you might be able to add support for startup options on Linux. Just would need a normal entry (like geier22 posted above) and one for /MediaServer. Of course, if a Media Center 24.desktop already existed in that folder, it'd have to be overridden (or removed) when changing that option. Adding a startup delay (for the sleep variable) might be useful too on Linux.

This would need to be tested, obviously, but in theory it *should* work and it shouldn't require root/sudo to add a .desktop file to that directory - not sure if you'd have to set specific permissions for the file though so it could be edited/removed within MC if desired.

I'll test this right now and see if it works.
Ok, interesting...
Title: Re: MC24 wont run on startup in Debian stretch
Post by: bob on May 21, 2018, 09:26:18 am
You can create a desktop file and copy it to the folder.
~ / .config / autostart /
That should work in all surfaces.
The delay can be a bit shorter. In any case, the desktop should be fully charged first.
For Xfce ~/.config/autostart/Mediacenter 24.desktop:
Code: [Select]
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=Mediacenter 24
Comment=
Exec=sh -c "sleep 20; /usr/bin/mediacenter24"
StartupNotify=false
Terminal=false
Hidden=false
Instead of a delay, we could add a test here for X startup (like look for /tmp/.X0-lock existence).
Would also need a test for desktop startup which I assume will be more complex since there is more than one possibility.
Title: Re: MC24 wont run on startup in Debian stretch
Post by: Awesome Donkey on May 21, 2018, 09:35:56 am
I named it Media Center 24.desktop and used this to autostart normal MC on boot...

Code: [Select]
[Desktop Entry]
Type=Application
Name=Media Center 24
Comment=JRiver Media Center 24
Exec=/usr/bin/mediacenter24 %F
Terminal=false
StartupWMClass=Media_Center_24
StartupNotify=true
Hidden=false

It works. I tested this too for Media Server...

Code: [Select]
[Desktop Entry]
Type=Application
Name=Media Center 24
Comment=JRiver Media Center 24
Exec=/usr/bin/mediacenter24 %F /MediaServer
Terminal=false
StartupWMClass=Media_Center_24
StartupNotify=true
Hidden=false

Seems to work too, but it starts MC and minimizes it immediately. Though, honestly, this would be less than ideal since Media Server starts MC in the system tray on Windows and the menu bar on Mac. Of course, it's probably not easy to do on Linux due to differences in desktop environments.

I also tested using sleep like geier22 posted above...

Code: [Select]
[Desktop Entry]
Type=Application
Name=Media Center 24
Comment=JRiver Media Center 24
Exec=sh -c "sleep 10; /usr/bin/mediacenter24"
Terminal=false
StartupWMClass=Media_Center_24
StartupNotify=true
Hidden=false

This works, so startup delay could be used... now, let's test this with Media Server...

Code: [Select]
[Desktop Entry]
Type=Application
Name=Media Center 24
Comment=JRiver Media Center 24
Exec=sh -c "sleep 10; /usr/bin/mediacenter24 /MediaServer"
Terminal=false
StartupWMClass=Media_Center_24
StartupNotify=true
Hidden=false

Seems to work too. Now, we can consolidate this to two entries instead of four; Media Center and Media Server. Here's what I'd recommend to use for Media Center (sleep is optional. sleep 0 = no delay)...

Code: [Select]
[Desktop Entry]
Type=Application
Name=Media Center 24
Comment=JRiver Media Center 24
Exec=sh -c "sleep 0; /usr/bin/mediacenter24"
Terminal=false
StartupWMClass=Media_Center_24
StartupNotify=true
Hidden=false

And here's what I'd recommend to use for Media Server (again sleep is optional. sleep 0 = no delay)...

Code: [Select]
[Desktop Entry]
Type=Application
Name=Media Center 24
Comment=JRiver Media Center 24
Exec=sh -c "sleep 0; /usr/bin/mediacenter24 /MediaServer"
Terminal=false
StartupWMClass=Media_Center_24
StartupNotify=true
Hidden=false

Tada! I'll test these under Ubuntu, Linux Mint, Arch Linux, etc. It *should* work fine with all of them though.
Title: Re: MC24 wont run on startup in Debian stretch
Post by: Awesome Donkey on May 21, 2018, 09:38:04 am
Instead of a delay, we could add a test here for X startup (like look for /tmp/.X0-lock existence).
Would also need a test for desktop startup which I assume will be more complex since there is more than one possibility.

Whichever's easier. :P

BTW, it works in Ubuntu, Linux Mint, Arch Linux, etc. Each with different desktop environments so it *should* work for everything. Also it doesn't require any special read/write permissions so it should work fine without needing sudo or chmod (or +x). Don't got any Raspberry Pis around so I can't test it on ARM/Raspbian but it should work there too.

IMO, using a slight delay as a default (e.g. sleep 5) would probably be a good idea otherwise MC pops up immediately when the DE is loading.
Title: Re: MC24 wont run on startup in Debian stretch
Post by: bob on May 21, 2018, 10:40:53 am
Whichever's easier. :P

BTW, it works in Ubuntu, Linux Mint, Arch Linux, etc. Each with different desktop environments so it *should* work for everything. Also it doesn't require any special read/write permissions so it should work fine without needing sudo or chmod (or +x). Don't got any Raspberry Pis around so I can't test it on ARM/Raspbian but it should work there too.

IMO, using a slight delay as a default (e.g. sleep 5) would probably be a good idea otherwise MC pops up immediately when the DE is loading.
I assume this works after one logs in or if the computer is set to autologin on power-up ?
Title: Re: MC24 wont run on startup in Debian stretch
Post by: geier22 on May 21, 2018, 11:17:03 am
I assume this works after one logs in or if the computer is set to autologin on power-up ?

I only use autologin. It works in KDE / LXQT and Xfce. I think there is no difference to a manual login.
Title: Re: MC24 wont run on startup in Debian stretch
Post by: Awesome Donkey on May 21, 2018, 11:28:03 am
No difference between normal login and auto login, works just the same. I tested GNOME, Cinnamon and KDE Plasma.
Title: Re: MC24 wont run on startup in Debian stretch
Post by: bob on May 21, 2018, 11:32:03 am
I assume it won't startup unless you autologin?
Title: Re: MC24 wont run on startup in Debian stretch
Post by: Awesome Donkey on May 21, 2018, 01:03:04 pm
Okay, I've tested this some more...

I assume it won't startup unless you autologin?

It works logging in normally (meaning there's a login screen of the display manager, then inputting password then the DE starting and then MC will start) and it works when autologging in. So no, autologin isn't required for this to work. But I'd definitely recommend putting at least a 5 second delay/sleep or else the MC window will appear immediately when the DE starts.

Here's what I'm testing right now for starting Media Center itself at start...

Code: [Select]
[Desktop Entry]
Type=Application
Name=Media Center 24
Comment=JRiver Media Center 24
Exec=sh -c "sleep 5; /usr/bin/mediacenter24"
Terminal=false
StartupWMClass=Media_Center_24
StartupNotify=true
Hidden=false

And for starting Media Server itself at start...

Code: [Select]
[Desktop Entry]
Type=Application
Name=Media Center 24
Comment=JRiver Media Center 24
Exec=sh -c "sleep 5; /usr/bin/mediacenter24 /MediaServer"
Terminal=false
StartupWMClass=Media_Center_24
StartupNotify=true
Hidden=false

So far it's working fine in all tests, even under Wayland (with XWayland).
Title: Re: MC24 wont run on startup in Debian stretch
Post by: bob on May 21, 2018, 01:07:22 pm
Okay, I've tested this some more...

It works logging in normally (meaning there's a login screen of the display manager, then inputting password then the DE starting and then MC will start) and it works when autologging in. So no, autologin isn't required for this to work. But I'd definitely recommend putting at least a 5 second delay/sleep or else the MC window will appear immediately when the DE starts.

Here's what I'm testing right now for Media Center itself...

Code: [Select]
[Desktop Entry]
Type=Application
Name=Media Center 24
Comment=JRiver Media Center 24
Exec=sh -c "sleep 5; /usr/bin/mediacenter24"
Terminal=false
StartupWMClass=Media_Center_24
StartupNotify=true
Hidden=false

And Media Server...

Code: [Select]
[Desktop Entry]
Type=Application
Name=Media Center 24
Comment=JRiver Media Center 24
Exec=sh -c "sleep 5; /usr/bin/mediacenter24 /MediaServer"
Terminal=false
StartupWMClass=Media_Center_24
StartupNotify=true
Hidden=false

So far it's working fine in all tests, even under Wayland (with XWayland).
I just implemented this, it will be in the next build.
Thanks for all the help Geier22 and A.D.
Title: Re: MC24 wont run on startup in Debian stretch
Post by: mogman on May 21, 2018, 01:21:39 pm
Thanks all for the help. I used the gnome-tweak-tool and that took care of the problem
Title: Re: MC24 wont run on startup in Debian stretch
Post by: Awesome Donkey on May 21, 2018, 02:21:48 pm
Thanks all for the help. I used the gnome-tweak-tool and that took care of the problem

With the next build, the startup option(s) should work.