maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [request] autostart skype on wlan/lan, autokill skype on 2g/3g (https://talk.maemo.org/showthread.php?t=58405)

mortak 2010-07-14 01:26

[request] autostart skype on wlan/lan, autokill skype on 2g/3g
 
i (and a lot more, i guess) would like to have some script/application which kills or starts "high load" network stuff like skype. it should kill (send offline) skype when i leave my wlan or usb-lan and restart it when i connect to it again. this mechanism could save a lot of traffic for dataplan/noflat users. :)

i was told that this should be possible via dbus, but my dbus knowledge is very limited.

is anyone willing to implement that or is it impossible?

tia mortak

jacktanner 2010-07-14 01:51

Re: [request] autostart skype on wlan/lan, autokill skype on 2g/3g
 
that's brilliant

+1

VII 2010-07-14 07:22

Re: [request] autostart skype on wlan/lan, autokill skype on 2g/3g
 
Ok heres a python script to set status to offline on skype at Wlan disconnect. I can't test completely right now as I am roaming, so try it out and let me know.
Code:

import gobject
import dbus
from dbus.mainloop.glib import DBusGMainLoop

import subprocess

def Wlan_StDis(interf):
        acc_r=subprocess.Popen('/usr/bin/dbus-send --type=method_call --print-reply --dest=org.freedesktop.Telepathy.AccountManager /org/freedesktop/Telepathy/AccountManager org.freedesktop.DBus.Properties.Get string:org.freedesktop.Telepathy.AccountManager string:ValidAccounts | grep -m 1 skype', shell=True, stdout=subprocess.PIPE, ).communicate()[0]
        acc = acc_r[22:-2]
        print acc
        bus= dbus.SessionBus()
        accm = bus.get_object('org.freedesktop.Telepathy.AccountManager', acc)
        accm.Set('org.freedesktop.Telepathy.Account', 'RequestedPresence', \
                dbus.Struct(( dbus.UInt32(1) ,  'Offline', 'Disconnect by script' ), signature='uss'),
                dbus_interface='org.freedesktop.DBus.Properties')
DBusGMainLoop(set_as_default=True)
dbus.SystemBus().add_signal_receiver(Wlan_StDis,dbus_interface=None,signal_name="disconnected",bus_name="com.nokia.wlancond",path="/com/nokia/wlancond/signal",)
gobject.MainLoop().run()


Trucker Her 2010-07-14 07:46

Re: [request] autostart skype on wlan/lan, autokill skype on 2g/3g
 
How should I be testing this?

cjp 2010-07-14 08:04

Re: [request] autostart skype on wlan/lan, autokill skype on 2g/3g
 
Man, I'd really like the dev of AutoDisconnect to pick this feature up.

I'm really vouching for that app to become the ultimate connections manager for Maemo. VII, would you be interested in dropping that line to the AutoDisconnect developer? :)

VII 2010-07-14 08:10

Re: [request] autostart skype on wlan/lan, autokill skype on 2g/3g
 
Quote:

Originally Posted by Trucker Her (Post 751203)
How should I be testing this?

Save the script to your device, then run it from terminal.
rootsh required
python2.5 required
need to be root
need to chmod a+x in terminal for the script

ex:
/usr/bin/python2.5 /home/user/ScriptName.py

VII 2010-07-14 08:14

Re: [request] autostart skype on wlan/lan, autokill skype on 2g/3g
 
Quote:

Originally Posted by cjp (Post 751212)
Man, I'd really like the dev of AutoDisconnect to pick this feature up.

I'm really vouching for that app to become the ultimate connections manager for Maemo. VII, would you be interested in dropping that line to the AutoDisconnect developer? :)

Sure anyone who wants to make something of this script is encouraged.
As of right now it is not fully tested!
Futher I do not know if AutoDisconnect is writen in python or if the developer will like the way this works.

maddler 2010-07-14 08:39

Re: [request] autostart skype on wlan/lan, autokill skype on 2g/3g
 
Quote:

Originally Posted by VII (Post 751231)
Sure anyone who wants to make something of this script is encouraged.
As of right now it is not fully tested!
Futher I do not know if AutoDisconnect is writen in python or if the developer will like the way this works.

The backend work in AutoDisconnect is actually Bash, but I see no big issues in recalling your script from within AD.

I'm gonna patch the backend scripts later today, but I'd need some help from Aymeric (AD developer) in order to modify admin GUI.

Stay tuned.

maddler 2010-07-14 08:42

Re: [request] autostart skype on wlan/lan, autokill skype on 2g/3g
 
I'm also considering adding a list of apps to start/kill on start/stop of data connection...

VII 2010-07-14 09:38

Re: [request] autostart skype on wlan/lan, autokill skype on 2g/3g
 
Ok great, glad some of my spare time is being usefull :D

Gabeuk 2010-07-14 10:00

Re: [request] autostart skype on wlan/lan, autokill skype on 2g/3g
 
I'd like this feature. Being able to define which services are running in particular locations or scenarios becomes important in all mobile devices / contexts over time.

Example: I'd like to not be logged into IM when on 3G for (battery reasons); to not be logged into Facebook Chat at work, but logged in at home; and so on...

WiFi is probably a pretty good trigger/proxy for location.

mortak 2010-07-14 13:08

Re: [request] autostart skype on wlan/lan, autokill skype on 2g/3g
 
great, im not the only one who wants such a feature :)

awesome would be a checkbox in the skype account settings. maybe in the next PR ^^.


All times are GMT. The time now is 07:18.

vBulletin® Version 3.8.8