Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- tmpfile=$(mktemp)
- RSS_URL=https://USERNAME:PASSWORD@www.rememberthemilk.com/rss/USERNAME/;
- wget ${RSS_URL} -O - 2>/dev/null | xmlstarlet sel -T -t -m "/rss/channel/item" -o "|" -v "title" -o "|" -v "link" -o "|" -v "description" -o "|" -n |sed '/^$/d' | sed '/^|/!d' | sed '/|$/!s/^.*$/&<\/div><\/div><\/div><\/div>|/g' > $tmpfile
- # There's a problem with the description - newlines muck it up. Unfortunately, the date is in the description. Oy.
- # Hence all that mucking about with SED.
- # SED order - get rid of extra newlines, get rid of those that don't start with a | marker, add closing </div> tags and | to truncated lines.
- # This is not ideal, because it means we don't get notes and the like. But this kludge here has taken me long enough.
- # By the way, the problem is that the notes (and indeed, the whole description) is NOT XML. It's done with HTML spans.
- i=0
- cat $tmpfile | while read line; do
- let i++
- TASKTitle[$i]=$(echo $line|awk '{split($0,a,"|");print a[2]}')
- # Currently this array field is just a storage space, but it could be used later when I figure out how to parse the notes better.
- TASKDescription[$i]=$(echo $line|awk '{split($0,a,"|");print a[4]}')
- TASKLink[$i]=$(echo $line|awk '{split($0,a,"|");print a[3]}')
- TASKDate[$i]=$(echo ${TASKDescription[$i]}| awk -F'[<|>]' '/rtm_due_value/{print $11}')
- #Currently outputs to the console.
- echo ${TASKTitle[$i]} "," ${TASKDate[$i]} "," ${TASKLink[$i]}
- done
- # Put here a function to search for things today.
- # Put here a function to search for things on any given date.
- # Put here a function to search for things with no date.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement