Randomizer

| 10 Comments

For thems what wants it: Download Queue.exe

Queue Randomizer.


Randomizes Queues in Netflix OR GreenCine.

Simply download Queue.exe. When you want to randomize your Queue, double-click queue.exe. A small green box with a white H will appear in your SysTray. (Note that this macro has the advantage of requiring no software installation). Open Opera Internet Browser (Yes, it ONLY works in Opera. Not IE, not Firefox, Opera. Deal with it). Navigate to your internet movie rental site of choice. Go to your queue. Select the first number text box, and make sure the text selector is to the left of the number. Hit Alt-G. A user-friendly pop-up will appear asking you how many movies are in your queue. Tell it, then click OK. As if by magic, the macro will replace all the numbers in all the textboxes in your queue with random numbers. Hit Update Queue and you're done. Random queue. Yay!

Now, if you'll excuse me, I've been thinking about this problem for ten hours, and working on it for 4-5 hours. It's 7 AM, and I'd like to get some sleep this, you'll pardon the poor choice of words, evening.

One other quick thing: I actually had a lot of fun putting this program together, bitchiness above aside. If there's one sure way to get my rapt attention for hours on end, it's posing a problem to be solved by manipulation of a computer program. I'm not sure what it is, but I get utterly focused and tenacious when trying to get a computer to do my bidding. Because we can't let the machines win, damnit!

UPDATE: A blinding revelation struck my brain last night, and I now present Queue 2.

Queue 2 is a Netflix/Greencine queue randomizer, like Queue, but it works in Internet Explorer and Firefox, unlike Queue. Interestingly, Queue 2 does not work in Opera, while Queue works only in Opera. Run Queue 2 exactly according to the instructions for Queue above. Queue 2 is not nearly so elegant as Queue, but it gets the job done in a ham-handed way. The upshot of my changes, in addition to Queue 2 working in IE and Firefox, is that the program will keep looping past the end of your queue. Don't worry; this is a finite loop. It will stop eventually, (and probably fairly soon, at that) just don't touch anything. This is annoying, but neccessary. There may be some gibberish inserted into your various address and search bars, but provided you don't hit enter nothing will be screwed up. Just be willing to put up with a bit of junk after it's done randomizing your queue, and be sure to scroll down and click the Update Queue button.

10 Comments

Ah.

An important drawback to randomizing one's queue is that any series one has requested to rent are now randomized as well. This doesn't matter if the series are, say, The Muppet Show, but if they're Battlestar Galactica it could be problematic. So last night's auto-randomization was followed immediately by manual de-randomization.

Also, the first three movies in our queue are now a surrealistic crime movie, a gripping drama about nuclear power, and a major work of vintage noir.

Fuck.

