forked from newloran2/emplexer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
emplexer_list_video.php
100 lines (81 loc) · 2.77 KB
/
emplexer_list_video.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
/**
*
*/
class EmplexerListVideo extends EmplexerBaseChannel
{
const ID ='emplexer_list_video';
function __construct()
{
hd_print(__METHOD__);
parent::__construct(self::ID);
}
public function get_folder_views()
{
hd_print(__METHOD__);
return EmplexerConfig::getInstance()->GET_SECTIONS_LIST_VIEW();
}
public static function get_media_url_str($key, $type=TYPE_DIRECTORY,$videoMediaArray=null)
{
hd_print(__METHOD__);
return MediaURL::encode(
array
(
'screen_id' => self::ID,
'key' => $key,
'type' => $type,
'video_media_array' => $videoMediaArray
)
);
}
public function getThumbURL(SimpleXMLElement &$node)
{
$thumb = (string)$node->attributes()->thumb;
$thumb = $this->base_url . '/photo/:/transcode?width='.THUMB_WIDTH. '&height='. THUMB_HEIGHT . '&url=' . urlencode($this->base_url . $thumb);
hd_print(__METHOD__ . ':' . $thumb);
if ($node->attributes()->thumb && $node->attributes()->ratingKey){
$cacheKey = (string)$node->attributes()->ratingKey. '.jpg';
EmplexerArchive::getInstance()->setFileToArchive($cacheKey, $thumb );
return EmplexerArchive::getInstance()->getFileFromArchive($cacheKey, $thumb);
}
return $thumb;
}
public function getVideoUrl(SimpleXMLElement &$node, &$plugin_cookies)
{
// hd_print(__METHOD__);
$httpVidelUrl = $this->base_url . (string)$node->Part->attributes()->key;
$nfsVideoUrl = 'nfs://' . $plugin_cookies->plexIp . ':' . (string)$node->Part->attributes()->file;
if ($plugin_cookies->connectionMethod == 'smb'){
$smbVideoUrl = 'smb://' . $plugin_cookies->userName . ':' . $plugin_cookies->password . '@' . $plugin_cookies->plexIp . '/' . (string)$node->Media->Part->attributes()->file;
$videoUrl[SMB_CONNECTION_TYPE] = $smbVideoUrl;
}
$videoUrl[HTTP_CONNECTION_TYPE] = $httpVidelUrl;
$videoUrl[NFS_CONNECTION_TYPE] = $nfsVideoUrl;
$v=null;
if ($node->Part->attributes()->file && $node->Part->attributes()->file != ""){
$v = $videoUrl[$plugin_cookies->connectionMethod];
} else {
$v= $httpVidelUrl;
}
if (!$v){
hd_print('connectionMethod not setted use http as default');
$v = $httpVidelUrl;
}
hd_print(__METHOD__ . ":-----------videoUrl = $v-----------");
return $v;
}
public function getNextScreen($parameters){
$key = $parameters['key'];
$type = $parameters['type'];
$params = $parameters['params'];
$art = $params['art'];
$a = EmplexerConfig::getInstance()->GET_SECTIONS_LIST_VIEW();
$this->folder_views = $a ;
return $this->get_media_url_str($key, $type, $params);
}
public function doParseOnDirectories(&$xml, &$media_url, &$plugin_cookies){
$items = parent::doParseOnDirectories($xml, $media_url, $plugin_cookies);
return $items;
}
}
?>