예제 #1
3
 public function __construct($data = null)
 {
     $this->chunk_factory = Inject::the(new SSLChunkFactory());
     $this->data = $data;
     $this->data_len = strlen($data);
 }
예제 #2
2
 /**
  * You should construct the parser with a $dom of the type that you wish to 
  * fill in from the parsed chunks (different DOM types have different parsing
  * semantics for the chunk types). For example, you probably want to use the
  * SSLHistoryDom for reading the history file, as this DOM understands that
  * ADAT chunks are SSLTracks. 
  * 
  * @param SSLDom $dom
  */
 public function __construct(SSLDom $dom = null)
 {
     $this->factory = Inject::the(new SSLRepo());
     if (isset($dom)) {
         $this->dom_prototype = $dom;
     } else {
         $this->dom_prototype = $this->factory->newDom();
     }
 }
예제 #3
2
 public function __construct($array = array())
 {
     $this->track_factory = Inject::the(new SSLTrackFactory());
     parent::__construct($array);
 }
 public function __construct($filename, DiffMonitor $monitor)
 {
     $factory = Inject::the(new SSLRepo());
     $monitor->setFilename($filename);
     $monitor->setPrototype($factory->newHistoryIndexDom());
     $monitor->setDiffDelegate($this);
 }
예제 #5
1
 public function __construct()
 {
     $this->factory = Inject::the(new SSLRepo());
 }
예제 #6
1
 public function __construct($program)
 {
     $this->factory = Inject::the(new XoupRepo());
     $this->subs = $this->parse($program);
 }
예제 #7
0
 /**
  * Sometimes ScratchLive doesn't supply the length, even when it knows the file.
  * Not sure why; perhaps files that have never been analysed.
  * 
  * So, let's attempt to guess it by analysing the full file.
  */
 protected function guessLengthFromFile()
 {
     $fullpath = $this->getFullpath();
     if (strlen($fullpath) == 0) {
         L::level(L::WARNING) && L::log(L::WARNING, __CLASS__, 'Guessing MP3 length from file failed: full path was empty. Perhaps this entry was manually added?', array());
         return "0:00";
     }
     if (!$this->file_exists($fullpath)) {
         L::level(L::WARNING) && L::log(L::WARNING, __CLASS__, 'Guessing MP3 length from file failed: file not found (%s)', array($fullpath));
         return "0:00";
     }
     $external_factory = Inject::the(new ExternalRepo());
     /* @var $external_factory ExternalFactory */
     $getid3 = $external_factory->newGetID3();
     /* @var $getid3 getid3 */
     $getid3->option_tag_lyrics3 = false;
     $getid3->option_tag_apetag = false;
     $getid3->option_extra_info = true;
     $getid3->encoding = 'UTF-8';
     try {
         $info = $getid3->Analyze($fullpath);
         $playtime = $info['playtime_seconds'];
         if ($playtime) {
             L::level(L::WARNING) && L::log(L::WARNING, __CLASS__, 'Guessed MP3 length %d seconds from file.', array($playtime));
             $minutes = floor($playtime / 60);
             $seconds = $playtime % 60;
             return sprintf("%d:%02d", $minutes, $seconds);
         }
         L::level(L::WARNING) && L::log(L::WARNING, __CLASS__, 'Guessing MP3 length from file failed for an unknown reason. Hmmph.', array());
     } catch (getid3_exception $e) {
         // MP3 couldn't be analyzed.
         L::level(L::WARNING) && L::log(L::WARNING, __CLASS__, 'Guessing MP3 length from file failed: %s', array($e->getMessage()));
     }
     return "0:00";
 }
예제 #8
0
 public function __construct()
 {
     $this->xoup_factory = Inject::the(new XoupRepo());
 }