playlist

о модулях и их работе

Re: playlist

Postby Rostov » 24 Jul 2022, 19:09

Файл m3u больше 60 КБайт не принимает - "413 - Request Entity Too Large"
Можно как то обойти это ограничение?
ASUS O!Play R1 (amp_r12_vrtn)
Rostov
 
Posts: 5
Joined: 24 Jul 2022, 18:54

Re: playlist

Postby Virtual » 25 Jul 2022, 02:33

а гугл не помог?
у вас не просто плеер а полноценный linux сервер.... на борту полноценный PHP и веб сервер LIGHTTPD

править где то там
/usr/local/etc/mos/etc/php.ini
max_file_uploads кажись.... просто добавить букву M
марсы: HDS7 (смотрелка AMP скин vrt )
HDR12 AMP (обычно сервер с RAM 256 и 2 SATA диска 2T+)//но очень иногда оцифровка видео
XTR PRO(AMP, HTTP(S) NFS SMB FTP сервер +trans2.90 + 2 SATA диска 2T+
сатурны: XTR Prodigy, R6S(512Mb_NAND), HD900A(_MD*) прошивка
User avatar
Virtual
 
Posts: 6862
Joined: 01 Oct 2010, 17:17
Location: RU

Re: playlist

Postby Rostov » 25 Jul 2022, 20:59

Не помогло.

Code: Select all
date.timezone = "UTC"

extension_dir = "/usr/local/etc/php5"
upload_tmp_dir = "/tmp"
upload_max_filesize = "8M"
max_file_uploads = "20M"
post_max_size = "1024M"
sendmail_path = "/usr/sbin/sendmail -t -i"

cgi.force_redirect=0
ASUS O!Play R1 (amp_r12_vrtn)
Rostov
 
Posts: 5
Joined: 24 Jul 2022, 18:54

Re: playlist

Postby Virtual » 26 Jul 2022, 07:10

а у вас точно все модули обновлены? в частности php...
Code: Select all
php -v

в консоли, должно быть
PHP 5.6.5
марсы: HDS7 (смотрелка AMP скин vrt )
HDR12 AMP (обычно сервер с RAM 256 и 2 SATA диска 2T+)//но очень иногда оцифровка видео
XTR PRO(AMP, HTTP(S) NFS SMB FTP сервер +trans2.90 + 2 SATA диска 2T+
сатурны: XTR Prodigy, R6S(512Mb_NAND), HD900A(_MD*) прошивка
User avatar
Virtual
 
Posts: 6862
Joined: 01 Oct 2010, 17:17
Location: RU

Re: playlist

Postby Rostov » 26 Jul 2022, 07:33

Code: Select all
AMP12 login: root


BusyBox v1.18.5 (2013-10-10 17:37:45 BDT) built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ # php -v
PHP 5.6.5 (cgi-fcgi) (built: Apr 25 2015 17:53:38)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
~ #
ASUS O!Play R1 (amp_r12_vrtn)
Rostov
 
Posts: 5
Joined: 24 Jul 2022, 18:54

Re: playlist

Postby Virtual » 26 Jul 2022, 08:34

я конечно гляну что там не так.... но 60+к плейлист вам не кажется слишком здоровым?

PS
можно влоб исправить конфиг с плейлистом по ftp
/usr/local/etc/mos/www/modules/playlist/playlist.config.php
там все достаточно просто
марсы: HDS7 (смотрелка AMP скин vrt )
HDR12 AMP (обычно сервер с RAM 256 и 2 SATA диска 2T+)//но очень иногда оцифровка видео
XTR PRO(AMP, HTTP(S) NFS SMB FTP сервер +trans2.90 + 2 SATA диска 2T+
сатурны: XTR Prodigy, R6S(512Mb_NAND), HD900A(_MD*) прошивка
User avatar
Virtual
 
Posts: 6862
Joined: 01 Oct 2010, 17:17
Location: RU

Re: playlist

Postby Rostov » 26 Jul 2022, 12:19

Лист весит 300 Кбайт (много каналов).

/usr/local/etc/mos/www/modules/playlist/playlist.config.php


Code: Select all
<?php
$play_conf = array (
  'showIcons' => true,
);
$play_list = array (
);
?>
ASUS O!Play R1 (amp_r12_vrtn)
Rostov
 
Posts: 5
Joined: 24 Jul 2022, 18:54

Re: playlist

Postby Virtual » 26 Jul 2022, 12:26

уреж его до нескольких и загрузи.....
в playlist.config.php сгенерится массив, далее сам поймеш оную азбуку.
марсы: HDS7 (смотрелка AMP скин vrt )
HDR12 AMP (обычно сервер с RAM 256 и 2 SATA диска 2T+)//но очень иногда оцифровка видео
XTR PRO(AMP, HTTP(S) NFS SMB FTP сервер +trans2.90 + 2 SATA диска 2T+
сатурны: XTR Prodigy, R6S(512Mb_NAND), HD900A(_MD*) прошивка
User avatar
Virtual
 
Posts: 6862
Joined: 01 Oct 2010, 17:17
Location: RU

Re: playlist

Postby Rostov » 26 Jul 2022, 12:55

Не силён я в этом.

| +
Code: Select all
<?php

// load list
$play_list = array();
$play_conf = array(
   'showIcons' => false,
);

if( is_file( dirname( __FILE__ ).'/playlist.config.php' ) )
{
   include( dirname( __FILE__ ).'/playlist.config.php' );
}

// current item
$cName = 'new';
$cLink = '';
$cPos  = 0;
//
// ------------------------------------
function playlistGetConfig( $name )
{
global $play_conf;

   if( isset( $play_conf[ $name ] )) return $play_conf[ $name ];
   return null;
}
//
// ------------------------------------
function playlistSaveConfig()
{
global $play_list;
global $play_conf;

   // save config
   file_put_contents( dirname( __FILE__ ).'/playlist.config.php', '<?php
$play_conf = '.var_export( $play_conf, true ).';
$play_list = '.var_export( $play_list, true ).';
?>' );

}
//
// ====================================
function playlist_get_content()
{
global $play_list;

   header( "Content-type: text/plain; charset=utf-8" );

   // generate list
   $s = '';

   // top title
   $s .= getMsg('playlistTitle') ."\n";

   // number of items
   $s .= count( $play_list ) ."\n";

   // items
   foreach( $play_list as $item )
   {
      $s .= $item['name'] ."\n";
      $s .= $item['link'] ."\n";

      $img =  urlencode( str_replace( '+', '|', $item['name'] ));
      $s .= "http://www.moservices.org/modules/tvlogo/$img.png\n";
   }

   // put data
   if( isset( $_REQUEST['debug']))
   {
      echo $s;
   }
   else
   {
      file_put_contents( '/tmp/put.dat', $s );
      echo "/tmp/put.dat";
   }
}
//
// ====================================
function playlist_tools_head()
{

?>
<link rel="stylesheet" href="/modules/core/css/buttons.css" type="text/css" media="screen" charset="utf-8">
<link rel="stylesheet" href="/modules/core/css/sets.css" type="text/css" media="screen" charset="utf-8">
<style type="text/css">

.form-text
{
   width:100%;
}
</style>
<?php

}
//
// ------------------------------------
function playlist_tools_body()
{

   $lists = array();
   $s = file_get_contents( 'http://borpas.info/iptv/list' );
   if( $s !== false )
   {
      $s = preg_replace( '|<.*?>|s', '', $s );

      $s = iconv('windows-1251', 'utf-8', $s);
      file_put_contents('/tmp/list', $s );
      $l = array();
      $l = parse_ini_file('/tmp/list', false );
//      unlink('/tmp/list');

      if( isset( $l['Count'] ))
      {
         $n = $l['Count'];
         for ($i = 1; $i <= $n; $i++)
         {
            if( ! isset( $l[ $i .'name' ] )) continue;
            $name = $l[ $i .'name' ];
            $link = '';
            if( isset( $l[ $i .'um3u' ] )) $link = $l[ $i .'um3u' ];
            elseif( isset( $l[ $i .'uini' ] )) $link = $l[ $i .'uini' ];
            if( $link == '' ) continue;

            $lists[ $name ] = $link;
         }
         ksort( $lists );
      }
   }

?>
<div id="container">
<h3><?= getMsg( 'playlistTools' ) ?></h3>
<div class="set_card">
<table class="set_list" border="0" cellspacing="0" cellpadding="8">

<form action="?page=playlist&act=import" method="post" enctype="multipart/form-data">
<tr><td colspan="2"><?= getMsg( 'playlistImport') ?></td></tr>
<tr align="center"><td colspan="2"><input type="file" name="impfile"></td></tr>
<tr align="center"><td colspan="2">
<button class="buttons" type="submit"><?= getMsg( 'coreCmLoad') ?></button>
</td></tr></form>

<tr><td class="set_delim" colspan="2"><?= getMsg( 'playlistExport') ?></td></tr>
<tr><td colspan="2">
<a class="buttons" href="?page=playlist_export"><?= getMsg( 'coreCmSave') ?></a>
</td></tr>

<tr><td class="set_delim" colspan="2"><?= getMsg('playlistGetTitle') ?></td></tr>
<form action="?page=playlist&act=get" method="post">
<tr><td><?= getMsg('playlistProvider') ?></td>
<td><select class="form-text" name="url" size=1>
<?php

   if( count( $lists ) > 0 )
    foreach( $lists as $name => $link )
     echo "<option value=\"$link\">$name</option>\n";

?>
</select></td></tr>
<tr><td colspan="2" align="right">
<button class="buttons" type="submit"><?= getMsg( 'coreCmLoad') ?></button>
</td></tr></form>

<form action="?page=playlist&act=udpxy" method="post">
<tr><td class="set_delim" colspan="2"><?= getMsg( 'playlistUdpxy') ?></td></tr>
<tr><td><?= getMsg('playlistUdpxyAddr') ?></td>
<td><input class="form-text" name="xurl" type="text" value="http://127.0.0.1:8080" />
</td></tr>
<tr><td colspan="2" align="right">
<button class="buttons" type="submit"><?= getMsg( 'playlistCm_convert') ?></button>
</td></tr></form>

<form action="?page=playlist&act=set" method="post">
<tr><td class="set_delim" align="center"><?php

   $sel = '';
   if( playlistGetConfig('showIcons') ) $sel = ' checked';

?>
<input name="showicons" type="checkbox"<?= $sel ?> />
</td><td class="set_delim"><?= getMsg( 'playlistShowIcons') ?></td></tr>
<tr><td /><td align="right">
<button class="buttons" type="submit"><?= getMsg( 'coreCmSave') ?></button>
</td></tr></form>

</table>
</div>
</div>

<?php
}
//
// ====================================
function playlist_export_content()
{
//#EXTM3U url-tvg="http://mozhay.tv/jtv.zip"  m3uautoload=1 cache=500 deinterlace=1 tvg-shift=0
//#EXTINF:0 tvg-name="Первый_канал" group-title="Основные",Первый канал
//http://001.mozhay.tv

global $play_list;

   $s = '#EXTM3U'.PHP_EOL;
   foreach( $play_list as $id => $item )
   {
      $s .= '#EXTINF:'. $id .','. $item['name'] .PHP_EOL;
      $s .= $item['link'] .PHP_EOL;
   }
   // send file
   header( 'Content-type: application/octet-stream' );
   header( 'Content-Lenght: '. strlen( $s ) );
   header( 'Content-Disposition: attachment; filename="playlist.m3u"' );
   echo( $s );
}
//
// ====================================
function isUTF8( &$s )
{
   // check BOM
   if( substr( $s, 0, 3) == "\xEF\xBB\xBF" )
   {
      $s = substr( $s, 3 );
      return true;
   }
   // check russian multibyte
   if( preg_match_all( '/(((\xd0[\x90-\xbf])|(\xd1[\x80-\x91]))+)/', $s, $ss ) > 0 )
    foreach( $ss[0] as $a )
     if( strlen( $a ) > 4 ) return true;

   return false;
}
//
// ------------------------------------
function playlistGetList( $source, $codepage = 'UTF-8' )
{
global $play_list;

   $s = file_get_contents( $source );
   $s = str_replace( "\r", '', $s );      // remove windows EOL

   if( ! isUTF8( $s ) ) $s = iconv('windows-1251', 'utf-8', $s);

   $ss = explode( "\n", $s );

   $items = array();

   if( strpos(  $s, '#EXTM3U' ) === false )
   {
      // ini file

      foreach( $ss as $s )
      {
         if(( $s = trim( $s )) == '') continue;
         if( substr( $s, 0, 1 ) == '?' )continue;
         $a = explode( '|', $s );
         $items[] = array(
            'name'=> isset( $a[19] ) ? $a[19] : $a[15],
            'link'=> $a[0],
         );
      }
   }
   else
   {
      // m3u file

      $name = '';
      foreach( $ss as $s )
      {
         if(( $s = trim( $s )) == '') continue;
         if( substr( $s, 0, 1 ) == '#' )
         {
            if( preg_match( '/#EXTINF(.*?\,)?([\s\-]*)?(.*)/', $s, $a ) > 0 ) $name = $a[3];
         }
         else
         {
            $items[] = array(
               'name'=> $name,
               'link'=> $s,
            );
            $name = '';
         }
      }
   }
   if( count( $items ) > 0 )
   {
      $play_list = $items;
      playlistSaveConfig();
   }
}
//
// ------------------------------------
function playlist_actions( $act, $log )
{
global $mos;
global $play_list;
global $play_conf;

global $cName;
global $cLink;
global $cPos;

   $change = false;

   if( $act == 'get' )
   {
      if( ! isset( $_REQUEST['url'] )) return;

      playlistGetList( $_REQUEST['url'] );
   }
   elseif( $act == 'import' )
   {
      if( ! isset( $_FILES['impfile']['tmp_name'] )) return;

      playlistGetList( $_FILES['impfile']['tmp_name'] );
   }
   elseif( $act == 'clear' )
   {
      $play_list = array();
      playlistSaveConfig();
   }
   elseif( $act == 'udpxy' )
   {
      if( ! isset( $_REQUEST['xurl'] )) return;

      $xurl = $_REQUEST['xurl'];

      foreach( $play_list as $id => $item )
      {
         $link = preg_replace('#^(udp|rtp)\:\/\/\@(.+)$#', $xurl.'/\1/\2', $item['link'] );
         $play_list[ $id ]['link'] = $link;
      }

      playlistSaveConfig();
   }
   elseif( $act == 'set' )
   {
      if( isset( $_REQUEST['showicons'] )) $play_conf['showIcons'] = true;
      else $play_conf['showIcons'] = false;

      playlistSaveConfig();
   }

   elseif( $act == 'new' )
   {
      $cPos = count( $play_list );

      $play_list[ $cPos ] = array(
         'name'=> 'new',
         'link'=> '',
      );

      $_REQUEST['act'] = 'edit';
   }
   elseif( $act == 'add' )
   {
      if( isset( $_REQUEST['name'] )) $cName = stripslashes( $_REQUEST['name'] );
      if( isset( $_REQUEST['link'] )) $cLink = stripslashes( $_REQUEST['link'] );
      if( isset( $_REQUEST['pos' ] )) $cPos  = $_REQUEST['pos'];

      if( $cPos == 'cancel' ) return;
      if( $cPos == 'add' ) $cPos = count( $play_list );

      $play_list[ $cPos ] = array(
         'name'=> $cName,
         'link'=> $cLink,
      );
      playlistSaveConfig();
   }
   elseif( isset( $_REQUEST['id'] ))
   {
      $id = $_REQUEST['id'];
      if( ! array_key_exists( $id, $play_list )) return;

      $cName = $play_list[ $id ]['name'];
      $cLink = $play_list[ $id ]['link'];
      $cPos = $id;

      if( $act == 'up' )
      {
         if( ! array_key_exists( $id - 1, $play_list )) return;

         $item = $play_list[ $id ];
         $play_list[ $id ] = $play_list[ $id - 1 ];
         $play_list[ $id -1 ] = $item;
         $play_list = array_values( $play_list );
         playlistSaveConfig();
      }
      if( $act == 'down' )
      {
         if( ! array_key_exists( $id + 1, $play_list )) return;

         $item = $play_list[ $id ];
         $play_list[ $id ] = $play_list[ $id + 1 ];
         $play_list[ $id + 1 ] = $item;
         $play_list = array_values( $play_list );
         playlistSaveConfig();
      }
      if( $act == 'delete' )
      {
         unset( $play_list[ $id ] );
         $play_list = array_values( $play_list );
         playlistSaveConfig();
      }
   }
}

// ------------------------------------
function playlist_head()
{

?>
<link rel="stylesheet" href="/modules/core/css/services.css" type="text/css" media="screen" charset="utf-8">
<link rel="stylesheet" href="/modules/core/css/toolbar.css" type="text/css" media="screen" charset="utf-8">
<link rel="stylesheet" href="/modules/core/css/buttons.css" type="text/css" media="screen" charset="utf-8">
<link rel="stylesheet" href="/modules/core/css/sets.css" type="text/css" media="screen" charset="utf-8">
<style type="text/css">

.form-text
{
   width:100%;
}
td.form-first
{
   border: 0px;
   margin-bottom: 0px;
   padding-bottom: 2px;
}
td.form-second
{
   margin-top: 0px;
   padding-top: 0px;
}
button.left
{
   float:left;
}
div.add
{
   position:relative;
   display:block;
   float:left;

   padding: 4px 8px 6px;
   margin: 0px 2px;

   background-color:white;

   border:1px solid #ccc;
   border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px;
}
</style>
<?php

}

// ------------------------------------
function playlist_body()
{
global $mos;
global $play_list;

global $cName;
global $cLink;
global $cPos;

?>
<div id="container">
<table class="ssk_top" border="0" cellspacing="0" cellpadding="0">
<tr><td><h3><?= getMsg('playlistTitle') ?></h3></td>
<td width="20">&nbsp;</td>
<td>
<div class="mod_toolbar">

<a class="mod_button" href="?page=playlist&act=clear" title="<?= getMsg('playlistCm_clear') ?>">
<img src="modules/core/images/btn_cancel.png" /></a>

<a class="mod_button" href="?page=playlist_tools" title="<?= getMsg('playlistToolsTitle') ?>">
<img src="/modules/core/images/btn_settings.png" /></a>
</div></td>
</tr></table>
<?php
   if( count( $play_list ) > 0 )
   {

?>
<table class="mod_listview" width="100%" border="0" cellspacing="0" cellpadding="8">
<thead><tr>
<?php
   if( playlistGetConfig('showIcons') )
   {

?>
<td/>
<?php
   }

?>
<td><?= getMsg( 'playlistThName') ?></td>
<td width="100%"><?= getMsg( 'playlistThLink') ?></td>
</tr></thead>
<?php
      $last = count( $play_list) - 1;

      foreach( $play_list as $id => $item )
      {
         $img =  urlencode( str_replace( '+', '|', $item['name'] ));
         if( isset( $_REQUEST['act'] )
         && $_REQUEST['act'] == 'edit'
         && $id == $cPos )
         {

?>
<tr>
<?php
         if( playlistGetConfig('showIcons') )
         {
?>
<td rowspan="2"><image width="45" src="http://www.moservices.org/modules/tvlogo/<?= $img ?>.png" /></td>
<?php
         }
?>
<form action="?page=playlist&act=add" method="post">
<td class="form-first" width="30%"><div class="form-item"><input class="form-text" name="name" type="text" value="<?= $cName ?>" /></div></td>
<td class="form-first" width="70%"><input class="form-text" name="link" type="text" value="<?= $cLink ?>" /></td>
</tr>
<?php
            echo '<tr';
            if( $id == $last ) echo ' class=" mod_list_last"';
            echo '>';

?>
<td class="form-second" colspan="2">
<button class="buttons left" type="submit" name="pos" value="<?= $cPos ?>"><?= getMsg( 'coreCmSave') ?></button>
<button class="buttons left" type="submit" name="pos" value="cancel"><?= getMsg( 'coreCmCancel') ?></button>
</td>
</form>
<?php
         }
         else
         {
            $acts = array();
            if( $id != 0 ) $acts[]='up';
            if( $id != $last ) $acts[]='down';
            $acts[]='edit';
            $acts[]='delete';

            $menu = array();
            $menu[$id] = array (
               'type'   => 'node',
               'title'   => $item['name'],
               'items'   => array()
            );
            foreach( $acts as $act )
            {
               if( $act == 'edit' ) $cls = 'top_delim';
               else $cls = '';

               $menu[$id]['items'][ $act ] = array (
                  'type'   => 'item',
                  'class'   => $cls,
                  'title' => getMsg( 'playlistCm_'.$act ),
                  'url'   => "/?page=playlist&act=$act&id=$id"
               );
            }
            echo '<tr';
            if( $id == $last ) echo ' class=" mod_list_last"';
            echo '>';

?>
<?php
            if( playlistGetConfig('showIcons') )
            {

?>
<td><image width="45" src="http://www.moservices.org/modules/tvlogo/<?= $img ?>.png" /></td>
<?php
            }

?>
<td width="30%">
<?php
            drawRootMenu( $menu );

?></td>
<td width="70%"><?= $item['link'] ?></td>
<?php
         }
?>
</tr>
<?php
      }
?>
</table>
<?php
   }

?>
<a href="?page=playlist&act=new" title="<?= getMsg( 'playlistCm_add') ?>"><div class="add">+</div></a>
</div>
<?php

}

?>
ASUS O!Play R1 (amp_r12_vrtn)
Rostov
 
Posts: 5
Joined: 24 Jul 2022, 18:54

Re: playlist

Postby Virtual » 27 Jul 2022, 06:06

это не тот файл! :D
тебе нужно именно playlist.config.php
| +
Code: Select all
<?php
$play_conf = array (
  'showIcons' => false,
  );
  $play_list = array (
    0 =>
      array (
      'name' => 'первая ссылка',
      'link' => 'http://127.0.0.1/?page=youtube_get&id=jqF6LYh6y2U',
        ),
    1 =>
        array (
        'name' => 'вторая ссылка',
        'link' => 'http://127.0.0.1/?page=youtube_get&id=AnspNCN3f2g',
      ),
 );
?>

playlist.config.zip
(430 Bytes) Downloaded 60 times

PS пореж свой плейлист на меньшие куски и загрузи.... в playlist.config.php будет результат..... далее уж по аналогии массив добавиш.
марсы: HDS7 (смотрелка AMP скин vrt )
HDR12 AMP (обычно сервер с RAM 256 и 2 SATA диска 2T+)//но очень иногда оцифровка видео
XTR PRO(AMP, HTTP(S) NFS SMB FTP сервер +trans2.90 + 2 SATA диска 2T+
сатурны: XTR Prodigy, R6S(512Mb_NAND), HD900A(_MD*) прошивка
User avatar
Virtual
 
Posts: 6862
Joined: 01 Oct 2010, 17:17
Location: RU

Previous

Return to Модули

Who is online

Users browsing this forum: No registered users and 11 guests