-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathemplexer_vod.php
executable file
·196 lines (151 loc) · 7.18 KB
/
emplexer_vod.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?php
/**
*
*/
class EmplexerVod extends AbstractVod
{
private $base_url;
function __construct()
{
// hd_print(__METHOD__);
parent::__construct(false, false, false);
}
public function try_load_movie($movie_id, &$plugin_cookies){
// hd_print(__METHOD__ . ': ' . print_r($plugin_cookies, true)) ;
HD::print_backtrace();
if (!$this->base_url){
$this->base_url = EmplexerConfig::getInstance()->getPlexBaseUrl($plugin_cookies, $this);
}
$url = $this->base_url . $movie_id;
$xml = HD::getAndParseXmlFromUrl($url);
$movie = new Movie($movie_id);
// $movie->set_data("American",'The American','Alone among assassins, Jack is a master craftsman. When a job in Sweden ends more harshly than expected for this American abroad, he vows to his contact Larry that his next assignment will be his last. Jack reports to the Italian countryside, where he holes up in a small town and relishes being away from death for a spell. The assignment, as specified by a Belgian woman, Mathilde, is in the offing as a weapon is constructed. Surprising himself, Jack seeks out the friendship of local priest Father Benedetto and pursues romance with local woman Clara. But by stepping out of the shadows, Jack may be tempting fate.','http://192.168.2.9:32400/library/metadata/4376/thumb/1342928192',1050,'2010','Anton Corbijn','Hiporã',
// "George Clooney \n Jack,Thekla Reuten|Mathilde,Bruce Altman|Larry,Violante Placido|Clara|,Paolo Bonacelli|Father Benedetto",'Crime,Drama,Suspense,Thriller',6.4000000953674299,10,'R','USA','1 real');
$grandparentTitle = (string)$xml->Video->attributes()->grandparentTitle;
$title = $grandparentTitle ? "Episode " . (string)$xml->Video->attributes()->index . ' : ' . (string)$xml->Video->attributes()->title : (string)$xml->Video->attributes()->title;
// (string)$xml->Video->attributes()->summary
$movie->set_data(
$name = $grandparentTitle ,
$name_original = $title ,
$description = (string)$xml->Video->attributes()->summary ,
$poster_url = $this->base_url . '/photo/:/transcode?width='.THUMB_WIDTH. '&height='. THUMB_HEIGHT . '&url=' .$this->base_url . (string)$xml->Video->attributes()->thumb ,
$length_min = ((float)$xml->Video->attributes()->duration) /1000/60 ,
$year = (string)$xml->Video->attributes()->year,
$directors_str = $this->geDirectorStr($xml),
$scenarios_str = null,
$actors_str = $this->getRolesStr($xml),
$genres_str = $this->getGenreStr($xml) ,
$rate_imdb = (float)$xml->Video->attributes()->rating ,
$rate_kinopoisk = null ,
$rate_mpaa = (string)$xml->Video->attributes()->contentRating ,
$country = $this->getCountryStr($xml),
$budget = null
);
$tab = ' ';
$details = array(
'Video' => '_',
$tab . 'Bitrate' => (string)$xml->Video->Media->attributes()->bitrate,
$tab . 'Width' => (string)$xml->Video->Media->attributes()->width,
$tab . 'Height' => (string)$xml->Video->Media->attributes()->height,
$tab . 'Aspect Ratio' => (string)$xml->Video->Media->attributes()->aspectRatio,
$tab . 'Video Resolution' => (string)$xml->Video->Media->attributes()->videoResolution,
$tab . 'Video Frame Rate' => (string)$xml->Video->Media->attributes()->videoFrameRate,
$tab . 'Container' => (string)$xml->Video->Media->attributes()->container,
$tab . 'Codec' => (string)$xml->Video->Media->attributes()->videoCodec
);
$movie->details = $details;
$httpVidelUrl = EmplexerConfig::getInstance()->getPlexBaseUrl($plugin_cookies, $this) . (string)$xml->Video->Media->Part->attributes()->key;
$nfsVideoUrl = 'nfs://' . $plugin_cookies->plexIp . ':' . (string)$xml->Video->Media->Part->attributes()->file;
if ($plugin_cookies->connectionMethod == 'smb'){
$smbVideoUrl = 'smb://' . $plugin_cookies->userName . ':' . $plugin_cookies->password . '@' . $plugin_cookies->plexIp . '/' . (string)$xml->Video->Media->Part->attributes()->file;
$videoUrl[SMB_CONNECTION_TYPE] = $smbVideoUrl;
}
$videoUrl[HTTP_CONNECTION_TYPE] = $httpVidelUrl;
$videoUrl[NFS_CONNECTION_TYPE] = $nfsVideoUrl;
$v = $videoUrl[$plugin_cookies->connectionMethod];
hd_print(__METHOD__ . ":-----------videoUrl = $v-----------");
$movie->add_series_data(1,$movie->name,$v ,true);
// hd_print(__METHOD__ . ':' . print_r($movie, true));
$this->set_cached_movie($movie);
hd_print(print_r($this,true));
}
public function getWriterStr(&$xml)
{
$writes = null;
// hd_print(__METHOD__ . ':' . print_r($xml, true));
foreach ($xml->Video->Writer as $writer) {
$writes .= (string)$writer->attributes()->tag . "\n";
}
return $writes;
}
public function geDirectorStr(&$xml)
{
$director = null;
// hd_print(__METHOD__ . ':' . print_r($xml, true));
foreach ($xml->Video->Director as $director) {
$director .= (string)$director->attributes()->tag . "\n";
}
return $director;
}
public function getRolesStr(&$xml)
{
$roles = null;
foreach ($xml->Video->Role as $role) {
$roles .= (string)$role->attributes()->tag . (!$role->attributes()->role || trim($role->attributes()->role) == "" ?"\n" : ' as ' . (string)$role->attributes()->role . "\n" );
}
return $roles;
}
public function getGenreStr(&$xml)
{
$genres = null;
foreach ($xml->Video->Genre as $genre) {
$genres .= (string)$genre->attributes()->tag . ", ";
}
return $genres;
}
public function getCountryStr(&$xml)
{
$countries = null;
foreach ($xml->Video->Country as $country) {
$countries .= (string)$country->attributes()->tag ;
}
return $countries;
}
public function get_vod_info(MediaURL $media_url, &$plugin_cookies){
HD::print_backtrace();
$movie = $this->get_cached_movie($media_url->movie_id);
hd_print(__METHOD__ . ' teste:' . print_r($movie, true));
$m = HD::getAndParseXmlFromUrl($this->base_url . $media_url->movie_id);
$viewOffset = $m->Video->attributes()->viewOffset? (string)$m->Video->attributes()->viewOffset : 0;
// $params['selected_media_url'] = $toPlay->selected_media_url;
$series_array = array();
$series_array[] = array(
PluginVodSeriesInfo::name => $movie->name_original . "\n" . $movie->name,
PluginVodSeriesInfo::playback_url => $movie->series_list[0]->playback_url,
PluginVodSeriesInfo::playback_url_is_stream_url => true,
);
$toBeReturned = array(
PluginVodInfo::id => 1,
PluginVodInfo::series => $movie->series_list,
PluginVodInfo::name => $movie->name_original,
PluginVodInfo::description => $movie->description,
PluginVodInfo::poster_url => $movie->poster_url,
PluginVodInfo::initial_series_ndx => 0,
PluginVodInfo::buffering_ms => 6000,
PluginVodInfo::initial_position_ms =>$viewOffset,
PluginVodInfo::advert_mode => false,
PluginVodInfo::timer => array(GuiTimerDef::delay_ms => 5000),
/*PluginVodInfo::actions => array(
GUI_EVENT_PLAYBACK_STOP => UserInputHandlerRegistry::create_action($this, 'enter', $params),
)*/
);
// hd_print(__METHOD__ . ':' . print_r($toBeReturned, true));
return $toBeReturned;
}
public function getAldioStreams(&$node, $tabs){
$return = array('AUDIO' => $tabs);
foreach ($node->Video->Media->Part->getChildren() as $key => $value) {
}
}
}
?>