pvpd.php 1019 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. class VideoEntry {
  3. public $filename = null;
  4. public $label = null;
  5. public $codecs = null;
  6. public function from_string($str) {
  7. $parts = explode(",", $str, 3);
  8. $this->label = trim($parts[0]);
  9. $this->filename = trim($parts[1]);
  10. $this->codecs = trim($parts[2]);
  11. }
  12. }
  13. class Pvpd {
  14. public $entries = array();
  15. public $description = null;
  16. public $files = array();
  17. public function from_string($str) {
  18. $parts = explode("\n\n", $str, 3);
  19. $this->description = $parts[2];
  20. $lines = explode("\n", $parts[0]);
  21. foreach ($lines as $line) {
  22. if($line != "PVPD"){
  23. $entry = explode(":", $line, 2);
  24. $this->files[$entry[0]] = $entry[1];
  25. }
  26. }
  27. $lines = explode("\n", $parts[1]);
  28. foreach ($lines as $line) {
  29. $entry = new VideoEntry();
  30. $entry->from_string($line);
  31. array_push($this->entries, $entry);
  32. }
  33. }
  34. }
  35. ?>