Code Search for Developers
 
 
  

magnet-handler.sh from Gtk-Gnutella at Krugle


Show magnet-handler.sh syntax highlighted

#! /bin/sh

# $Id: magnet-handler.sh 14334 2007-08-06 13:11:29Z cbiere $

# The following two options should be set in FireFox/Mozilla.
# Enter "about:config" in the address bar.
# Right click and create a new string under the name
# "network.protocol-handler.app.magnet".  Set the value to the
# full path to this script.  Also create a new boolean called
# "network.protocol-handler.external.magnet" and set it to true.
# This script should have execute permissions.  Ie, chmod +x.

# Make sure that there is only one argument and that it starts
# either with "magnet:?" or "http://".

scheme=
case "$1" in
'http://'*)	scheme='http';;
'magnet:?'*)	scheme='magnet';;
*)
esac

if [ $# != 1 ] || [ "X$scheme" = X ]; then
   echo "Usage: ${0##*/} magnet:?[...]" >&2
   exit 1
fi

# Select a default configuration directory.  FireFox/Mozilla can be
# run with alternate exports to over-ride behaviour in this script.
GTK_GNUTELLA_DIR=${GTK_GNUTELLA_DIR-$HOME/.gtk-gnutella}
export GTK_GNUTELLA_DIR

# Don't do anything if GTKG is not running.
gtk-gnutella --ping || {
   echo 'gtk-gnutella is not running.' >&2
   exit 1
}

# Special characters in the URL must not be parsed as quotes or escapes.
url="`printf '%s' "$1" |sed 's,",%22,g' |sed "s,',%27,g" |sed 's,\\\\,%5c,g'`"

# Send a shell command to download the magnet URL.
cat <<EOF | exec gtk-gnutella --shell
intr
download add "$url"
EOF





See more files for this project here

Gtk-Gnutella

A GTK+ Gnutella client for Unix, efficient, reliable and fast, written in C. It has been optimized for speed and scalability, with low-memory consumption. It is meant to be left running 24x7, using little CPU and only the configured bandwidth.

Project homepage: http://sourceforge.net/projects/gtk-gnutella
Programming language(s): C
License: other

  fix_copyright.pl
  geo-to-db.pl
  gtkg-dbus-listener.py
  magnet-handler.sh
  magnetize.sh
  sha1_cache.pl
  sha1_cache.sh
  svn-revision