Home Page
RABiD BUNNY FEVER
K.T.K

  • January 28, 2023, 10:42:04 AM *
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

Official site launch very soon, hurrah!


Author Topic: Alamo Draft House Schedule List  (Read 5754 times)

Dakusan

  • Programmer Person
  • Administrator
  • Hero Member
  • *****
  • Posts: 528
    • View Profile
    • Dakusan's Domain
Alamo Draft House Schedule List
« on: September 28, 2009, 05:32:29 AM »

Original post for Alamo Draft House Schedule List can be found at https://www.castledragmire.com/Posts/Alamo_Draft_House_Schedule_List.
Originally posted on: 07/24/09

After discovering the Alamo Draft House’s coolness a few months ago, I’ve been trying to watch what they’re playing to make sure I catch anything I might want to see on the big screen. Unfortunately, it is not easy to get a good quick idea of all the movies playing from their calendar because it shows movies per day with showtimes, making the list repetitive and crowded with extra information.

I decided to throw together a real quick PHP script that would parse their data so I could organize it however I wanted. The final result can be viewed here. The code is as follows:


//The list of calendar pages in format TheaterName=>URL
$PagesToGrab=Array(
   'Ritz'=>'http://www.originalalamo.com/Calendar.aspx?l=2',
   'Village'=>'http://www.originalalamo.com/Calendar.aspx?l=3',
   'South Lamar'=>'http://www.originalalamo.com/Calendar.aspx?l=4'
);

foreach($PagesToGrab as $Name => $URL) //Grab the movies for each theater
{
   print "$Name
"; //Output the theater name
   $TheHTML=file_get_contents($URL); //Grab the HTML
   $ShowList=Array(); //This will contain the final list of shows and what days they are on
   
   preg_match_all('/<td class="day">.*?<\/td>/', $TheHTML, $DayMatches); //Extract all table cells containing a day's info
   foreach($DayMatches[0] as $DayInfo) //Loop over each day's info
   {
      //Determine the day of month
      preg_match('/<a class=\"daynumber\" title=".*?, (.*?),/', $DayInfo, $DayOfMonth);
      $DayOfMonth=$DayOfMonth[1];
      
      //Determine all the shows for the day
      preg_match_all('/<span class="show"><a href=".*?">(.*?)<\/a>/', $DayInfo, $AllShows);
      foreach($AllShows[1] as $Show)
      {
         $Show=preg_replace('/^\s+|\s+$/', '', $Show); //Remove start and end of line whitespace
         if(!isset($ShowList[$Show])) //If show has not yet been added to overall list, add it
            $ShowList[$Show]=Array();
         $ShowList[$Show][]=$DayOfMonth; //Add this day as a time for the show
      }
   }
   
   //Output the shows and their days
   print '<table>';
   foreach($ShowList as $ShowName => $Days)
      print "<tr><td>$ShowName</td><td>".implode(', ', $Days).'</td></tr>';
   print '</table>

';
}   
<? PageFooter(); ?>
</body></html>
Logged