• 0

Random movie chooser


Question

How hard would it be to code a program to basically say:

- choose from all movies, 1 randomly at a time

- possibly by genre as well in some way

Just a simple local program where ya click a button and it displays the title of one of your movies on the movie list.

* Would also like to know (if its easy) a random fast food chooser too for myself and the roommates haha

Link to comment
Share on other sites

19 answers to this question

Recommended Posts

  • 0

Wouldn't be too hard if you know ANY scripting language functions to use to grab data from imdb.com.

Here are some:

http://imdbpy.sourceforge.net/

http://davidwalsh.name/php-imdb-information-grabber

http://codecanyon.net/item/imdb-scraper/113118

http://www.imdb.com/interfaces

http://codehill.com/2009/02/get-a-movies-details-from-imdb/

As far as fast food goes, there would have to be a listing that exists. You'll more than likely have to populate it yourself. Then setting it up to show random on refresh would be pretty simple.

Link to comment
Share on other sites

  • 0

I have a feeling he was looking more for a program that he can list all his own movies in and then have the program select one at random for him to watch. That was just my take on his post. Could be that I have actually been thinking about something like this for myself. Can you clarify if that is what you were looking for Alladaskill17?

Link to comment
Share on other sites

  • 0

From looking at the links you posted it looked as if they were grabbing specific movie titles or random movie titles from IMDB's database though. He might have to submit quite a few queries to get an actual movie he owns or has access to.

I guess I was approaching the question as him asking if there was a program that exists that already does this rather than him trying to get ideas about how to do it. Maybe that is where I'm confusing the point.

Link to comment
Share on other sites

  • 0

If you read he didn't ask if it was already in existence, he actually says: "How hard would it be to code a program [...]"

Either way, if he populates from IMDB or from memory he's still got quite "a few" lines of work to populate it. I just did IMDB because its logical to use it (and if he just wants to have extra features outside of just the title of the movie.)

Link to comment
Share on other sites

  • 0

I have a feeling he was looking more for a program that he can list all his own movies in and then have the program select one at random for him to watch. That was just my take on his post. Could be that I have actually been thinking about something like this for myself. Can you clarify if that is what you were looking for Alladaskill17?

Yes I want to populate my own movie library as the list the program chooses from, that is what I meant.

Link to comment
Share on other sites

  • 0

http://davidmarotz.com/quotes.php

You state program so I'm not sure if you're actually going to develop for Windows/OSX/Linux or if you mean script (web based.) Either way, there's a script I just gave. Populate it yourself, refresh and it will display random.

I know nothing about coding, programming, scripting etc. So with that said, I don't care if it is a program, a script, etc. I really just wanted to be able to have my personal movie library stored (text file? database seems a bit much? ..don't know) and in some way having the "program" choose 1 from the list at a time. I have been googling to find a simple java example and learn off that, but I know so little. Whether or not there is a possible UI associated later is debatable but for now I either wanna run the script or launch the app and just hit enter / click a button and the title of a movie comes up, with the option to continuously do (until a movie sounds good haha)

I'll work with that, and try to understand it, thanks.

Link to comment
Share on other sites

  • 0

I gave you a script to use already. You quoted my post with the link to it. Just stick with that since it's neatly explained with what you need to do.

Your linked program produces quotes from films (if I read correctly), he is after a program that will randomly pick 1 film from a list of all the films he owns.

Link to comment
Share on other sites

  • 0

Your linked program produces quotes from films (if I read correctly), he is after a program that will randomly pick 1 film from a list of all the films he owns.

Actually, no. The functionality is exactly the same as to what he needs. Replace "quotes" with "movies." See how it will now show a random movie on refresh?

Exactly what he needs.

PS - Not a program. It's a script.

Link to comment
Share on other sites

  • 0

Actually, no. The functionality is exactly the same as to what he needs. Replace "quotes" with "movies." See how it will now show a random movie on refresh?

Exactly what he needs.

PS - Not a program. It's a script.

Ah yes, I see that now. Damn, I must stop posting on Saturday nights after a beer of 3.

Insert the names of the movies you own in place of the quotes in the script. Now I understand - or do I? :blush:

Link to comment
Share on other sites

  • 0

http://davidmarotz.com/quotes.php

You state program so I'm not sure if you're actually going to develop for Windows/OSX/Linux or if you mean script (web based.) Either way, there's a script I just gave. Populate it yourself, refresh and it will display random.

I copy/pasted the script from <? to ?> and switched my movies for those quotes, saved it as "quotes.php" and ran it in the browser, but it only comes up as black text of the script?! What am I doing wrong to actually run the script?

Link to comment
Share on other sites

  • 0

I've seen this topic title way too long, so here is a quick script for you.

$movieArray = array("1" =&gt; "Movie title 1", 
					"2" =&gt; "Movie title 2", 
					"3" =&gt; "movie title 3", 
					"4" =&gt; "Movie title 4");

//count the array
$TotalMovies = count($movieArray);

// pick a random number
$MoviePick = rand(1, $TotalMovies);
echo "Tonight you will watch: ". $movieArray[$MoviePick];

Hopefully this solves your problem on picking a movie :p

Link to comment
Share on other sites

  • 0

I've seen this topic title way too long, so here is a quick script for you.

$movieArray = array("1" =&gt; "Movie title 1", 
					"2" =&gt; "Movie title 2", 
					"3" =&gt; "movie title 3", 
					"4" =&gt; "Movie title 4");

//count the array
$TotalMovies = count($movieArray);

// pick a random number
$MoviePick = rand(1, $TotalMovies);
echo "Tonight you will watch: ". $movieArray[$MoviePick];

Hopefully this solves your problem on picking a movie :p

How do I 'run' this script?

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.