1.1 Task 1
Create a database, with one table "processings" whose definition is:
CREATE TABLE IF NOT EXISTS `processings` ( `id` int(11) NOT NULL AUTO_INCREMENT, `status` int(11) NOT NULL, `date_received` date NOT NULL, `date_last_updated` date NOT NULL, `public_url` varchar(1024) DEFAULT NULL, PRIMARY KEY (`id`),
KEY `status` (`status`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
• Field "id" = the unique identifier of a video
• Field "status" = the status of the video, as an integer:
o0 = The video set has been received and is being stored onto local storage o1 = The video set has been received, but nothing has been done yet with it o2 = The video set is under processing
o3 = The video has been built
o4 = The video is being uploaded to Youtube
o5 = The video has been uploaded to Youtube, everything is finished. • Field "date_received" = the date the video set was first received
• Field "date_last_updated" = the date of the last status change
• Field "public_url" = the public URL (Youtube URL of the video)
Create a PHP script that will is able to receive 3 files sent via HTTP POST:
1. 1st file = video 1 (which is always 2 second long)
2. 2nd file = video 2 (which is always 2 second long)
3. 3rd file = video 3 (which is always 8 second long )
All the 3 videos are uploaded in one single operation (so one single HTTP POST call, with the 3 files in it).
This PHP script will be hosted on http:///[url removed, login to view] Once these 3 videos are received, the PHP script achieves the following tasks:
1. The server inserts a new row in the "processings" table, with the status "0", date_received = NOW(), date_last_updated = NOW() and public_url = NULL
2. The server retrieves the "id" of the newly created row (which is auto increment in the DB) (example: 1234)
3. The server stores these 3 videos onto local storage, in a subfolder which has as name the id (example: "/var/www/quiestla/uploadedVideos/1234/[url removed, login to view]")
4. Once the 3 videos are stored, the server updates the row of the "processings" table and set: status = "1" and date_last_updated = NOW()
5. The server writes in the HTTP output the "id"
?• Programming language: PHP • Web server: nginx
• Database: MySQL 5.x
Your responsibility (Technobyte):
• Setting up nginx + MySQL + PHP
• Programming the PHP script
1.2 Task 2
Create a software that reads the "processings" DB table, and that selects the oldest record with status = "1".
Once the oldest record has been selected, the server updates the row of the "processings" table and set: status = "2" and date_last_updated = NOW()
This software loads the template video (the software will always use the same template video), and loads the 3 videos that have been uploaded for the record that has been selected from the DB (the 3 videos can be found on the local storage using the ID of the record, see task 1).
The software merges the template video with the 3 videos in this way:
1. The software replaces the green key of the 2 first seconds by the video 1 which is always 2 second long.
2. The software replaces the green key of 2 first seconds by the video 1 which is always 2 second long.
3. The software replaces the green key of the 8 first seconds by the video 1 which is always 8 second long.
The software then save the resulting video on the disk, under a subfolder which has as name the id of the selected record (example: "/var/www/quiestla/processedVideos/1234/[url removed, login to view]")
Then, the software updates the row of the "processings" table and set: status = "3" and date_last_updated = NOW()
Finally, the software re-reads the "processings" DB table, selects the oldest record with status = "1" and restart all this Task 2.
If there are no other records with status = "1" to process, the software retries every 2 seconds to fetch a record until it obtains one.
• Programming language: up to you
Two more tasks but not enough characters