Ok, I wont post the full snippet because not many people need to extract group name and release type and the code isnt that great for that part.
Class: SceneName
Description: Parses the scene format for TV Shows. Persumes that the source follows the correct nameing structure.
Class: SceneName
Description: Parses the scene format for TV Shows. Persumes that the source follows the correct nameing structure.
PHP:
<?
/*
Class: SceneName
Description: Parses the scene format for TV Shows. Persumes that the source follows the correct nameing structure.
written by splitice (thewarezscene.org)
*/
class SceneName {
private $text = '';
private $parsed = array();
private function _parse(){
$p = explode('.',$this->text);
$season = array();
$name = '';
foreach($p as $v){
if($v{0}=='S'&&$v{3}=='E'){//Season Number Episode Number
$season['season'] = (int)($v{1}.$v{2});
$season['episode'] = (int)($v{4}.$v{5});
}else if($v{0}=='S'){ //Just season
$season['season'] = (int)($v{1}.$v{2});
}else{
if($season){
}else{
if($name) $name.= ' ';
$name.=$v;
}
}
}
if(!$season){
trigger_error('SceneName: cant recognise season');
return false;
}
if(!$name){
trigger_error('SceneName: cant recognise show name');
return false;
}
$this->parsed = array('name'=>$name,'show'=>$season);
}
function name(){
if(!$this->parsed) $this->_parse();
return $this->parsed['name'];
}
function show(){
if(!$this->parsed) $this->_parse();
return $this->parsed['show'];
}
function SceneName($text){
$this->text = $text;
}
function __toString(){
return $this->text;
}
}
?>