Im relatively new in c++. I work at a TV provider and will soon start scheduling promos (between time breaks, for example every half hour or every hour according to the channel, there should be promotions or fillers).
I wanted to ask some advice as to how to start this program. My idea is to create an automatic scheduler that will smartly assign the promos or fillers respecting some parameters set.
I'll give you some examples:
The user should be able to define if the channel has 30 minutes or 1 hour breaks (in case of 30 minutes, 48 breaks in a day, 1 hour, 24).
Once defined, the user should input how many commercials have been booked (an should be able to apply a category to each one, for example: medicinal, cars, bank, etc, the time duration of the commercial and between with times it should be aired), for example a spot may be 40 seconds long, in category cars, and should air between 3 and 6.
Now comes the tricky part:
This scheduler should have priority for commercial spots (since they are a contract with the company that booked it and should be aired) but, in case there are empty time lapses, they should apply "fillers" (which are low priority time fillers to reach the ammount expected for the break).
Each break lasts 2 minutes and, for the sake of the example, 80 seconds are booked by commercials and a filler should be scheduled of 40 seconds to fulfill the break.
But, 2 categories cant be one after the other (since it would cause competition between brands, for example audi and bmw cant promote one after the other because its a conflict of interest, so a filler should be applied in the middle to avoid is).
The scheduler should allow the user to input how many breaks are in the day (since this varies between channels), how much the break lasts (for example, 2 minutes), how many commercials spots are there to be assigned (with their duration , category and the time interval in which it should air), and how many fillers are there and their category also (since there are marketing and pay per view fillers).
Also pay per view fillers should be applied between 0 a 7 am and marketing between 7 and 24.
Is this possible? How complicated is it really?
As I imagine it would go something as:
User inputs how many breaks and their duration, (example: 24 1 hour breaks)
User inputs how many promotions, their categories, and the expected air times. (example: promotion MKT102, category Cars, Should air between 2 and 5 am)
User inputs fillers and categories. (example FILLER02, category Pay Per View)
Scheduler runs with priority in assigning first commercial spots (checking no 2 categories are repeated and seeing that the time in the break is completely filled, if it is impossible to fill with non repeated commercials, add filler (if 0<CurrentTime<7 use filler Pay per view, if 7<CurrentTime<24 use filler Marketing). And, also, every time a filler is applied it should have a counter that goes +1 (as to avoid applying always the same filler and always apply the lowest number filler and vary the content).
If the spots are unplaceable (since categories are repeated and it cannot be avoided) it should say which spot couldn't be applied (since there might be overbooking).
Sorry for the huge text guys and thank you in advance if you read up to here and understood.
Any pointing me in the right direction will be much appreciated, and sorry if there are mispellings, im from Argentina :)
Last edited on
It looks pretty complicated (and also unrealistic, in my opinion: do tv advertisements all last the same time? Can programs be interrupted regardless what’s happening? I.e. can a film be interrupted while an high suspense scene is shown?), but the main point is: what’s your program supposed to do?
Should it perform a calculation and offer a rough summary?
If so, well, it requires a lot of calculation, but it’s not impossible. You could start by performing the basic (asking for number of advertisements and offering a basic summary) and, step by step, add new ‘parameters’ (advertisements of different length; later, different categories of advertisements... and so on).
You could start and see how long does it take you to perform the basic and then evaluate if it’s worth the time.
P.s. and sorry form my English too
Thank you for taking the time to answer.
Not all advertisements last the same time.
Up to now I'm working on a fstream input from a .txt file to a struct, creating the variables from the file (the advertisements) with the members; duration, id, client, category, limitA, limitB. (limit A is the lowest possible limit at which it can be placed and B the highest).
An example ad variable would be: ad1 with members: 20 seconds, 1, Audi, Cars, 09:00, 16:00.
Once this first part is finished (allowing users to paste the ads in a .txt in a certain format and the program imports them and assigns variables with struct to them) then I'll start working on the second part.
This consists of declaring the ammount of breaks in the day to be filled by the ads and then the placement of the imported ads respecting the following parameters:
- An ad must be placed between its members limitA and limitB, else skip to next ad.
- No 2 ads can be placed one after the other if they have the same client or category, if same category || client skip to next.
- No ads can be placed that last longer than the break, obviously.
- The break must be completely filled with ads before the program starts completing the next break.
- If no ad is available with the duration to fulfill the break, add a filler.
- The filler must be placed in the middle of the break.
I would need help with the following since I haven't figured it out yet:
> When importing from .txt file with fstream and getline, how do I get the program to assign different variables until all lines of the file have been assigned.
> Once variables ads have been created in struct, how do I tell the program to create the commercial breaks for the whole day and start filling out the breaks respecting the previous parameters.
That's really a great answer, AbstractionAnon!
I can't thank you enough AbstractionAno,
thanks for taking the time to explain this to me and for the perfect examples to get started.
You're right that I'm not comfortable with classes (because of my lack of experience). I'll definetly will use classes.
I'll get on it and, again, thank you! Will post the code once done.