Example #1
0
<?php

$m = new MediaInfo();
$info = $m->getMovieInfo('American Beauty');
print_r($info);
class MediaInfo
{
    public $info;
    function __construct($str = null)
    {
        if (!is_null($str)) {
            $this->autodetect($str);
        }
    }
    function autodetect($str)
    {
        // Attempt to cleanup $str in case it's a filename ;-)
        $str = pathinfo($str, PATHINFO_FILENAME);
        $str = $this->normalize($str);
        // Is it a movie or tv show?
        if (preg_match('/s[0-9][0-9]?.?e[0-9][0-9]?/i', $str) == 1) {
            $this->info = $this->getEpisodeInfo($str);
        } else {
            $this->info = $this->getMovieInfo($str);
        }
        return $this->info;
    }
    function getEpisodeInfo($str)
    {
        $arr = array();
        $arr['kind'] = 'tv';