Results 1 to 9 of 9

Thread: Script to purge boxee queue

  1. #1
    Join Date
    Feb 2009
    Posts
    5

    Default Script to purge boxee queue

    I got tired of manually deleting things from my queue and it had grown far too large to be manageable, so I put together a quick and dirty script to do it automatically. It's written in bash, so you'll need linux or something similar (cygwin?) to get it working. It needs curl to work. If anyone wants to make a more user friendly tool based on this, have at it.

    Code:
    #!/bin/bash
    # Script to clean boxee queue
    # OPTIONS
    # subs = Purge Subscriptions
    # bookmarks = Purge Bookmarklets
    # all = Everything, subscriptions, bookmarks, locally added items
    #Enter your username/password here
    user=
    pass=
    if [ -z "$1" ]
    then
      echo "Must specify option.  subs=Purge Subs, bookmarks=Purge Bookmarks, all=everything."
      exit 0
    fi
    # Make sure user/pass is filled
    if [[ -z "$user" || -z "$pass" ]]
    then
      echo "Edit script and add your username and/or password"
      exit 0
    fi
    # Get fresh copy of queue
    wget -nv -m -nd --user=$user --password=$pass http://app.boxee.tv/api/get_queue
    case "$1" in 
    'subs')
      echo "Purging Subscriptions"
    for item in `cat get_queue |sed 's:<last>:</last>\n:'|awk '/subscription/ {print $4}'|sed -e 's/referral="//g' -e 's/"//g'`
    do
      echo "Deleting referral # $item"
      curl --url "http://app.boxee.tv/action/add" --data "<message type=\"dequeue\" referral=\"$item\"></message>" -H "Content-Type: text/xml" -u "$user":"$pass"
    done
    ;;
    'bookmarks')
      echo "Purging Bookmarklets"
      for item in `cat get_queue |sed 's:<last>:</last>\n:'|awk '/booklet/ {print $4}'|sed -e 's/referral="//g' -e 's/"//g'`
      do
        echo "Deleting referral # $item"
        curl --url "http://app.boxee.tv/action/add" --data "<message type=\"dequeue\" referral=\"$item\"></message>" -H "Content-Type: text/xml" -u "$user":"$pass"
      done
    ;;
    'all')
      echo "Purging all items"
      for item in `cat get_queue |sed 's:<last>:</last>\n:'|awk '/referral/ {print $4}'|sed -e 's/referral="//g' -e 's/"//g'`
      do
        echo "Deleting referral # $item"
        curl --url "http://app.boxee.tv/action/add" --data "<message type=\"dequeue\" referral=\"$item\"></message>" -H "Content-Type: text/xml" -u "$user":"$pass"
      done
    ;;
    esac
    Last edited by rogersb; September 3rd, 2010 at 08:15 AM. Reason: debug option was still enabled for curl commands.

  2. #2
    Join Date
    Apr 2009
    Posts
    8

    Default

    Awesome and many thanks. Worked like a charm. I had a grotesque amount of items that needed to be clean. If anyone has trouble using try un-commenting line 27.
    Last edited by Wi1d; September 2nd, 2010 at 11:02 PM.

  3. #3
    Join Date
    Feb 2009
    Posts
    5

    Default

    Good catch W1ld. Sorry about that, I disabled that during testing so I wasn't hitting boxee's server for a new copy every time I did a test, and forgot to uncomment it when I posted it. I edited the original post and took out the comment.

  4. #4
    Join Date
    Jun 2009
    Posts
    2

    Smile

    would it be possible 2 create a script that would check for links that are dead, where the videos have been removed from their sources and left the ones that are still available for viewing. cleaning out only the ones that are not available anymore, and possibly removing the ones that have been watched also?

  5. #5
    Join Date
    Feb 2009
    Posts
    5

    Default

    Interesting idea, I'm sure it could be done, the trick is finding all the different ways a link could be dead. A 404 error is easy, but being redirected because it's been taken off youtube or expired on hulu could be a little more involved to detect. I'll play around with it and see what it looks like.

  6. #6
    Join Date
    Feb 2011
    Posts
    4

    Default script for mac

    how would i run this script on mac?
    with little googling i was able to save it in .sh format in terminal and run it.
    but looks like wget is not for mac.
    i tried installing it but am not that techie yet
    i also tried curl instead of wget, but looks like the -m is something bothering it.
    Thanks for the script in advance..
    i hope i would be able to run it.

  7. #7
    Join Date
    Feb 2009
    Posts
    5

    Default

    I don't have any mac experience, but check out
    http://wget.darwinports.com/

    there's also http://curl.darwinports.com/ but it sounds like you've got that part working.

  8. #8
    Join Date
    Jan 2011
    Posts
    167

    Default

    thanks worked a treat - had 121 items that I needed clears ( heaps got added when I changed region filter - all favourite shows updated)

  9. #9
    Join Date
    Sep 2008
    Posts
    14

    Default

    rogersb, thanks so much for posting this. I have started to take the information that you've provided and put it in my own little web app to make things easier. Still needs testing, but it's a start and works just fine if all you have are YouTube links: https://github.com/niamu/boxee-watchlater

    Demo page: http://brendonwalsh.me/boxee/

    Thanks again for your work!

Similar Threads

  1. Replies: 1
    Last Post: August 8th, 2012, 09:00 PM
  2. Porting XBMC py script to Boxee
    By rudf0rd in forum boxee applications
    Replies: 1
    Last Post: October 18th, 2010, 01:24 PM
  3. Netflix Instant Play Queue in Boxee's Queue
    By codooaustin in forum boxee for mac help
    Replies: 0
    Last Post: January 11th, 2010, 02:47 PM
  4. how to start boxee in a script or crontab???
    By maluka66 in forum boxee for linux help
    Replies: 7
    Last Post: August 1st, 2009, 07:54 AM
  5. Script to automatically restart Boxee?
    By jeffehobbs in forum boxee for linux help
    Replies: 2
    Last Post: May 17th, 2009, 05:48 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •