Weekend digest

Posted by Thomas Sun, 20 May 2012 22:48:46 +0000

Someone at work used to (and still might), post a digest of sorts of her weekend. This is mine:

This weekend I was oncall, rode 15 miles on my bike, pulled weeds in my backyard, tested out a Seagate 3TB drive, procured a hoe and rake from Home Depot, vacuumed, swept and swiffered my kitchen floor, went to Church, read more in Atlas Shrugged, and ate some barbecue.

Posted in General | 2 Comments

Netflix queue hacking

Posted by Thomas Sun, 20 May 2012 20:00:58 +0000

If ever you want to filter your queue by some min/max rating, and possibly look only for a specific genre. YMMV. Class names subject to change. Void where prohibited.

function getstbrMaskFgSpan(element) {
  var spans = element.getElementsByTagName("span");
  for (var span, k = 0; span = spans[k]; k++) {
    if (span.className.match(/stbrMaskFg/)) {
      return span;
    }
  }
  return null;
}

var minRating = 3.7;
var maxRating = 5.0;
var tables = document.getElementsByTagName('table');
for (var table, i = 0; table = tables[i]; i++) {
  if (table.className != "qtbl") {
    continue;
  }

  var rows = table.getElementsByTagName('tr');
  for (var row, j = 0; row = rows[j]; j++) {
    // filter out tv shows
    if (row.innerHTML.match(/series_only/)) {
      row.style.display = "none";
      continue;
    }

    // possibly filter for just action movies
    if (!row.innerHTML.match(/Action/)) {
      row.style.display = "none";
      continue;
    }

    var span = getstbrMaskFgSpan(row);
    if (span != undefined) {
      var rating = span.className.replace(/.*sbmf-([0-9]+).*/g, "$1");
      rating = parseFloat(rating) / 10.;
      if (minRating < rating && rating <= maxRating) {
        row.style.display = "";
      } else {
        row.style.display = "none";
      }
    }
  }
}

Posted in Technology | Comments Off