Активный участник
Покинул форум
Сообщений всего: 4555
Дата рег-ции: Февр. 2007
Откуда: Симферополь
Помог: 98 раз(а)
|
Ch_chov не это на php
JustUserR что-то не помогает. поставил
далее приведу сам скрипт
PHP:
скопировать код в буфер обмена
function createXSPFPlaylist($path='') { global $mosConfig_absolute_path, $mosConfig_locale; if (!empty($path)) { require_once($mosConfig_absolute_path.'/components/com_kinoarhiv/service/getid3/getid3.php'); setlocale (LC_ALL, $mosConfig_locale.'UTF8', _ADM_KA_LOCALE.'UTF8', $mosConfig_locale.'UTF-8', _ADM_KA_LOCALE.'UTF-8'); // Needed for windows only define('GETID3_HELPERAPPSDIR', 'C:/helperapps/'); $getID3 = new getID3; $dir = @opendir($mosConfig_absolute_path.$path); $l = fopen($mosConfig_absolute_path.$path.'/playlist.xml', 'w') or die('Cant create file'); fclose($l); if ($dir === false) { echo 'Cannot open directory!'; } else { $xml = '<?xml version="1.0" encoding="UTF-8"?>'."\r\n"; $xml .= '<playlist version="1" xmlns="http://xspf.org/ns/0/">'."\r\n"; $xml .= "\t<title>Soundtracks playlist for movie</title>\r\n"; $xml .= "\t<tracklist>\r\n"; $xml_start = iconv('windows-1251', 'UTF-8//IGNORE', $xml); $handle = fopen($mosConfig_absolute_path.$path.'/playlist.xml', 'a'); fwrite($handle, $xml_start); while (false !== ($file = readdir($dir))) { $ff_name = realpath($mosConfig_absolute_path.$path.'/'.$file); if (is_file($ff_name)) { set_time_limit(60); $f_info = $getID3->analyze($ff_name); getid3_lib::CopyTagsToComments($f_info); $path_new = $f_info['filenamepath']; $file_ext = substr($path_new, strrpos($path_new, '.') +1); echo '<pre>'; print_r($f_info['comments']); echo '</pre>'; if ($file_ext == 'mp3') { if (isset($f_info['comments'])) { $title = $f_info['comments']['title'][0]; $artist = $f_info['comments']['artist'][0]; $album_y = $f_info['comments']['album'][0].' ('.$f_info['comments']['year'][0].')'; } $line = "\t\t<track>\r\n"; $line .= "\t\t\t<title>".$title."</title>\r\n"; $line .= "\t\t\t<creator>".$artist."</creator>\r\n"; $line .= "\t\t\t<annotation>".$album_y."</annotation>\r\n"; $line .= "\t\t\t<info>".$time."</info>\r\n"; $line .= "\t\t\t<location>".$path_new."</location>\r\n"; $line .= "\t\t</track>\r\n"; $line_result = iconv('windows-1251', 'UTF-8//IGNORE', $line); fwrite($handle, $line); } } } $xml_end = "\t</tracklist>\r\n"; $xml_end .= "</playlist>"; $xml_end_result = iconv('windows-1251', 'UTF-8//IGNORE', $xml_end); fwrite($handle, $xml_end_result); fclose($handle); } } }
в результате получаю тот же самый файл в windows-1251 ANSI(Отредактировано автором: 26 Марта, 2010 - 08:38:37)
|