31st Jan, 2013, 10:46 PM
Hi! I'm new to the forum altough i have been reading it for quite a while.
I have been working the last days in a script that detects when XBMC starts playing stuff and uses the signal SIGSTOP to pause all proceses related to downloads and then, when the video stops playing, it uses the signal SIGCONT to resume them.
I have created the following folder ~/.xbmc/addons/script.service.procmanager where I store my script with the addon.xml file, the script is as follows:
http://pastebin.com/VmkqecST
I had to call the startall.py and stopall.py with sudo rights because the downloads are managed by other users and xbian user dosen't have the rights to manage them (I added those files with visudo so that i don't need a password to execute them with sudo).
The startall.py and stopall.py are as follows:
http://pastebin.com/aSJnS0Tx
What I did to get the PID of each process related to downloads, is to add each user that started that kind of process to a common group "download" so, for example, sabnzbd is executed by user sabnzbd which is a member of the group download, same for transmission, couchpotato and sickbeard, they all belong to the group download. I just get the process list of that group of users and then i send a sigstop to each process.
The problem with this script is that i can't manage to autostart it within xbmc, my addon.xml looks as follows
http://pastebin.com/H5Tp2hRm
I'm new to python so I'm not sure if what I've done is right, the default.py script is a copy paste of things I found around internet.
According to what I've read, the addon.xml will tell XBMC which script to start and when, but it dosen't seem to work. I found information regarding a workaround involving autoexec.py file, which I couldn't find.
I would really appreciate some help here as I don't know how to continue or how to debug this process.
I have been working the last days in a script that detects when XBMC starts playing stuff and uses the signal SIGSTOP to pause all proceses related to downloads and then, when the video stops playing, it uses the signal SIGCONT to resume them.
I have created the following folder ~/.xbmc/addons/script.service.procmanager where I store my script with the addon.xml file, the script is as follows:
http://pastebin.com/VmkqecST
I had to call the startall.py and stopall.py with sudo rights because the downloads are managed by other users and xbian user dosen't have the rights to manage them (I added those files with visudo so that i don't need a password to execute them with sudo).
The startall.py and stopall.py are as follows:
http://pastebin.com/aSJnS0Tx
What I did to get the PID of each process related to downloads, is to add each user that started that kind of process to a common group "download" so, for example, sabnzbd is executed by user sabnzbd which is a member of the group download, same for transmission, couchpotato and sickbeard, they all belong to the group download. I just get the process list of that group of users and then i send a sigstop to each process.
The problem with this script is that i can't manage to autostart it within xbmc, my addon.xml looks as follows
http://pastebin.com/H5Tp2hRm
I'm new to python so I'm not sure if what I've done is right, the default.py script is a copy paste of things I found around internet.
According to what I've read, the addon.xml will tell XBMC which script to start and when, but it dosen't seem to work. I found information regarding a workaround involving autoexec.py file, which I couldn't find.
I would really appreciate some help here as I don't know how to continue or how to debug this process.