Advertisement
crabbypup

full RSS reader script

Nov 29th, 2012
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.89 KB | None | 0 0
  1. #!/bin/bash
  2. oIFS="$IFS"
  3. IFS=","
  4. library="/media/Library/TV Shows"
  5. ##########################
  6. url=""
  7. file=""
  8.  
  9. while read show rss parse tag format
  10. do 
  11.     IFS="$oIFS"
  12.     mkdir "/media/Library/Scripts/$show" "$library/$show"
  13.     wget "$rss" -O "/media/Library/Scripts/$show/feed.rss"
  14.     while read r
  15.     do
  16.         url=`echo "$r" | grep -e "${parse}" | sed -e 's/ /\n/g' | grep -e "${tag}" | grep -e "${format}" | sed -e 's/.*http//' -e 's/'${format}'\$.*//' | sed -e 's/'${format}'.*//'`
  17.         if [ "$url" != "" ]
  18.         then
  19.             url="http${url}${format}"
  20.             file=`echo "${url#"http:/"}" | sed -e 's/\//\n/g' | grep -e "${format}"`
  21.         else
  22.             url=""
  23.         fi
  24.         if [ -e "$library/$show/$file" ] && [ "$url" != "" ];
  25.         then
  26.             true
  27.         else
  28.             wget "${url}" -O "$library/$show/$file"
  29.         fi
  30.     done <"/media/Library/Scripts/$show/feed.rss"
  31.     IFS=","
  32.     rm -rf "/media/Library/Scripts/$show"
  33. done </media/Library/Scripts/showlist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement