public function getMediaMatches($id)
 {
     $media = Media::find($id);
     if (!$media) {
         return [];
     }
     return array_merge(json_decode($media->destinationMatches()->get()), json_decode($media->sourceMatches()->get()));
 }
 /**
  * TODO: This method will hopefully be deleted some day, and audfprint will just return structured data
  * For now it takes the output from an audfprint match operation and returns a structured list of matches
  * @param  string[] $logs The log output from an audf process
  * @return object[]       The list of matches
  */
 private function processAudfMatchLog($logs)
 {
     $matches = [];
     foreach ($logs as $line) {
         $match_pattern = '/Matched\\s+(\\S+)\\s+s\\s+starting\\s+at\\s+(\\S+)\\s+s\\s+in\\s+(\\S+)\\s+to\\s+time\\s+(\\S+)\\s+s\\s+in\\s+(\\S+)\\s+with\\s+(\\S+)\\s+of\\s+(\\S+)\\s+common\\s+hashes\\s+at\\s+rank\\s+(\\S+)/';
         if (preg_match($match_pattern, $line, $match_data)) {
             // TODO: This object sctructure should be defined somewhere... not randomly in the middle of code
             // matched_file -> the filename of the match
             // duration -> the duration of the match
             // start -> where in the INPUT file the match starts
             // target_start -> where in the MATCHED file the match starts
             // The file name has a distinct pattern that contains the media ID in the system
             $file_pattern = '/.*media\\-(\\d*)\\_(\\d*)\\..*/';
             preg_match($file_pattern, $match_data[5], $file_data);
             $destination_media = Media::find($file_data[1]);
             // Remove chunk information from matched file
             $matched_file = str_replace('_' . $file_data[2], '', $match_data[5]);
             $match = ["matched_file" => $matched_file, "duration" => floatval($match_data[1]), "start" => floatval($match_data[2]), "target_start" => floatval($match_data[4]) + floatval($file_data[2]) * env('FPRINT_CHUNK_LENGTH'), "destination_media" => $destination_media, "consecutive_hashes" => floatval($match_data[6]), "common_hashes" => floatval($match_data[7]), "rank" => floatval($match_data[8])];
             // Combine matches across chunks
             // We don't want matches that are too short
             if ($match['duration'] < 2) {
                 continue;
             }
             array_push($matches, $match);
         }
     }
     return $matches;
 }