View Single Post
Posts: 51 | Thanked: 21 times | Joined on May 2010
#1
As per post title really, does anyone know the shell commands to go online/offline with Skype etc so I can cron it?

Thanks.

EDIT:

I have managed to solve this with a bit of digging on the forums and adapting of scripts. The first script I created called "skype-online" is here:

Code:
#!/usr/bin/env python

import dbus
import gobject

#NAMES
TP_ACCT_MGR = 'org.freedesktop.Telepathy.AccountManager'
TP_ACCT = 'org.freedesktop.Telepathy.Account'
DBUS_PROPS = 'org.freedesktop.DBus.Properties'

sessbus = dbus.SessionBus()
am_obj = sessbus.get_object(TP_ACCT_MGR,
                            '/org/freedesktop/Telepathy/AccountManager')
am_props = dbus.Interface(am_obj, DBUS_PROPS)

    accounts = am_props.Get(TP_ACCT_MGR,
                            "ValidAccounts")
    for path in accounts:
        if ("/org/freedesktop/Telepathy/Account/ring/tel/ring" == path):
            continue
        acct_obj = sessbus.get_object(TP_ACCT_MGR, path)
        acct_props = dbus.Interface(acct_obj, DBUS_PROPS)

        acct_props.Set(TP_ACCT,
                           "RequestedPresence",
                           dbus.Struct((dbus.UInt32(2),
                                        dbus.String(u"available"),
                                        dbus.String(u"") )) )
        acct_props.Set(TP_ACCT,
                           "ConnectAutomatically",
                           dbus.Boolean(True))
and skype-offline:

Code:
#!/usr/bin/env python

import dbus
import gobject

#NAMES
TP_ACCT_MGR = 'org.freedesktop.Telepathy.AccountManager'
TP_ACCT = 'org.freedesktop.Telepathy.Account'
DBUS_PROPS = 'org.freedesktop.DBus.Properties'

sessbus = dbus.SessionBus()
am_obj = sessbus.get_object(TP_ACCT_MGR,
                            '/org/freedesktop/Telepathy/AccountManager')
am_props = dbus.Interface(am_obj, DBUS_PROPS)

    accounts = am_props.Get(TP_ACCT_MGR,
                            "ValidAccounts")
    for path in accounts:
        if ("/org/freedesktop/Telepathy/Account/ring/tel/ring" == path):
            continue
        acct_obj = sessbus.get_object(TP_ACCT_MGR, path)
        acct_props = dbus.Interface(acct_obj, DBUS_PROPS)

            acct_props.Set(TP_ACCT,
                           "RequestedPresence",
                           dbus.Struct((dbus.UInt32(1),
                                        dbus.String(u"offline"),
                                        dbus.String(u"") )) )
            acct_props.Set(TP_ACCT,
                           "ConnectAutomatically",
                           dbus.Boolean(False))
Then chmod +x both scripts. Then you can use alarmed or whatever to run these scripts to sign in and out.

Last edited by bristoldave; 2010-06-10 at 10:35.
 

The Following 11 Users Say Thank You to bristoldave For This Useful Post: