B
B
Bobur Bakhritdinov2016-04-14 12:00:58
PHP
Bobur Bakhritdinov, 2016-04-14 12:00:58

Form playlist for uppod using php?

Hello everyone, I need your help, I need to generate a list of files for the uppod playlist,
here is the script itself:

$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

The essence of the script:
Generates a list of files from a torrent file.
Composition url:
mp4.sitename.com/serials/$dirname/$filename[0]/$filename[1]/index.m3u8
1) mp4.sitename.com/ site address
2) serials — folder where serials are located
3) $ dirname folder name inside serials
4) $filename[0] is a subdirectory inside $dirname - episode_1
5) $filename[1] - file name Series_1.mp4
index.m3u8 can be omitted and so clear
Structure:
Serials folder =>
A_police_officer_with_the_ruble_in_2016_SATRip = >
episode_1 => Episode_1.mp4, Episode_2.mp4, Episode_3.mp4, Episode_4.mp4, Episode_5.mp4, Episode_6.mp4, Episode_7.mp4
episode_2 => Episode_1.mp4, Episode_2.mp4, Episode_3.mp4, Episode_4.mp4, Episode_5.mp4, Episode_6.mp4, Episode_7.mp4
It is necessary to form a playlist and for each episode a separate folder in the uppod playlist The uppod playlist
structure is here
Thank you in advance for your answers .

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question