mirror of
https://github.com/vikstrous/pirate-get
synced 2025-01-10 10:04:21 +01:00
Merge pull request #6 from gausie/small_changes
Added -0 flag to choose the first (0th) result
This commit is contained in:
commit
72692228bb
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
pirate-get-*
|
16
install.sh
16
install.sh
@ -1,22 +1,24 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
if [ "$UID" -ne 0 ]
|
if [ "$UID" -ne 0 ]
|
||||||
then echo "Please run as root"
|
then echo "Please run as root"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TMP=`mktemp pirate-get-XXX`
|
TMP=$(mktemp pirate-get-XXX)
|
||||||
if [ `which python2.7` ]
|
if [ $(which python2.7) ]
|
||||||
then
|
then
|
||||||
echo "#!/usr/bin/env python2.7" > $TMP
|
echo "#!/usr/bin/env python2.7" > "$TMP"
|
||||||
elif [ `which python2` ]
|
elif [ `which python2` ]
|
||||||
then
|
then
|
||||||
echo "#!/usr/bin/env python2" > $TMP
|
echo "#!/usr/bin/env python2" > "$TMP"
|
||||||
else
|
else
|
||||||
echo "#!/usr/bin/env python" > $TMP
|
echo "#!/usr/bin/env python" > "$TMP"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed 1d `dirname $0`/pirate-get.py >> $TMP
|
sed 1d $(dirname $0)/pirate-get.py >> "$TMP"
|
||||||
|
|
||||||
cp $TMP /usr/bin/pirate-get
|
cp "$TMP" /usr/bin/pirate-get
|
||||||
chmod +x /usr/bin/pirate-get
|
chmod +x /usr/bin/pirate-get
|
||||||
chmod 755 /usr/bin/pirate-get
|
chmod 755 /usr/bin/pirate-get
|
||||||
|
rm "$TMP"
|
||||||
|
@ -44,6 +44,7 @@ def main():
|
|||||||
parser.add_argument('-t',dest='transmission',action='store_true', help="call transmission-remote to start the download", default=False)
|
parser.add_argument('-t',dest='transmission',action='store_true', help="call transmission-remote to start the download", default=False)
|
||||||
parser.add_argument('--local', dest='database', help="An xml file containing the Pirate Bay database")
|
parser.add_argument('--local', dest='database', help="An xml file containing the Pirate Bay database")
|
||||||
parser.add_argument('-p', dest='pages', help="The number of pages to fetch (doesn't work with --local)", default=1)
|
parser.add_argument('-p', dest='pages', help="The number of pages to fetch (doesn't work with --local)", default=1)
|
||||||
|
parser.add_argument('-0', dest='first', action='store_true', help="choose the top result", default=False)
|
||||||
|
|
||||||
def local(args):
|
def local(args):
|
||||||
xml_str = ''
|
xml_str = ''
|
||||||
@ -119,6 +120,11 @@ def main():
|
|||||||
# enhanced print output with justified columns
|
# enhanced print output with justified columns
|
||||||
print "%-5s %-6s %-6s %5.1f %-11s %-11s %s" % (m, magnet[1], magnet[2], ratio ,sizes[m], uploaded[m],urllib.unquote(name.group(1).encode('ascii')).decode('utf-8').replace("+", " ") )
|
print "%-5s %-6s %-6s %5.1f %-11s %-11s %s" % (m, magnet[1], magnet[2], ratio ,sizes[m], uploaded[m],urllib.unquote(name.group(1).encode('ascii')).decode('utf-8').replace("+", " ") )
|
||||||
|
|
||||||
|
if args.first:
|
||||||
|
print "Choosing first result";
|
||||||
|
choice = 0
|
||||||
|
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
l = raw_input("Select a link: ")
|
l = raw_input("Select a link: ")
|
||||||
except KeyboardInterrupt :
|
except KeyboardInterrupt :
|
||||||
|
Loading…
Reference in New Issue
Block a user