Forum

Full Version: Pause download package when video is playing.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
You would like to mantain their group so they create files with the same group as xbian? right?
What I did in my setup is have all the processes that I want to be stopped executed by the group "download" but I added that group as a secondary one for each user so that when they create files they do it with the same user as Xbian.
It's posible to add them by name, you should modify the "startall.py" and "stopall.py" files so that they stop processes by name.
Might be a stupid question Wink
But isn't it just way easier to renice all deamons to a 19 except the xbmc process ? That would just do the on-demand scheduling ?
Remember that it's not only the CPU that is slowing XBMC down but also the disk activity.
Back on alpha 4 (or maybe 3) I tried doing that, my script just set "renice 19" and "ionice idle". Even with that I couldn't play DTS (I even had problems doing so with xbmc process alone) that's why I did this script.
But probably now, with all the great progress that XBMC has achieved it's possible because even with the most demanding videos I still get like 80-85% cpu usage.
Anyway, the problem is that the only difficult part is maybe setting sudo no-passwd and that part would still be needed.
that should be relatively easy. You can edit the sudoers file to allow certain users/groups to sudo without a password.

Security wise it would be best to only allow sudo this way on a executable that you create, and only grant modify access to root.

(25th Mar, 2013 10:22 PM)Trinket Wrote: [ -> ]Back on alpha 4 (or maybe 3) I tried doing that, my script just set "renice 19" and "ionice idle". Even with that I couldn't play DTS (I even had problems doing so with xbmc process alone) that's why I did this script.
But probably now, with all the great progress that XBMC has achieved it's possible because even with the most demanding videos I still get like 80-85% cpu usage.
Anyway, the problem is that the only difficult part is maybe setting sudo no-passwd and that part would still be needed.
I read through this topic and the idea seems simple (tie all download related processes to a user group and pause this group if video plyback started) but for a Linux newbie and non-programmer a bit out of my league. Any chance we'll see this integrated in Xbian Config?
(26th Mar, 2013 08:01 AM)zilexa Wrote: [ -> ]I read through this topic and the idea seems simple (tie all download related processes to a user group and pause this group if video plyback started) but for a Linux newbie and non-programmer a bit out of my league. Any chance we'll see this integrated in Xbian Config?

If someone wants to do it, then yes. However, i would like to see a start/stop procedure through the init script instead of kill commands.
This would be very usefull for me, but I can not seem to make ik work. I think I followed all the steps correctly.

Added the addon
Chown to root with chmod 755
Could not change the chmod +x, but this seemed to be standard by checking with command file.
Changed transmission init.d
Downloaded init.d for sickbeard from this forum
Changed settings
Both processes run in group download.
Added lines to visudo and changed "xbian" to "pi" because i run Raspbmc (might that be a problem?)

If I check ps -g download it still says transmission-da and sickbeard (the only two processes I have for now) even if screensaver (dim) is off.

I used the init.d from this forum for sickbeard and just changed the standard init.d for transmission. So I would guess the sickbead python should stop.
(I scheduled transmission to download only at night)

Is there any way there could be a XBMC notification to check if the script ran successfully?

If you need a more detailed destruction of my situation, I can take the time to write this. For now I hope you can help.
(5th Oct, 2013 08:35 PM)cjvanzwol Wrote: [ -> ]This would be very usefull for me, but I can not seem to make ik work. I think I followed all the steps correctly.

Added the addon
Chown to root with chmod 755
Could not change the chmod +x, but this seemed to be standard by checking with command file.
Changed transmission init.d
Downloaded init.d for sickbeard from this forum
Changed settings
Both processes run in group download.
Added lines to visudo and changed "xbian" to "pi" because i run Raspbmc (might that be a problem?)

If I check ps -g download it still says transmission-da and sickbeard (the only two processes I have for now) even if screensaver (dim) is off.

I used the init.d from this forum for sickbeard and just changed the standard init.d for transmission. So I would guess the sickbead python should stop.
(I scheduled transmission to download only at night)

Is there any way there could be a XBMC notification to check if the script ran successfully?

If you need a more detailed destruction of my situation, I can take the time to write this. For now I hope you can help.

The processes doesn't dissapear from the process list, because they only get paused.
To see if a process is paused just check it's status. You can see it like this with ps | grep transmission
Terminal
xbian 1429 11.9 2.2 51972 8624 ? TNl Oct03 304:31 /usr/local /bin/transmission-daemon -f -g /etc/transmission/
That process is paused because it has a T in the status section.
Terminal
xbian 1429 11.8 2.1 51972 8396 ? SNl Oct03 304:33 /usr/local/bin/transmission-daemon -f -g /etc/transmission/
You can see there that the T has changed to an S, that means it isn't paused.

