B
B
Bobur Bakhritdinov2015-11-29 18:52:38
PHP
Bobur Bakhritdinov, 2015-11-29 18:52:38

Solving a problem with a php script?

Hello everyone, there is an online player that shows the video from the site via cdn.
Here's how the player works!

<?
if($arr['infohash']){
$dict = bdec_file('public/downloads/torrents/'.$id.'.torrent', (1024 * 1024) );

$v="http://urlsite/Movies/".$dict['value']['info']['value']['name']['value'];	
?>

<div id="player"></div>
  <script>
    var player = new Clappr.Player({source: "<?=$v;?>", parentId: "#player"});
  </script>
<?
}
?>

All videos are stored inside the (Movies) folder, torrent files are also created from there. you can see from the code that it generates the file name from info_hash, since they are identical. The full path to the Movies folder is /var/www/mp4.urlsite/Movies/
Task:
I have about 400 video files there, but in the future there will be more of course, I want to sort the files for example:
/Movies/2015/december/
/Movies /2015/january
Well, the code cannot automatically find the file that is inside /2015/december/ and play it in the player.
But the full path is stored inside info_hash (how to form the path from the beginning of /Movies to the file from the torrent) If something is not clear, I will try to explain it better. This is my own project and I'm not a student :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2015-11-29
@xmoonlight

tabular. (csv file or database)

Remember : any request not to a final object is ALWAYS a filter of leaf ("leaf") elements!
The script should take a URL and filter the final list of elements by its parameters.
In this case, fetching from a table by date, using the year and month from the URL.
Those. the general format is: /video/I/need/here/this/ or /video/for year X/for month Y/ or /video/how to make a perpetual motion machine/top10/ or /video/random/
I hope the principle is clear.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question