Esempio n. 1
0
 public function import()
 {
     $arVideos = array();
     $videoIds = array();
     $file = $_SERVER["DOCUMENT_ROOT"] . self::$file;
     \CDev::deleteOldFiles($_SERVER["DOCUMENT_ROOT"] . self::$img_dir, 0);
     $page = 1;
     $nextPageToken = false;
     while ($page < 100) {
         $params = array("filters" => "ugc", "items_count" => 10);
         if ($nextPageToken) {
             $params["from"] = $nextPageToken;
         }
         $response = self::api('video.getCatalog', $params);
         $items = $response["response"]["items"][0]["items"];
         foreach ($items as $videoResult) {
             $id = $videoResult["owner_id"] . "_" . $videoResult["id"];
             if (in_array($id, $videoIds) || $videoResult["type"] != "video") {
                 continue;
             }
             $videoIds[] = $id;
         }
         $nextPageToken = $response["response"]["next"];
         //echo $nextPageToken."\r\n";
         $page++;
     }
     //Склеенный запрос не работает(! слишком много ид !)
     foreach ($videoIds as $video) {
         $params = array("videos" => $video, "count" => 1, "offset" => 0);
         $response = self::api('video.get', $params);
         $videoResult = $response["response"]["items"][0];
         if (empty($videoResult["id"])) {
             continue;
         }
         if (!empty($videoResult["photo_640"])) {
             $img = $videoResult['photo_640'];
         } else {
             $img = $videoResult['photo_320'];
         }
         $crop = self::resizePic($videoResult["id"], $img);
         $arVideo = array("NAME" => $videoResult['title'], "IMG" => $crop, "PLAYER_BG" => $img, "ID" => $videoResult["id"], "VIDEO_URL" => $videoResult["player"], "DESC" => $videoResult['description']);
         $ids[] = $videoResult["id"];
         $arVideos[] = $arVideo;
     }
     file_put_contents($file, json_encode($arVideos));
 }
Esempio n. 2
0
 public static function deletePics()
 {
     \CDev::deleteOldFiles($_SERVER["DOCUMENT_ROOT"] . self::$img_dir, 0);
 }
Esempio n. 3
0
 public static function deletePics()
 {
     \CDev::deleteOldFiles($_SERVER["DOCUMENT_ROOT"] . "/upload/social_channel/youtube/", 0);
     \CDev::deleteOldFiles($_SERVER["DOCUMENT_ROOT"] . "/upload/social_channel/vk/", 0);
     \CDev::deleteOldFiles($_SERVER["DOCUMENT_ROOT"] . "/upload/social_channel/rutube/", 0);
 }
Esempio n. 4
0
 /**
  * Clear tables & deleting images
  */
 public static function clear()
 {
     ProgTable::deleteAll();
     ScheduleTable::deleteAll();
     //ChannelTable::deleteAll();
     ImageTable::deleteAll();
     \CDev::deleteOldFiles($_SERVER["DOCUMENT_ROOT"] . self::$cut_dir, 0);
     \CDev::deleteOldFiles($_SERVER["DOCUMENT_ROOT"] . self::$origin_dir, 0);
 }
Esempio n. 5
0
<?php

$DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"] = realpath(dirname(__FILE__) . '/../');
define("NO_KEEP_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS", true);
set_time_limit(0);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
header('Content-Type: text/html; charset=utf-8');
ini_set('mbstring.func_overload', '2');
ini_set('mbstring.internal_encoding', 'UTF-8');
echo date("H:i:s") . "\r\n";
//Удаляем старые файлы лога
$path = $_SERVER['DOCUMENT_ROOT'] . '/logs/sotal/';
\CDev::deleteOldFiles($path, 86400);
//Загружаем и импортируем данные из EPG
$epg = new \Hawkart\Megatv\CEpg();
$epg->importChannels();
//!!!
$epg->importChannelCity();
$epg->import();
\CDev::deleteDirectory($_SERVER['DOCUMENT_ROOT'] . '/bitrix/cache', 0);
mail("*****@*****.**", "epg import success", "success");
echo date("H:i:s") . "\r\n";
echo " --finish loading--";
die;