xpath('key[text()="' . $key . '"]/following-sibling::*')[0]; } $folder = (string)$xml->xpath('/plist/dict/key[text()="Music Folder"]/following-sibling::string')[0]; //foreach ($xml->dict->dict->dict as $dict) { foreach ($xml->xpath('/plist/dict/key[text()="Tracks"]/following-sibling::dict/dict') as $dict) { $location = dict_key('Location'); if (substr($location, 0, strlen($folder)) !== $folder) continue; $location = Normalizer::normalize(rawurldecode(substr($location, strlen($folder)))); if (substr($location, 0, 6) === 'Music/') { if (!file_exists($location)) { // sometimes, the URL and folder case don't match $location = @$lowers[strtolower($location)]; } if (file_exists($location)) $songs[] = array(dict_key('Artist'), dict_key('Album'), dict_key('Name'), myencodedurl($location), (int)dict_key('Total Time'), date('Y-m-d H:i:s', strtotime(dict_key('Date Added')))); else $no[] = $location; } } } else { foreach (glob('Music/*/*/*') as $song) { list(, $artist, $album, $name) = explode('/', $song); if ($artist === 'Unknown Artist') $artist = ''; if ($album === 'Unknown Album') $album = ''; $songs[] = array($artist, $album, pathinfo($name, PATHINFO_FILENAME), myencodedurl($song), 0, '?'); } } function song_cmp($a, $b) { $cmp = 0; switch (@$_GET['sort']) { case 'time': $cmp = $b[4] - $a[4];// Time break; case 'date': $cmp = strcasecmp($b[5], $a[5]);// Date break; } if ($cmp === 0) $cmp = strcasecmp(preg_replace('/^The +/i', '', $a[0]), preg_replace('/^The +/i', '', $b[0]));// Artist if ($cmp === 0) $cmp = strcasecmp($a[1], $b[1]);// Album if ($cmp === 0) $cmp = strcasecmp($a[2], $b[2]);// Name return $cmp; } usort($songs, 'song_cmp'); ?> <?= htmlspecialchars($title) ?>

Missing :

Name Time Date
DL