Advertisement
Guest User

Untitled

a guest
Jun 26th, 2014
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. TV_SHOWS=$(curl --silent "http://localhost:32400/library/sections/3/recentlyAdded?X-Plex-Container-Start=0&X-Plex-Container-Size=10")
  4.  
  5. test -r "$TV_SHOWS" || { echo "error: invalid input, usage: ${0//*\//} filename.xml"; exit 1; }
  6.  
  7. let idx=0
  8.  
  9. while read line || test -n "$line"; do
  10.  
  11. if test "${line:0:2}" == '<V'; then
  12.  
  13. tmp=${line##* title=}
  14. title=${tmp%% grandparentKey*}
  15.  
  16. tmp=${line##*grandparentTitle=}
  17. gptitle=${tmp%% contentRating*}
  18.  
  19. if test "$idx" -lt "1" ; then
  20. let idx=1
  21. echo -n "[ [ $title, $gptitle ]"
  22. else
  23. echo -n ", [ $title, $gptitle ]"
  24. fi
  25. fi
  26.  
  27. done <"$1"
  28.  
  29. echo " ]"
  30.  
  31. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement