Created
May 18, 2012 09:16
-
-
Save mawi12345/2724206 to your computer and use it in GitHub Desktop.
Ubuntu skype handler installer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: iso-8859-15 -*- | |
# | |
# skype handler installer | |
# tested on Ubuntu 11.10 & 12.04 | |
# | |
# This script installs the action_handler.py | |
# by Philipp Kolmann (philipp@kolmann.at) | |
# action_handler.py needs the Python DBus module. | |
# In Debian you can get it via: sudo apt-get install python-dbus | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2 of the License. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program; if not, write to the Free Software | |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | |
# USA | |
import os, sys, urllib, contextlib | |
svn_url='https://wspk.zid.tuwien.ac.at/svn/skype/trunk/action_handler.py/action_handler.py' | |
dest = '/usr/bin/skype_action_handler.py' | |
app_name = 'skype-handler.desktop' | |
app_starter = '/usr/share/applications/'+app_name | |
app_defaults = '/usr/share/applications/defaults.list' | |
if not os.geteuid() == 0: | |
sys.exit('Script must be run as root!\nsudo python skype-handler-installer.py') | |
handler_found = False | |
with open(app_defaults, 'r') as deafults: | |
for line in deafults.readlines(): | |
if line[0:22] == 'x-scheme-handler/skype': | |
handler_found = True | |
if handler_found: | |
sys.exit('an skype handler is already installed\ncheck '+app_defaults) | |
print 'downloading: '+svn_url | |
with contextlib.closing(urllib.urlopen(svn_url)) as remote: | |
with open(dest, 'w') as local: | |
local.write(remote.read()) | |
os.chmod(dest, 0755) | |
with open(app_defaults, 'a') as deafults: | |
deafults.write('x-scheme-handler/skype='+app_name) | |
with open(app_starter, 'w') as starter: | |
starter.write('[Desktop Entry]\nEncoding=UTF-8\nName=Skype Action Handler\nComment=Call from Skype\nGenericName=Skype Client\nExec='+dest+' %u\nTerminal=false\nX-MultipleArgs=false\nType=Application\nIcon=skype\nCategories=Application;Network;\nMimeType=x-scheme-handler/skype;') | |
print 'skype handler is now installed' |
I have also moved it into the usr/bin directory
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok, I downloaded it. I have extracted it to my desktop. I ran your Python dbus. Now what? I don't understand how to install it.