-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlaylistTracker.php
53 lines (35 loc) · 1.13 KB
/
PlaylistTracker.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
require_once './vendor/autoload.php';
include_once('./lib/simple_html_dom.php');
$config = json_decode(file_get_contents('./userdata/config.json'));
//Create data folder
if(!file_exists('./data')) {
mkdir('./data', 0700, true);
}
if(count($argv) <= 1) {
echo "Args:"."\n";
echo "update - update all the playlist defined in config.yml"."\n";
die();
}
if($argv[1] == "update") {
$Youtube_Playlist = $config->Youtube->Tracking->Playlist;
if(count($Youtube_Playlist) > 0) {
include_once('./app/platform/youtube/Youtube.php');
$Platform = new Youtube($config->Debug, $config->Youtube->Youtube_v3_api_key);
foreach($Youtube_Playlist as $i) {
$Platform->trackPlaylist($i);
}
}
}
if($argv[1] == "info") {
$platformStr = $argv[2];
if($platformStr == "youtube") {
include_once('./app/platform/youtube/Youtube.php');
$Platform = new Youtube($config->Debug, $config->Youtube->Youtube_v3_api_key);
if($argv[3] == "video") {
$video = $Platform->infoVideo($argv[4]);
var_dump($video);
}
}
}
?>