More > JRiver Media Center 23 for Linux
[23.0.102; Issue; Partially Solved] System hibernates while media is playing
Gatherum:
I'm intrigued. What do you mean?
BryanC:
--- Quote from: Schmengie on March 28, 2018, 12:25:05 pm ---I'm intrigued. What do you mean?
--- End quote ---
/usr/lib/pm-utils/sleep.d/10-jriver-preventsleep.sh
--- Code: ---#!/usr/bin/env bash
x=0
x=$(curl -s -u user:pass --request GET http://localhost:52199/MCWS/v1/Playback/Info | grep -oP '(?<=<Item Name="State">).*?(?=</Item>)')
[ "$x" -eq 0 ] && return 0 || return 1
--- End code ---
If pm-utils is not available on your distro you can use xdotool to keep the computer awake:
--- Code: ---#!/usr/bin/env bash
while true; do
x=0
x=$(curl -s -u user:pass --request GET http://localhost:52199/MCWS/v1/Playback/Info | grep -oP '(?<=<Item Name="State">).*?(?=</Item>)')
[ "$x" -eq 0 ] && sleep 5 || {xdotool key shift; sleep 15}
done
--- End code ---
Gatherum:
Interesting. I'll have to try it when I get home.
Will this also work for hibernation, or would I need to modify the code for it to do so?
BryanC:
--- Quote from: Schmengie on March 29, 2018, 11:27:56 am ---Interesting. I'll have to try it when I get home.
Will this also work for hibernation, or would I need to modify the code for it to do so?
--- End quote ---
It should work for either. You can also call the first option from systemd if you prefer, as a requirement for sleep.target or hybrid-sleep.target (or whatever your distro ships with).
bob:
--- Quote from: BryanC on March 29, 2018, 05:03:56 am ---/usr/lib/pm-utils/sleep.d/10-jriver-preventsleep.sh
--- Code: ---#!/usr/bin/env bash
x=0
x=$(curl -s -u user:pass --request GET http://localhost:52199/MCWS/v1/Playback/Info | grep -oP '(?<=<Item Name="State">).*?(?=</Item>)')
[ "$x" -eq 0 ] && return 0 || return 1
--- End code ---
If pm-utils is not available on your distro you can use xdotool to keep the computer awake:
--- Code: ---#!/usr/bin/env bash
while true; do
x=0
x=$(curl -s -u user:pass --request GET http://localhost:52199/MCWS/v1/Playback/Info | grep -oP '(?<=<Item Name="State">).*?(?=</Item>)')
[ "$x" -eq 0 ] && sleep 5 || {xdotool key shift; sleep 15}
done
--- End code ---
--- End quote ---
That's an interesting way of handling the issue at the user level.
I'm late to this thread but MC on linux is only doing low level operations to prevent hdmi from blanking using xset on the monitor sleep period and blanking. It doesn't do any dbus operations.
Navigation
[0] Message Index
[*] Previous page
Go to full version