To check if you have done the visudo part correctly, try to do something with privileges to the file (with the sudo command) and check if it asks for your password.
Terminal
xbian@xbian ~ $ sudo -K
xbian@xbian ~ $ sudo nano /home/xbian/.xbmc/addons/service.procmanager/resources/startall.py
The sudo -K command is to reset the sudo password cache, so that it asks for it even if you've just used it
If you've done it right, it shouldn't ask for a password.

I should say that I'm now using just the priority to manage the background processes, I don't stop them when playing stuff, I just make their priority really low and the xbmc one high, so that it always gives cpu preference to xbmc.
I have been testing it for a little while because that's the way that xbian download package works and wanted to try it out.
Sometimes you can have a bit of stuttering, but just in the beginning, when it's starting to redistribute the cpu.
Try it out! It's a lot easier and maybe it does the job for you!
I have written a guide on managing process priorities if you don't know how to implement it
http://forum.xbian.org/thread-892.html
I'm now using priority 6 (low) for the downloads and -6 for xbmc.
Nevertheless, if you still want to completely pause the downloads I can help you.

PD: You should try xbian, it works great and it has an already configurated package that automatically installs couchpotato,sickbeard,transmission,headphones,nzbget. (You can easily disable each of them if you want to)
Here is the thread http://forum.xbian.org/thread-1018.html
(5th Oct, 2013 09:14 PM)Trinket Wrote: [ -> ]
Terminal
xbian 1429 11.9 2.2 51972 8624 ? TNl Oct03 304:31 /usr/local /bin/transmission-daemon -f -g /etc/transmission/
That process is paused because it has a T in the status section.
Terminal
xbian 1429 11.8 2.1 51972 8396 ? SNl Oct03 304:33 /usr/local/bin/transmission-daemon -f -g /etc/transmission/
You can see there that the T has changed to an S, that means it isn't paused.

Ok, tnx.
Visudo is handled correctly.

So both processes stay on S when xbmc goes into dim.

Any idea how this is caused. Or better how this is solved?

So I found out some more.
Since I'm running raspbmc, the location of the addon was not correctly stated in de default.py.

I changed xbian to pi, since that is what the home folder is called on raspbmc.
The addon was calling the recources scripts from a unexisting path.

Still the processes are still not paused, though.
There will likely be no further development for this since the newest versions of the download packages include support for process priority handling with NICE. Just FYI. I did find a solution when I was trying to make this happen though. I found an xbmc plug in that would run a script when certain xbmc actions occurred (play/pause/screensaver start/screensaver stop/etc). I ended up running a script to stop the services when the screensaver stopped and start them when the screensaver started. That gave me pretty good responsiveness when I ran it. Sorry I don't have the name of the plugin since it was many installs ago.
(6th Oct, 2013 04:55 AM)adepssimius Wrote: [ -> ]I found an xbmc plug in that would run a script when certain xbmc actions occurred (play/pause/screensaver start/screensaver stop/etc). I ended up running a script to stop the services when the screensaver stopped and start them when the screensaver started. That gave me pretty good responsiveness when I ran it. Sorry I don't have the name of the plugin since it was many installs ago.

Tnx for the advice. The plugin you suggested works.

http://forum.xbmc.org/showthread.php?tid=151011
(7th Oct, 2013 07:46 AM)cjvanzwol Wrote: [ -> ]
(6th Oct, 2013 04:55 AM)adepssimius Wrote: [ -> ]I found an xbmc plug in that would run a script when certain xbmc actions occurred (play/pause/screensaver start/screensaver stop/etc). I ended up running a script to stop the services when the screensaver stopped and start them when the screensaver started. That gave me pretty good responsiveness when I ran it. Sorry I don't have the name of the plugin since it was many installs ago.

Tnx for the advice. The plugin you suggested works.

http://forum.xbmc.org/showthread.php?tid=151011

So you've fixed it? If you still want to check it, there are debug messages printed to the xbmc.log.
You should search for:
PHP Code:
[Process Manager]**Working** 
And when screensaver kicks in:
PHP Code:
[Process Manager]XBMC in Standby 

If you don't see them, then the script isn't running.
Pages: 1 2 3
Reference URL's