Esempio n. 1
0
 /**
  * no guessing - if value seems reasonable or not - required
  */
 public function migrateNonGuessableData($rawArray)
 {
     $t = new \Slimpd\Track();
     $t->setId($rawArray['id']);
     $t->setRelativePath($rawArray['relativePath']);
     $t->setRelativePathHash($rawArray['relativePathHash']);
     $t->setDirectoryPathHash($rawArray['relativeDirectoryPathHash']);
     $t->setFingerprint($rawArray['fingerprint']);
     $t->setMimeType($rawArray['mimeType']);
     $t->setFilesize($rawArray['filesize']);
     $t->setFilemtime($rawArray['filemtime']);
     $t->setMiliseconds(round($rawArray['miliseconds'] * 1000));
     $t->setAudioDataformat($rawArray['audioDataformat']);
     $t->setAudioCompressionRatio($rawArray['audioCompressionRatio']);
     $t->setAudioEncoder($rawArray['audioEncoder'] ? $rawArray['audioEncoder'] : 'Unknown encoder');
     if ($rawArray['audioLossless']) {
         $t->setAudioLossless($rawArray['audioLossless']);
         if ($rawArray['audioCompressionRatio'] == 1) {
             $t->setAudioProfile('Losless');
         } else {
             $t->setAudioProfile('Losless compression');
         }
     }
     $t->setAudioBitrate(round($rawArray['audioBitrate']));
     // integer in database
     if (!$t->getAudioProfile()) {
         $t->setAudioProfile($rawArray['audioBitrateMode'] . " " . round($t->getAudioBitrate() / 1000, 1) . " kbps");
     }
     $t->setAudioBitsPerSample($rawArray['audioBitsPerSample'] ? $rawArray['audioBitsPerSample'] : 16);
     $t->setAudioSampleRate($rawArray['audioSampleRate'] ? $rawArray['audioSampleRate'] : 44100);
     $t->setAudioChannels($rawArray['audioChannels'] ? $rawArray['audioChannels'] : 2);
     $t->setVideoDataformat($rawArray['videoDataformat']);
     $t->setVideoCodec($rawArray['videoCodec']);
     $t->setVideoResolutionX($rawArray['videoResolutionX']);
     $t->setVideoResolutionY($rawArray['videoResolutionY']);
     $t->setVideoFramerate($rawArray['videoFramerate']);
     $t->setImportStatus($rawArray['importStatus']);
     $t->setLastScan($rawArray['lastScan']);
     $t->setError($rawArray['error']);
     $t->setDr($rawArray['dynamicRange']);
     return $t;
 }