示例#1
0
 public function getRelease()
 {
     if (!isset($this->release) && !empty($this->info)) {
         /* wir holen uns das Release so:
              meist steht am Ende (xvid|h.264|web-ddl|..etc...)-$release
            */
         // @TODO mal in en Parser auslagern
         // das ist <Format>-<ReleaseGroup> am Ende des Strings
         // sowas wie AVC-TVS oder XviD-RSG
         $this->release = Preg::qmatch($this->info, '/([a-z0-9A-Z]+-[a-zA-Z0-9&]+)$/', 1);
         /* group darf auch leer sein, dann versuchen wir das release anders zu bekommen
          */
         if (!isset($this->release)) {
             if (($this->release = Preg::qmatch($this->info, '/S[0-9]+E[0-9]+\\.German\\.Dubbed\\.DL\\.(.*)$/', 1)) !== NULL) {
                 $this->release = str_replace('.', ' ', $this->release);
                 return $this->release;
             }
             try {
                 // normalize
                 $this->release = \Psc\Preg::matchArray(array('/(WEB.DL(.*)720p|720p(.*)WEB.DL)/i' => 'WEB-DL 720p', '/(WEB.DL(.*)1080|1080(.*)WEB.DL)/i' => 'WEB-DL 1080', '/720p.ITunesHD/' => 'ITunesHD 720p', '/WEB-DL/i' => 'WEB-DL', '/(dvdrip(.*)xvid|dvdrip(.*)xvid)/i' => 'XviD-DVDRip', '/dvdrip/i' => 'DVDRip'), $this->info);
             } catch (\Psc\NoMatchException $e) {
             }
         }
         /* jetzt suchen wir noch nach tags, die das Release besser kennzeichnen */
         try {
             $tags = \Psc\Preg::matchFullArray(array('/ITunesHD/i' => 'ITunes', '/WEB.DL/i' => 'WEB-DL', '/dvdrip/i' => 'DVDRip', '/720p/i' => '720p', '/1080p/i' => '1080p', '/1080i/i' => '1080i', '/dvdscr/i' => 'DVDScr', '/blue?ray/i' => 'Bluray', '/xvid/i' => 'XviD'), $this->info);
             // merge
             foreach ($tags as $tag) {
                 if (mb_stripos($this->release, $tag) === FALSE) {
                     $this->release .= ' ' . $tag;
                 }
             }
         } catch (\Psc\NoMatchException $e) {
         }
         $this->release = trim($this->release);
         if ($this->release === '') {
             $this->release = NULL;
         }
     }
     return $this->release;
 }