Skip to content

Commit 0b20395

Browse files
authored
Merge pull request #27 from elan-ev/issue-25
Accurate Capture Agent from SOP
2 parents 6972957 + 8dcfe54 commit 0b20395

22 files changed

Lines changed: 560 additions & 310 deletions

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
node_modules
22
.vscode
33
assets
4-
*.zip
4+
*.zip
5+
.DS_Store
6+
.gitignore

LiveStreaming.php

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* published by the Free Software Foundation; either version 2 of
1111
* the License, or (at your option) any later version.
1212
*/
13-
require_once __DIR__ . '/lib/locallib.inc.php';
1413

1514
class LiveStreaming extends StudIPPlugin implements StandardPlugin, SystemPlugin
1615
{
@@ -27,7 +26,8 @@ public function __construct()
2726
bind_textdomain_codeset(static::GETTEXT_DOMAIN, 'UTF-8');
2827

2928
StudipAutoloader::addClassLookups([
30-
'LiveStream' => __DIR__ . '/lib/LiveStream.php',
29+
'LiveStream' => __DIR__ . '/lib/Models/LiveStream.php',
30+
'LiveStreamLib' => __DIR__ . '/lib/LiveStreamLib.php',
3131
]);
3232

3333
if ($perm->have_perm('admin')) {
@@ -133,9 +133,10 @@ public function perform($unconsumed_path)
133133
$blubber = new Blubber();
134134
$blubber->addStylesheet('assets/stylesheets/blubber.less');
135135
}
136-
137-
PageLayout::addStylesheet($this->getPluginURL() . '/assets/css/livestream.css');
138-
PageLayout::addScript($this->getPluginURL() . '/assets/javascripts/livestream.js');
136+
137+
$plugin_version = $this->getLiveStreamingVersion();
138+
PageLayout::addStylesheet($this->getPluginURL() . '/assets/css/livestream.css?v=' . $plugin_version);
139+
PageLayout::addScript($this->getPluginURL() . '/assets/javascripts/livestream.js?v=' . $plugin_version);
139140

140141
parent::perform($unconsumed_path);
141142
}
@@ -230,4 +231,20 @@ function checkOpenCast($cid = null) {
230231
}
231232
return false;
232233
}
234+
235+
/**
236+
* Get the Plugin Version
237+
*
238+
* get the plugin manifest from PluginManager getPluginManifest method
239+
*
240+
* @return string plugin version
241+
*/
242+
public function getLiveStreamingVersion()
243+
{
244+
$plugin_manager = \PluginManager::getInstance();
245+
$this_plugin = $plugin_manager->getPluginInfo(__CLASS__);
246+
$plugin_path = \get_config('PLUGINS_PATH') . '/' .$this_plugin['path'];
247+
$manifest = $plugin_manager->getPluginManifest($plugin_path);
248+
return $manifest['version'];
249+
}
233250
}

assets/css/videoplayer.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/javascripts/livestream.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/javascripts/videoplayer.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controllers/admin.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ public function admin_action()
5353
$this->oc_player_url = $livestream_config['oc_player_url'];
5454
$this->opencast_installed = $this->plugin->checkOpenCast();
5555

56-
$this->url_placeholder = URLPLACEHOLDER;
56+
$this->url_placeholder = LiveStreamLib::URLPLACEHOLDER;
5757

5858
}
5959

60-
/**
60+
/**
6161
* Inserts new player data or updates old data (streaming url, username, password)
6262
*/
6363
public function admin_change_playerdata_action()
@@ -108,8 +108,8 @@ public function admin_change_playerdata_action()
108108
//Clear all course in order to avoid conflict
109109
$livestreams = LiveStream::findAll();
110110
foreach ($livestreams as $livestream) {
111-
if ($livestream->mode == MODE_OPENCAST) {
112-
$livestream->mode = MODE_DEFAULT;
111+
if ($livestream->mode == LiveStreamLib::MODE_OPENCAST) {
112+
$livestream->mode = LiveStreamLib::MODE_DEFAULT;
113113
$livestream->store();
114114
}
115115
}
@@ -123,7 +123,7 @@ public function admin_change_playerdata_action()
123123

124124
private function checkUrl($url) {
125125
$res = true;
126-
if (!filter_var($url, FILTER_VALIDATE_URL) || strpos($url, URLPLACEHOLDER) === FALSE) {
126+
if (!filter_var($url, FILTER_VALIDATE_URL) || strpos($url, LiveStreamLib::URLPLACEHOLDER) === FALSE) {
127127
$res = false;
128128
}
129129
return $res;

0 commit comments

Comments
 (0)