summaryrefslogtreecommitdiffstats
path: root/booktwit
blob: d88c6a42553d3cf273e6eaf5533c6207c3d13743 (plain)
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
#!/bin/zsh
# vim: ft=sh et:
user=emptyvacuum
pass=$(cat $HOME/.booktwit)
source bin/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 2
    desc="[email protected]"
fi

echo -e "\n${url}|$title|$desc" >>| ~/.bookmarks
curl -s --basic --user $user:$pass --data status="$url $desc" http://twitter.com/statuses/update.xml