-
Notifications
You must be signed in to change notification settings - Fork 0
/
booktwit
executable file
·48 lines (43 loc) · 1.17 KB
/
booktwit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/zsh
# vim: ft=sh et:
user=emptyvacuum
pass=$(cat $HOME/.booktwit)
#set -x
source ~/.zsh/.zsh_functions
if [[ $1 == "search" ]];then
~/bin/searchtwit.py "" $pass
exit
elif [[ $1 == "all" || $1 == "list" ]];then
#curl --basic --user $user:$pass http://twitter.com/$user
#expr="~/bin/searchtwit.py all $pass | tr ',' '\n' | tr -d \' | perl -lne 'print $1 if /.*?u(.+)$/'"
url=$(~/bin/searchtwit.py all $pass | tr ',' '\n' | tr -d \' | perl -lne 'print $1 if /.*?u(.+)$/' | ${=DMENU} | cut -d " " -f 1)
[[ ! -z $url ]] && $BROWSER $url
exit
elif [[ $1 == "list" ]];then
url=$( cat ~/.bookmarks | ${=DMENU} | cut -d "|" -f 1)
[[ ! -z $url ]] && $BROWSER $url
exit
fi
#set +x
if [[ -z $1 ]];then
url=$(xsel -o)
else
url=$1
fi
if ! isurl $url;then
exit 1
fi
#echo "Enter URL"
#read url
#echo "Description"
#shift
if [[ -z $2 ]];then
desc="$(zenity --title 'Booktwit' --entry --text 'Enter the description')"
else
title="$2"
shift
desc="$@"
fi
echo -e "\n\n${url}|$title|$desc\n\n" >> ~/.bookmarks
curl -s --basic --user $user:$pass --data status="$url $desc" http://twitter.com/statuses/update.xml &>/dev/null
#set +x