<component name="ChangeListManager">
<list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/config/remote.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/remote.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/lib/harmony.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/harmony.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/lib/http.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/http.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/lib/remoteinfos.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/remoteinfos.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/lib/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/lib/shield.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/shield.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/shield.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/shield.php" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="Make" enabled="true" />
</method>
</configuration>
+ <configuration default="true" type="ArquillianJUnit" factoryName="" nameIsGenerated="true">
+ <option name="arquillianRunConfiguration">
+ <value>
+ <option name="containerStateName" value="" />
+ </value>
+ </option>
+ <option name="TEST_OBJECT" value="class" />
+ <method v="2">
+ <option name="Make" enabled="true" />
+ </method>
+ </configuration>
<configuration default="true" type="ArquillianTestNG" factoryName="">
<option name="arquillianRunConfiguration">
<value>
<workItem from="1605261347643" duration="1199000" />
<workItem from="1605342171398" duration="4613000" />
<workItem from="1605355486465" duration="23396000" />
- </task>
- <task id="LOCAL-00353" summary=".">
- <created>1603626112636</created>
- <option name="number" value="00353" />
- <option name="presentableId" value="LOCAL-00353" />
- <option name="project" value="LOCAL" />
- <updated>1603626112636</updated>
+ <workItem from="1605531884401" duration="829000" />
+ <workItem from="1605542056704" duration="1640000" />
+ <workItem from="1605597648537" duration="6714000" />
</task>
<task id="LOCAL-00354" summary=".">
<created>1603643895376</created>
<option name="project" value="LOCAL" />
<updated>1605517718088</updated>
</task>
- <option name="localTasksCounter" value="402" />
+ <task id="LOCAL-00402" summary=".">
+ <created>1605532129605</created>
+ <option name="number" value="00402" />
+ <option name="presentableId" value="LOCAL-00402" />
+ <option name="project" value="LOCAL" />
+ <updated>1605532129605</updated>
+ </task>
+ <option name="localTasksCounter" value="403" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
</state>
<state x="740" y="229" key="#com.jetbrains.php.refactoring.extractMethod.PhpExtractMethodDialog#function0/0.0.1707.920@0.0.1707.920" timestamp="1604146905948" />
<state x="1110" y="259" key="#com.jetbrains.php.refactoring.extractMethod.PhpExtractMethodDialog#function0/0.0.2560.1040@0.0.2560.1040" timestamp="1605437484620" />
- <state x="198" y="0" width="737" height="502" key="CommitChangelistDialog2" timestamp="1605517703034">
+ <state x="198" y="0" width="737" height="502" key="CommitChangelistDialog2" timestamp="1605532120874">
<screen x="0" y="0" width="2560" height="1040" />
</state>
<state x="132" y="0" width="737" height="502" key="CommitChangelistDialog2/0.0.1707.920@0.0.1707.920" timestamp="1605086955514" />
<state x="701" y="75" key="CommitChangelistDialog2/0.0.1920.1160@0.0.1920.1160" timestamp="1605188136787" />
- <state x="198" y="0" width="745" height="567" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1605517703034" />
+ <state x="198" y="0" width="745" height="567" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1605532120874" />
<state x="952" y="244" key="FileChooserDialogImpl" timestamp="1605104496549">
<screen x="0" y="0" width="2560" height="1040" />
</state>
<screen x="0" y="0" width="2560" height="1040" />
</state>
<state x="295" y="0" width="1290" height="907" key="dock-window-1/0.0.2560.1040@0.0.2560.1040" timestamp="1603274697406" />
- <state x="977" y="257" width="607" height="536" key="find.popup" timestamp="1605437373935">
+ <state x="977" y="257" width="607" height="536" key="find.popup" timestamp="1605598576899">
<screen x="0" y="0" width="2560" height="1040" />
</state>
<state x="651" y="227" width="550" height="534" key="find.popup/0.0.1707.920@0.0.1707.920" timestamp="1604301949692" />
- <state x="977" y="257" width="607" height="536" key="find.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1605437373935" />
+ <state x="977" y="257" width="607" height="536" key="find.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1605598576899" />
<state x="1056" y="292" key="refactoring.ChangeSignatureDialog" timestamp="1604518096294">
<screen x="0" y="0" width="2560" height="1040" />
</state>
['type' => 'remote-shield-ok', 'width' => 1, 'height' => 1, 'top' => 2, 'left' => 2],
]];
-$bricksShieldMedia = ['type' => 'shieldmedia', 'width' => 5, 'height' => 4, 'bricks' => [
+$bricksShieldMedia = ['type' => 'shieldmedia', 'width' => 5, 'height' => 5, 'bricks' => [
['type' => 'remote-volume', 'width' => 1, 'height' => 3, 'top' => 1, 'left' => 0],
['type' => 'remote-rew', 'width' => 1, 'height' => 1, 'top' => 0, 'left' => 0],
- ['type' => 'remote-playpause', 'width' => 3, 'height' => 1, 'top' => 0, 'left' => 1],
- ['type' => 'remote-light-down', 'width' => 1, 'height' => 1, 'top' => 1, 'left' => 3],
- ['type' => 'remote-fwd', 'width' => 1, 'height' => 1, 'top' => 0, 'left' => 4],
- ['type' => 'remote-up', 'width' => 1, 'height' => 1, 'top' => 1, 'left' => 2],
- ['type' => 'remote-left', 'width' => 1, 'height' => 1, 'top' => 2, 'left' => 1],
- ['type' => 'remote-down', 'width' => 1, 'height' => 1, 'top' => 3, 'left' => 2],
- ['type' => 'remote-right', 'width' => 1, 'height' => 1, 'top' => 2, 'left' => 3],
- ['type' => 'remote-shield-back', 'width' => 1, 'height' => 1, 'top' => 1, 'left' => 1],
- ['type' => 'remote-shield-menu', 'width' => 1, 'height' => 1, 'top' => 1 + 2, 'left' => 1],
- ['type' => 'remote-shield-home', 'width' => 1, 'height' => 1, 'top' => 1 + 2, 'left' => 1 + 2],
- ['type' => 'remote-shield-ok', 'width' => 1, 'height' => 1, 'top' => 2, 'left' => 2],
+ ['type' => 'remote-playpause', 'width' => 2, 'height' => 1, 'top' => 0, 'left' => 1],
+ ['type' => 'remote-light-down', 'width' => 1, 'height' => 1, 'top' => 4, 'left' => 4],
+ ['type' => 'remote-fwd', 'width' => 1, 'height' => 1, 'top' => 0, 'left' => 3],
+ ['type' => 'remote-stop', 'width' => 1, 'height' => 1, 'top' => 0, 'left' => 4],
+ ['type' => 'remote-infos', 'width' => 3, 'height' => 3, 'top' => 1, 'left' => 1],
['type' => 'remote-subtitles', 'width' => 1, 'height' => 3, 'top' => 1, 'left' => 4],
+ ['type' => 'remote-timeline', 'width' => 4, 'height' => 1, 'top' => 4, 'left' => 0],
]];
$current = getCurrentHarmonyActivity();
if ($current == 'off' || $current == 'poweroff' || !$current) {
if ($activity == 'media' || $activity == 'shield' || $activity == 'tv') {
- $wait = 30;
+ $wait = 10;
}
}
if ($activity !== 'off' && $activity !== 'poweroff') {
/**
* @param $url
* @param string $method
- * @param string $data
+ * @param array $data
* @param null $auth
+ * @param int $timeout
+ * @param bool $allowRedirections
+ * @param array $headers
* @return mixed|\Psr\Http\Message\ResponseInterface
- * @throws \GuzzleHttp\Exception\GuzzleException
*/
-function httpRequest($url, $method = 'get', $data = [], $auth = null, $timeout = 10, $allowRedirections = true)
+function httpRequest($url, $method = 'get', $data = [], $auth = null, $timeout = 10, $allowRedirections = true, $headers = [])
{
$method = mb_strtoupper($method);
$client = getHttpClient();
if ($method == 'GET') {
$options['query'] = $data;
} else {
- $options['form_params'] = $data;
+ if (is_string($data)) {
+ $options['body'] = $data;
+ } else {
+ $options['form_params'] = $data;
+ }
}
+ $options['headers'] = $headers;
return $client->request($method, $url, $options);
}
\ No newline at end of file
if ($p == 'squeezebox') {
$res = squeezeboxRemoteInfos();
} else {
- if (($p === 'netflix' || $p === 'tv') && config('TVPLAYER') === 'shield') {
- $res = ['type' => 'shield', 'can_seek' => false];
+ if (config('TVPLAYER') === 'shield') {
+ if (shieldGetCurrentApp() === 'kodi') {
+ $res = ['type' => 'shieldmedia', 'can_seek' => true];
+ $p = json_decode(httpRequest('http://' . getDevice()['shield'] . ':8754/jsonrpc?Base=1', 'post', '[{"jsonrpc":"2.0","method":"Player.GetProperties","params":[1,["playlistid","speed","position","totaltime","time","percentage","shuffled","repeat","canrepeat","canshuffle","canseek","partymode"]],"id":1},{"jsonrpc":"2.0","method":"Player.GetItem","params":[1,["title","thumbnail","file","artist","genre","year","rating","album","track","duration","playcount","dateadded","episode","artistid","albumid","tvshowid","fanart"]],"id":2}]', ['kodi', 'atacama'], 10, true, ['X-Requested-With' => 'XMLHttpRequest', 'Content-type' => 'application/json'])->getBody(), true);
+ $res['duration'] = '';
+ $res['time'] = '';
+ $res['title'] = '';
+ $res['artwork'] = '';
+ $res['status'] = '';
+ if (isset($p[0]['result'])) {
+ $r = $p[0]['result'];
+ $res['can_seek'] = $r['canseek'];
+ $res['duration'] = 3600 * $r['totaltime']['hours'] + 60 * $r['totaltime']['minutes'] + $r['totaltime']['seconds'];
+ $res['time'] = 3600 * $r['time']['hours'] + 60 * $r['time']['minutes'] + $r['time']['seconds'];
+ }
+ if (isset($p[1]['result']['item']['file'])) {
+ $res = array_merge($res, getTitleAndArtwork($p[1]['result']['item']['file']));
+ }
+ } else {
+ $res = ['type' => 'shield', 'can_seek' => false];
+ }
+
} else {
- if ($p == 'mediarasp') {
- if (config('VIDEOPLAYER') === 'shield') {
- $res = ['type' => 'shieldmedia', 'can_seek' => false];
+ if (($p === 'netflix' || $p === 'tv') && config('TVPLAYER') === 'shield') {
+ $res = ['type' => 'shield', 'can_seek' => false];
+ } else {
+ if ($p == 'mediarasp' || $p === 'shieldmedia') {
+ if (config('VIDEOPLAYER') === 'shield') {
+ $res = ['type' => 'shieldmedia', 'can_seek' => false];
+ } else {
+ $res = mediaraspRemoteInfos();
+ }
} else {
- $res = mediaraspRemoteInfos();
+ $res = ['type' => $p, 'can_seek' => false];
}
- } else {
- $res = ['type' => $p, 'can_seek' => false];
}
}
}
$res['title'] = $meta['title'];
$res['artwork'] = $meta['thumbnail'];
} else {
- $file = str_replace('/nas', '/volume1/Share', $source);
- if (file_exists($file . '.tmdb.id')) {
- $id = file_get_contents($file . '.tmdb.id');
- if (intval($id) > 0) {
- $library = new moviesLibrary($directories);
- $movie = $library->getMovieByID($id);
- $res['title'] = $movie['title'];
- $res['artwork'] = cacheMedia('https://image.tmdb.org/t/p/w500' . $movie['backdrop_path']);
- }
- } else {
- $f = new SplFileInfo($file);
- preg_match('|S(\d{2})/S\d{2}E(\d{2})|', $f, $matches);
- $tvid = $f->getPath() . '/../.tmdb.id';
-
- if (file_exists($tvid)) {
- $id = file_get_contents($tvid);
- if (intval($id)) {
- $library = new tvShowLibrary($directories);
- $tvshow = $library->getTVShowById($id);
- $res['title'] = $tvshow['name'];
- if (count($matches) > 0) {
- $res['title'] .= '<br>S' . $matches[1] . ' E' . $matches[2];
- }
- $res['artwork'] = cacheMedia('https://image.tmdb.org/t/p/w500' . $tvshow['backdrop_path']);
+ $res = array_merge($res, getTitleAndArtwork($source));
+ }
+
+ return $res;
+}
+
+function getTitleAndArtwork($source)
+{
+ global $directories;
+ $cachekey = 'title_artwork_' . sha1($source);
+ $cache = getState($cachekey, null);
+ if (null !== $cache) {
+ return json_decode($cache, true);
+ }
+
+ $res = ['title' => '', 'artwork' => ''];
+ $file = str_replace('smb://Share:dcfyjbcyckwydtgufjx@192.168.13.4/Share/', '/volume1/Share', $source);
+ $file = str_replace('/nas', '/volume1/Share', $file);
+ if (file_exists($file . '.tmdb.id')) {
+ $id = file_get_contents($file . '.tmdb.id');
+ if (intval($id) > 0) {
+ $library = new moviesLibrary($directories);
+ $movie = $library->getMovieByID($id);
+ $res['title'] = $movie['title'];
+ $res['artwork'] = cacheMedia('https://image.tmdb.org/t/p/w500' . $movie['backdrop_path']);
+ }
+ } else {
+ $f = new SplFileInfo($file);
+ preg_match('|S(\d{2})/S\d{2}E(\d{2})|', $f, $matches);
+ $tvid = $f->getPath() . '/../.tmdb.id';
+
+ if (file_exists($tvid)) {
+ $id = file_get_contents($tvid);
+ if (intval($id)) {
+ $library = new tvShowLibrary($directories);
+ $tvshow = $library->getTVShowById($id);
+ $res['title'] = $tvshow['name'];
+ if (count($matches) > 0) {
+ $res['title'] .= '<br>S' . $matches[1] . ' E' . $matches[2];
}
+ $res['artwork'] = cacheMedia('https://image.tmdb.org/t/p/w500' . $tvshow['backdrop_path']);
}
}
}
-
+ setState($cachekey, json_encode($res));
return $res;
+
}
function squeezeboxRemoteInfos()
['type' => 'ir', 'room' => 'bureausun', 'device' => 'Projector', 'command' => 'PowerOn'],
],
'bureau/media/stop' => [
- /* domoticzSwitch(1, false);
- irsend('bureau', 'Projector', 'PowerOff');*/
['type' => 'scene', 'scene' => 'bureau/screen/up'],
['type' => 'scene', 'scene' => 'bureau/rideaux/open'],
['type' => 'scene', 'scene' => 'bureau/auto'],
'back' => 'KEYCODE_BACK',
'home' => 'KEYCODE_HOME',
'pause' => 'KEYCODE_MEDIA_PLAY_PAUSE',
- 'stop' => 'KEYCODE_MEDIA_STOP',
+ 'stop' => 'KEYCODE_HOME',
'space' => 'KEYCODE_SPACE',
'rewind' => 'KEYCODE_MEDIA_REWIND',
'fast-rewind' => 'KEYCODE_MEDIA_REWIND',
return strpos($out, 'Display Power: state=ON') !== false;
}
+function shieldGetCurrentApp($device = null)
+{
+ $out = shieldCommand('shell', 'dumpsys window windows | grep -E \'mCurrentFocus|mFocusedApp|mResumedActivity\'');
+ foreach (shieldGetApps() as $name => $id) {
+ if (strpos($out, $id) !== false) {
+ return $name;
+ }
+ }
+ return null;
+}
+
function _adb($command, $params = '', $device = null)
{
$c = _adbcmd($command, $params, $device);
$output = `$c`;
- echo $c . ' :: ' . $output . "\n";
+ // echo $c . ' :: ' . $output . "\n";
return $output;
}
} else if (isset($_GET['action'])) {
if ($_GET['action'] == 'apps') {
shieldListApps();
+ } else if ($_GET['action'] == 'currentApp') {
+ shieldGetCurrentApp();
}
} else if (isset($_GET['intents'])) {
shieldFindIntents($_GET['intents']);