Thread: Random Movie Project

  1. #1
    Registered User
    Join Date
    May 2009
    Location
    Oregon, USA
    Posts
    9

    Random Movie Project

    Hey there everyone,

    My roommates and I (There are six of us in total) just recently built a media server for our house that's hooked up to the TV in our living room and is wired into the network so everyone can access it from any computer in the house. The one problem I've been having with it is browsing through the 1000+ movies that we have trying to decide which to watch.

    Being an entry level programmer I figured I would attempt to employ my newfound skills to solve this problem and write a program to randomly choose a movie for me. I wrote out a basic plan of what functions I would need and came up with the following.

    A function to Get a full list of the movies in question, a randomizing algorithm (I want to try and figure out something a little more random than the rand() function), and a function to choose the movie and report which movie has been chosen.

    Once I'd figured out what functions I'd need I sat down ready to write the code and realized I had absolutely no clue where to start. I guess the first question I have is how I would compile a list of all the movies without having to enter the title of each one into a text file manually. We currently have all the movies divided into one individual folders (ie. "E:\Movies\Fight Club\Fight Club.avi") and series are all in one folder as well (ie. "E:\Movies\Star Wars\Episode I.avi" "E:\Movies\Star Wars\Episode 2.avi").

    I figure in order to get all of the movies into a single list I'm also going to need a way for the program to tell when it's at the bottom most level of the folders and can add the avi names to the list of movies.

    Any help that or a nudge in the right direction would be awesome! Thanks guys

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    How long have you been programming in C?

    Believe me if it's less than a year, this project is beyond you... It will involve Windows GUI programming, WinAPI system calls, and not a little fenagelling with networking and Winsock to make it work.

    How do I know this? Well... Remote Media

  3. #3
    Registered User
    Join Date
    May 2009
    Location
    Oregon, USA
    Posts
    9
    I've been programming in C for about 2 years now, yet everything I know is completely self taught so i'm probably not as advanced as most people who've been using the language for that long. Would it be a simpler process if the program were running on the media server and I didn't have to deal with any networking?

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Yes that would simplify it somewhat... But you still have to walk the directories and catalog the files somehow...
    Basically you need to buld a database and pick a record at random.

    Personally if it was me writing that I would offer the user 5 choices... and let them decide the final movie.

    (And FWIW, I also have very large collections of movies and music... 800 movies and nearly 25000 songs... so I can see the merrit in the idea...)

    I take it from your path names you are on windows... look into the FindFirstFile() FindNextFile() and FindClose() functions on MSDN... That's the core of building a list of all your files. (The better organized they are the better it will work). Once you have the list it's pretty simple to select one at random... look up the C standard functions srand() and rand().
    Last edited by CommonTater; 05-13-2011 at 09:05 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Movie preview project architecture help
    By kroiz in forum C# Programming
    Replies: 8
    Last Post: 09-20-2008, 03:09 AM
  2. Just a random project
    By jverkoey in forum Tech Board
    Replies: 6
    Last Post: 07-20-2005, 06:56 PM
  3. Generate random numbers in Lucky7 project using C#
    By Grayson_Peddie in forum C# Programming
    Replies: 1
    Last Post: 04-11-2003, 11:03 PM
  4. Have you seen this movie?
    By Imperito in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 04-02-2002, 07:05 PM
  5. Which Movie
    By Witch_King in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 09-02-2001, 10:37 AM