[bglug] Torrent Search [errata]

k|b|s kbs@bglug.it
Mar 22 Dic 2009 11:20:12 CET


On Tue, Dec 22, 2009 at 11:16:32AM +0100, k|b|s wrote:
> ...
Scusate, ma con la neve sbaglio anche di copiare...

#!/bin/bash
# Time-stamp: <tortuga, 22/12/2009 11:18:27 joe Exp>

# Search torrents ;^)
# Usage: tortuga <-abipst> [search words]
#     without options search on PirateBay

# License: BSD

#Copyright (c) 2009, Joe Galaxy
#All rights reserved.

#REDISTRIBUTION and  use in  source and binary  forms, with  or without
#modification, are permitted provided that the following conditions are
#met:

#    * Redistributions of  source code must retain  the above copyright
#      notice, this list of conditions and the following disclaimer.
    
#    * Redistributions  in   binary  form  must   reproduce  the  above
#      copyright  notice, this  list  of conditions  and the  following
#      disclaimer in the  documentation and/or other materials provided
#      with the distribution.
    
#    * Neither the name of Joe Galaxy nor the names of its contributors
#      may be  used to  endorse or promote  products derived  from this
#      software without specific prior written permission.

#THIS SOFTWARE  IS PROVIDED BY  THE COPYRIGHT HOLDERS  AND CONTRIBUTORS
#"AS  IS" AND  ANY EXPRESS  OR IMPLIED  WARRANTIES, INCLUDING,  BUT NOT
#LIMITED TO, THE IMPLIED  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
#A PARTICULAR PURPOSE  ARE DISCLAIMED. IN NO EVENT  SHALL THE COPYRIGHT
#OWNER OR CONTRIBUTORS BE  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL  DAMAGES (INCLUDING,  BUT  NOT
#LIMITED TO, PROCUREMENT OF SUBSTITUTE  GOODS OR SERVICES; LOSS OF USE,
#DATA, OR PROFITS; OR BUSINESS  INTERRUPTION) HOWEVER CAUSED AND ON ANY
#THEORY OF  LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY,  OR TORT
#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING  IN ANY WAY OUT OF THE USE
#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Customize:
BROWSER=$(which firefox)
#

if test $# -eq 0
 then
  echo "   usage: tortuga <-abipst> [ search words ]"
  echo "          -a search all engines"
  echo "          -b search BtJunkie"
  echo "          -i search IsoHunt"
  echo "         (-p) search Pirate Bay (default)"
  echo "          -s search SumoTorrent"
  echo "          -t search TorrentReactor"
  echo ""
 exit
else
case $1 in
-h|--h|-help|--help)
  echo "   usage: tortuga <-abipst> [ search words ]"
  echo "          -a search all engines"
  echo "          -b search BtJunkie"
  echo "          -i search IsoHunt"
  echo "         (-p) search Pirate Bay (default)"
  echo "          -s search SumoTorrent"
  echo "          -t search TorrentReactor"
  echo ""
  exit
  ;;
esac
fi 
QUERY=` echo "$*" | sed -e 's/+/%2b/g;s/"/%22/g;y/ /+/' `
AQUERY=` echo "$*" | sed -e 's/+/%2b/g;s/"/%22/g;y/ /+/' -e 's/^-a+//g' `
BQUERY=` echo "$*" | sed -e 's/+/%2b/g;s/"/%22/g;y/ /+/' -e 's/^-b+//g' `
IQUERY=` echo "$*" | sed -e 's/+/%2b/g;s/"/%22/g;y/ /+/' -e 's/^-i+//g' `
SQUERY=` echo "$*" | sed -e 's/+/%2b/g;s/"/%22/g;y/ /+/' -e 's/^-s+//g' `
TQUERY=` echo "$*" | sed -e 's/+/%2b/g;s/"/%22/g;y/ /+/' -e 's/^-t+//g' `
case $1 in
-a)
$BROWSER "http://www.btjunkie.org/search?q=$AQUERY" "http://thepiratebay.org/search/$AQUERY/0/99/0" "http://www.sumotorrent.com/searchResult.php?search=$AQUERY&x=0&y=0" "http://isohunt.com/torrents/?ihq=$AQUERY" "http://www.torrentreactor.net/search.php?words=$AQUERY&search=&x=0&y=0" 2>&1 &
;;
-b)
$BROWSER "http://www.btjunkie.org/search?q=$BQUERY" 2>&1 &
;;
-i)
$BROWSER "http://isohunt.com/torrents/?ihq=$IQUERY" 2>&1 &
;;
-s)
$BROWSER "http://www.sumotorrent.com/searchResult.php?search=$SQUERY&x=0&y=0" 2>&1 &
;;
-t)
$BROWSER "http://www.torrentreactor.net/search.php?words=$TQUERY&search=&x=0&y=0" 2>&1 &
;;
*)
$BROWSER "http://thepiratebay.org/search/$QUERY/0/99/0" 2>&1 &
;;
esac







Maggiori informazioni sulla lista bglug