$dict = bdec_file('public/downloads/torrents/'.$id.'.torrent', (1024 * 1024) );
$dirname = $dict['value']['info']['value']['name']['value'];
$sql = $db->query("SELECT * FROM files WHERE id_torrent = ".$arr['id']." ORDER BY id");
if(!$db->num_rows($sql)) {
err("Ошибка" , "»Извините, но наша система не нашла файлов" , 1);
}
while($row = $db->get_row($sql) ) {
$result = strip_tags(iconv("utf-8" , "windows-1251" , $row['filename']));
$filename = explode("/", $result);
echo "http://mp4.sitename.com/serials/$dirname/$filename[0]/$filename[1]/index.m3u8"
}
Результат:
http://mp4.sitename.com/serials/A_police_officer_with_the_ruble_in_2016_SATRip/episode_1/Серия_1.mp4/index.m3u8
http://mp4.sitename.com/serials/A_police_officer_with_the_ruble_in_2016_SATRip/episode_1/Серия_2.mp4/index.m3u8
http://mp4.sitename.com/serials/A_police_officer_with_the_ruble_in_2016_SATRip/episode_1/Серия_3.mp4/index.m3u8
http://mp4.sitename.com/serials/A_police_officer_with_the_ruble_in_2016_SATRip/episode_1/Серия_4.mp4/index.m3u8
http://mp4.sitename.com/serials/A_police_officer_with_the_ruble_in_2016_SATRip/episode_1/Серия_5.mp4/index.m3u8
http://mp4.sitename.com/serials/A_police_officer_with_the_ruble_in_2016_SATRip/episode_1/Серия_6.mp4/index.m3u8
http://mp4.sitename.com/serials/A_police_officer_with_the_ruble_in_2016_SATRip/episode_1/Серия_7.mp4/index.m3u8
http://mp4.sitename.com/serials/A_police_officer_with_the_ruble_in_2016_SATRip/episode_2/Серия_1.mp4/index.m3u8
http://mp4.sitename.com/serials/A_police_officer_with_the_ruble_in_2016_SATRip/episode_2/Серия_2.mp4/index.m3u8
http://mp4.sitename.com/serials/A_police_officer_with_the_ruble_in_2016_SATRip/episode_2/Серия_3.mp4/index.m3u8
http://mp4.sitename.com/serials/A_police_officer_with_the_ruble_in_2016_SATRip/episode_2/Серия_4.mp4/index.m3u8
http://mp4.sitename.com/serials/A_police_officer_with_the_ruble_in_2016_SATRip/episode_2/Серия_5.mp4/index.m3u8
http://mp4.sitename.com/serials/A_police_officer_with_the_ruble_in_2016_SATRip/episode_2/Серия_6.mp4/index.m3u8
http://mp4.sitename.com/serials/A_police_officer_with_the_ruble_in_2016_SATRip/episode_2/Серия_7.mp4/index.m3u8
{"id":"1120","id_torrent":"930","filename":"episode_1\/\u0421\u0435\u0440\u0438\u044f_1.sitename.com.mp4","size":"318294280"}
{"id":"1121","id_torrent":"930","filename":"episode_1\/\u0421\u0435\u0440\u0438\u044f_2.sitename.com.mp4","size":"293116949"}
{"id":"1122","id_torrent":"930","filename":"episode_1\/\u0421\u0435\u0440\u0438\u044f_3.sitename.com.mp4","size":"313956264"}
{"id":"1123","id_torrent":"930","filename":"episode_1\/\u0421\u0435\u0440\u0438\u044f_4.sitename.com.mp4","size":"313719173"}
{"id":"1124","id_torrent":"930","filename":"episode_1\/\u0421\u0435\u0440\u0438\u044f_5.sitename.com.mp4","size":"266063245"}
{"id":"1125","id_torrent":"930","filename":"episode_1\/\u0421\u0435\u0440\u0438\u044f_6.sitename.com.mp4","size":"333489115"}
{"id":"1126","id_torrent":"930","filename":"episode_1\/\u0421\u0435\u0440\u0438\u044f_7.sitename.com.mp4","size":"323085512"}
{"id":"1127","id_torrent":"930","filename":"episode_2\/\u0421\u0435\u0440\u0438\u044f_1.sitename.com.mp4","size":"318209428"}
{"id":"1128","id_torrent":"930","filename":"episode_2\/\u0421\u0435\u0440\u0438\u044f_2.sitename.com.mp4","size":"293116949"}
{"id":"1129","id_torrent":"930","filename":"episode_2\/\u0421\u0435\u0440\u0438\u044f_3.sitename.com.mp4","size":"313956264"}
{"id":"1130","id_torrent":"930","filename":"episode_2\/\u0421\u0435\u0440\u0438\u044f_4.sitename.com.mp4","size":"313719173"}
{"id":"1131","id_torrent":"930","filename":"episode_2\/\u0421\u0435\u0440\u0438\u044f_5.sitename.com.mp4","size":"266063245"}
{"id":"1132","id_torrent":"930","filename":"episode_2\/\u0421\u0435\u0440\u0438\u044f_6.sitename.com.mp4","size":"333489115"}
{"id":"1133","id_torrent":"930","filename":"episode_2\/\u0421\u0435\u0440\u0438\u044f_7.sitename.com.mp4","size":"323085512"}
$dict = bdec_file('public/downloads/torrents/'.$id.'.torrent', (1024 * 1024) );
$dirname = $dict['value']['info']['value']['name']['value'];
$sql = $db->query("SELECT * FROM files WHERE id_torrent = ".$arr['id']." ORDER BY id");
if(!$db->num_rows($sql)) {
err("Ошибка" , "»Извините, но наша система не нашла файлов" , 1);
}
while($row = $db->get_row($sql) ) {
$result = strip_tags(iconv("utf-8" , "windows-1251" , $row['filename']));
$filename = explode("/", $result);
echo "http://mp4.sitename.com/serials/$dirname/$filename[0]/$filename[1]/index.m3u8"
}
но я формирую название и путь файла с торрента
$uppodPl = new stdClass();
$uppodPl->playlist = array();
$currentSeason = "";
while($row = $db->get_row($sql))
{
$result = strip_tags(iconv("utf-8" , "windows-1251" , $row['filename']));
$filename = explode("/", $result);
$currentItem = explode("/", $row["filename"]);
$seasonIndex = explode("_", $currentItem0]);
$seasonIndex = $seasonIndex[1];
$episodeIndex = explode(".", $currentItem[1]);
$episodeIndex = explode("_", $episodeIndex[0]);
$episodeIndex = $episodeIndex[1];
if($currentSeason != $seasonIndex)
{
$currentSeason = $seasonIndex;
$seasonContent = new stdClass();
$seasonContent->comment = "Сезон ".$currentSeason;
$seasonContent->playlist = array();
array_push($uppodPl->playlist, $seasonContent);
}
$episodeContent = new stdClass();
$episodeContent->comment = "Серия ".$episodeIndex;
$episodeContent->file = "http://mp4.sitename.com/serials/$dirname/$filename[0]/$filename[1]/index.m3u8";
array_push($uppodPl->playlist[count($uppodPl->playlist) - 1]->playlist, $episodeContent);
}
echo json_encode($uppodPl);
<div id="player"></div>
<script type="text/javascript">
vars = {
id: 'player',
type: 'video',
swf: 'public/uppod.swf',
style: {w: '700px', h: '400px'},
st5: 'uppodvideo',
st: 'public/skin.txt',
swf: 'public/uppod-hls.swf',
finder: 'flash',
};
new Player(vars);
</script>
<?php
$dict = bdec_file('public/downloads/torrents/'.$id.'.torrent', (1024 * 1024) );
$dirname = $dict['value']['info']['value']['name']['value'];
$sql = $db->query("SELECT * FROM files WHERE id_torrent = ".$arr['id']." ORDER BY id");
if(!$db->num_rows($sql)) {
err("ќшибка" , "»звините , но наша система не нашла файлов" , 1);
}
?>
<script language="JavaScript" src="public/js/player_js/swfobject.js"></script>
<script language="JavaScript" src="public/js/player_js/uppod-0.6.3.js"></script>
<script language="JavaScript" src="public/js/player_js/player.js"></script>
<div id="player"></div>
<script type="text/javascript">
vars = {
id: 'player',
type: 'video',
<?
$uppodPl = new stdClass();
$uppodPl->playlist = array();
$currentSeason = "";
while($row = $db->get_row($sql))
{
$result = strip_tags(iconv("utf-8" , "windows-1251" , $row['filename']));
$filename = explode("/", $result);
$currentItem = explode("/", $row["filename"]);
$seasonIndex = explode("_", $currentItem0]);
$seasonIndex = $seasonIndex[1];
$episodeIndex = explode(".", $currentItem[1]);
$episodeIndex = explode("_", $episodeIndex[0]);
$episodeIndex = $episodeIndex[1];
if($currentSeason != $seasonIndex)
{
$currentSeason = $seasonIndex;
$seasonContent = new stdClass();
$seasonContent->comment = "Сезон ".$currentSeason;
$seasonContent->playlist = array();
array_push($uppodPl->playlist, $seasonContent);
}
$episodeContent = new stdClass();
$episodeContent->comment = "Серия ".$episodeIndex;
$episodeContent->file = "http://mp4.sitename.com/serials/$dirname/$filename[0]/$filename[1]/index.m3u8";
array_push($uppodPl->playlist[count($uppodPl->playlist) - 1]->playlist, $episodeContent);
}
echo json_encode($uppodPl);
?>
swf: 'public/uppod.swf',
style: {w: '700px', h: '400px'},
st5: 'uppodvideo',
st: 'public/skin.txt',
swf: 'public/uppod-hls.swf',
finder: 'flash',
};
new Player(vars);
</script>