(Previously, I should mention, because I'd been dicking around with the list, it went Red Dwarf, Red Dwarf, and Some Jacob Movie. And then I think next was porn, where there is no porn now. Curse you, randomizer.)

Can't you set up a thing in Greencine so that series are kept in order? Some sort of "My series" thing at the top?

And it's not my fault you don't like the results of the randomizers randomization. That's chaos!

You can also just delete Discs 2 through whatever of a given series from you queue, then add new ones as you watch the old ones.

Ah, but that throws the new ones at the end, doesn't it? But then, a random list is a random list, and with the program it takes 10 seconds to re-randomized.

This is all an amazingly ungrateful way of saying thank you very much for getting the program exhaustively made and working and then allowing me to get it. It's just that bitching is more entertaining than merely saying thank you a lot. But, thank you a lot.

Actually, while you'd have to ask Jacob about it instead of me because he was the one who monopolized my computer and did the randomizing, apparently there were technical difficulties which caused it to take slightly more than 10 seconds. There were some snags with it doing things like adding numbers to the address bar instead of the queue boxes, which was odd, and some kind of strategy which had to be implemented to make it randomize properly.

Perhaps, since I'm grumpy about the current top of the list, I'll give it a go myself while he's not here to steal my computer! I'll report back.

Oh jeez. You mentioned the address-bar gibberish already. Forget I mentioned it, then, since I clearly didn't read your directions very well.

Jacob's nuts. It worked beautifully. Also, GreenCine's "sort alphabetically" feature makes it very easy to find series and re-order them. I don't think he thought of that, but by god, I did. Voila! The perfect list. Thank you!

Well, now you've gone and done it. I'm just going to have to explain the problems with Queue and Queue 2.

Here's how Queue works: It starts by instantiating two variables: Movies and Qnumber. It then asks the user how many movies are in their queue. It resets Movies's value to whatever the user inputs. It then begins a loop that will run (Movies) number of times. The loop begins with it sending the Delete command thrice (to delete whatever entry is in the current text box). It then generates a random number between 1 and (Movies) and resets Qnumber to that value. It then sends the current value for Qnumber to the box. Then it hits Tab twice. In theory, this gets it to the next textbox. If, by this point, it has run (Movies) number of times, the loop, and the program, terminate. If it has not yet reached (Movies), it runs again.

The reason the numbers aren't as random as I'd like is because of an irritating quirk in Greencine's queue function.

In Netflix, if you have three movies, ordered 1, 2, 3, and then you enter new numbers, say, 100, 10, 50, when you hit Update Queue Netflix will put the 10 movie first, the 50 movies second, and the 100 movie third. I imagine their ordering algorhythm goes something like "Search for all movies with value 1. Add them to the newly-ordered queue as found (this would preserve order, so two movies with value 1 will go into the new queue in whatever order they were in on the old queue). When finished searching for 1, start over searching for 2, and so on up to 999." Thus, it processes the 100, 10, 50 example properly.

The Greencine algorithm functions similarly, insofar as it preserves the original order for multiple movies with the same number. However, it adds a quirk: Before beginning, it counts how many movies there are in your queue. It then stops checking numbers once it reaches that number, and throws any remaining movies into your new queue in their original order. So, in the example above, entering 100, 10, 50 would cause Greencine to spit back the same order of movies you had before, since once it got to three it figured it was done and ignored anything with a value higher than three.

I figured this out because initially I had Queue generate a random number between 1 and 999. This worked in Netflix, but in Greencine resulted in a queue that was nearly identical to the old queue, but for a scattered few movies that were moved to the top. This is because it was ignoring all the random numbers entered that were higher than 45, the number of movies I put in my queue.

Thus, I changed Queue to only generate numbers between 1 and however many movies were in your queue.

This led to the current problem where the queue isn't as random as I like. You see, if you tell a random number generator to give you 45 random numbers between 1 and 45, the chances are extraordinarily small that it will give you 45 unique numbers between 1 and 45 (that is, one of every number between 1 and 45, and only one of each number). I used to know the formula for the probability here, but trust me it's very small. The formula involved factorials in the denominator. And the more you tell it to generate, the smaller the chance that they'll all be unique. So, as constituted, Queue generates a lot of duplicate numbers, which will thereby preserve some of the order from your old queue. If you run it multiple times, however, a lot of the original order will be destroyed.

The gibberish is a problem unique to Queue 2. The reason Queue 2 was needed was because Opera handles the tab function in a different way than Internet Explorer and Firefox.

Opera leaps to the next button, text box, check box, radio button, etc. when you hit tab. Both Greencine and Netflix have one check box in between text boxes, so in both cases you need hit tab twice, no more, no less, to get to the next check box in Opera.

In IE and Firefox, however, tab also selects the next link, in addition to all the other things above. This is troublesome, because Netflix and Greencine periodically insert extra links between text box and check box (in Greencine links to related lists, in Netflix to recommended movies and Friends' favorite movies). Plus the extra links to the movie itself means that it requires three to four tabs to get to the next text box in Greencine, four to five in Netflix.

I had a revelation as to how this problem could be solved: Internet Explorer and Firefox don't care if you hit delete or shout random numbers at links. They both do nothing if you do that. So the solution is to just have the loop hit tab once each time, and pentuple the number of times the loop runs. The program starts by generating a random number and putting it in the first movie's text box. It then shouts random numbers at the links and check box in between, then puts another random number in the next text box. The pentupling is neccessary so it'll actually get all the way to the end of the queue; otherwise it'd run out of loops 1/5th of the way down. Interestingly, Queue 2 does not run in Opera, because Opera actually does things when you shout random numbers at check boxes; Opera uses numbers to switched between tabbed windows, as well as to size and zoom your browser windows. So running Queue 2 in Opera causes the browser to absolutely spaz out, flipping rapidly between windows, minimizing, maximizing, zooming in and out, etc.

Since Queue 2 was designed to be compatible with both Netflix and Greencine, it runs the loop five times more than the number of movies you have (to ensure it reaches the end of the Netflix queue, which requires up to 5 tabs per movies). Because the number of tabs is variable, and because I designed it to run the maximum number of times that could possibly be necessary, it'll end up still running after it finishes with the queue. This eventually causes the program to send the text selector into your address bar, where it will spit a bunch of random numbers. I don't think any of it's a problem, though, provided you don't hit enter. Just wait for the program to finish and calmly scroll down and click "Update Queue."

Queue 1, by the way, when run in Opera, stops precisely on the "Update Queue" button every time, in Netflix and Greencine. And it runs much fasters, since it is 5 times more efficient. Not that I'm playing favorites among my children.

As to solutions, I have some ideas, which I would love to implement if I had a weekend to devote to it and a macro program with the toolset needed to do it.

The problem of insufficient randomness is tricky, but solvable. If I could write a mini program that took (Movies) as an argument and generated a string (Movies) long of unique random numbers between 1 and (Movies), I could throw that into the bigger Queue programs. Then I'd have each iteration of the loop pull the next number off the string; the string would run out of numbers just as the queue ended.

That would solve every problem in Queue, but it wouldn't work in Queue 2, because the string would run out, due to all the extra numbers thrown around. Which leads me to Queue 2's problem. If I had some way of testing whether the currently selected item was a text box, I could insert an If test within the loop. Basically "If textbox, then (do random number thing). Else, hit tab and check again." If I made it as a loop within the bigger loop, it'd work perfectly without the pentupling and stop when it reaches the end (and be compatible with the string solution above) because the big loop would only cycle when a new number was inserted.

The problem, though, is that I don't believe my macro program has the power to do either of the things outlined above; I don't think it has a test for where it is and I don't think it has anything but the most basic random number generator. Still, I quite like it; it's amazingly user-friendly, it's quite powerful, it generates an easy-to-use-and-transfer executable for people to run the macro, and it's free.

February 2012
Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29      

Contact Zach

Friends

Webcomics of Which I am a Fan

Sites I Read Daily: Politics

Sites I Read Daily: Video Gaming

Sites I Read Daily: General Miscellany

About this Entry

This page contains a single entry by Zach published on December 5, 2005 7:11 AM.

More word nobbling was the previous entry in this blog.

Slowdown is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 5.04