
redcarpet.daylife.com brings you the celebrity sightings on the red carpet at the latest movie premieres, award nights and parties in tinsel towns. Here's how we brought the magic that is red carpet into the widget world.
Redcarpet was developed as part of a coding contest in Daylife. Upe and Vineet's passion with celebrity sightings in new york movtivated them to build the ultimate experience of bringing the photos of all celebrities on the red carpet.
Redcarpet by putting a lightweight application in front of the DayPI. The whole project is a set of 10 php pages talking to the DayPIs and a mysql server.
The red carpet project is a mini pipline with these steps:
Every morning there a process runs and calls search_getRelatedImages for a set of query terms:
'arrive%20party', 'arrives%20party', 'arriving%20party', 'arrived%20party', 'arrive%20awards', 'arrives%20awards', 'arriving%20awards', 'arrived%20awards', 'red%20carpet', 'arrive%20gala', 'arrives%20gala', 'arriving%20gala', 'arrived%20gala', 'arrive%20festival', 'arrives%20festival', 'arriving%20festival', 'arrived%20festival', 'arrive%20premiere', 'arrives%20premiere', 'arriving%20premiere', 'arrived%20premiere', 'arrive%20screening', 'arrives%20screening', 'arriving%20screening', 'arrived%20screening' All images are stored in a local mysql database. For every image, image_getTopics is called to pull the related celebrities that are mentioned in the image caption. image_getTopics also retrieves the places mentioned in the image caption
The redcarpet admin tool lets an editor browse through the latest images that were pulled from the DayPIs.
The editor looks at the caption of the images and idenitifies new parties that happened. The admin tool lets the editor create a party with that name and all images whose caption contained that party name are assigned to that party.
Once the parties have been created, the redcarpet database schema assigns the celebrities and places for the images to that party.
If you want to use the redcarpet APIs, email developer@daylife.com
Here is the database schema for the red carpet project:
CREATE TABLE rc_image ( `image_id` bigint(20) unsigned NOT NULL default '0', `source_id` bigint(20) unsigned default NULL, `image_datetime` bigint(20) unsigned default NULL, `width` int(10) unsigned default NULL, `height` int(10) unsigned default NULL, `article_id` bigint(20) unsigned default NULL, `associated_text` mediumtext, `journalist_id` bigint(20) unsigned default NULL, `credit` varchar(127) default NULL, `added` bigint(20) unsigned default NULL, PRIMARY KEY (`image_id`), KEY `rc_image_idx_image` (`image_id`,`image_datetime`), KEY `rc_image_idx_image_article_id` (`article_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; create table rc_party_photo ( party_id BIGINT(20) unsigned NOT NULL, image_id BIGINT(20) unsigned NOT NULL, PRIMARY KEY (party_id,image_id) ) ENGINE InnoDB DEFAULT charset=utf8; create table rc_photo_people ( photoid BIGINT(20) unsigned NOT NULL, peopleid BIGINT (20) unsigned NOT NULL, PRIMARY KEY (photoid, peopleid) ) ENGINE InnoDB DEFAULT CHARSET=utf8; create index idx_rc_photo_people_people_id on rc_photo_people (peopleid); create table rc_photo_place( photoid BIGINT(20) unsigned NOT NULL, placeid BIGINT (20) unsigned NOT NULL, PRIMARY KEY (photoid, placeid) ) ENGINE InnoDB DEFAULT CHARSET=utf8; create table rc_party ( party_id BIGINT(20) AUTO_INCREMENT NULL, partyname varchar(127) DEFAULT NULL, place_id BIGINT(20) unsigned DEFAULT NULL, partyday BIGINT(20) UNSIGNED DEFAULT NULL , partytime BIGINT(20) UNSIGNED DEFAULT NULL, journalist_id BIGINT(20) UNSIGNED DEFAULT NULL, PRIMARY KEY (party_id) ) ENGINE InnoDB DEFAULT charset=utf8; create table rc_people ( peopleid BIGINT(20) UNSIGNED NOT NULL, peoplename VARCHAR(127), gender VARCHAR(2), PRIMARY KEY (peopleid) ) ENGINE InnoDB DEFAULT charset=utf8; CREATE TABLE rc_place ( `placeid` bigint(20) unsigned NOT NULL, `placename` varchar(127) default NULL, PRIMARY KEY (`placeid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; create view rc_view_party_people AS select distinct a.party_id, b.peopleid from rc_party_photo a, rc_photo_people b where a.image_id = b.photoid; create table rc_photo_person_rating ( photoid BIGINT(20) UNSIGNED NOT NULL, personid BIGINT(20) UNSIGNED NOT NULL, partyid BIGINT(20) UNSIGNED NOT NULL, rating INT(2) UNSIGNED NOT NULL, PRIMARY KEY (personid) ) ENGINE InnoDB DEFAULT charset=UTF8; create table rc_image_supplement ( image_id BIGINT(20) unsigned NOT NULL, partydate BIGINT(20) unsigned NOT NULL, journalist_id BIGINT(20) unsigned NOT NULL, PRIMARY KEY (image_id) ) ENGINE InnoDB DEFAULT charset=utf8; create view rc_view_party_photo_count as select party_id, count(*) num_photos from rc_party_photo group by (party_id); create view rc_view_top_partiers as select a.peopleid, b.peoplename, b.gender, count(*) num_parties from rc_view_party_people a, rc_people b where a.peopleid = b.peopleid group by a.peopleid order by num_parties desc; create view rc_most_attended_parties as select a.party_id, a.partyname, (a.num_men + b.num_women) num_partiers, a.num_men, b.num_women from rc_view_party_men a, rc_view_party_women b where a.party_id = b.party_id order by num_partiers desc; create view rc_view_party_pairs as select a.peopleid person_id, b.peopleid with_id, a.party_id from rc_view_party_people a, rc_view_party_people b where a.party_id = b.party_id and a.peopleid != b.peopleid; create view rc_view_top_places as select a.placeid, b.placename, count(*) num_photos from rc_photo_place a, rc_place b where a.placeid = b.placeid group by (placeid) order by num_photos desc;