<project version="4">
<component name="ChangeListManager">
<list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
+ <change afterPath="$PROJECT_DIR$/servers/squeezebox.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/lib/lib.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/lib.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/lib/medialibrary.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/medialibrary.php" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/servers/domoticz.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/domoticz.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/squeezebox.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/squeezebox.php" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<workItem from="1566371220982" duration="598000" />
<workItem from="1566376145799" duration="4963000" />
<workItem from="1566402117063" duration="1534000" />
- <workItem from="1566458804773" duration="1632000" />
- </task>
- <task id="LOCAL-00159" summary=".">
- <created>1551017579585</created>
- <option name="number" value="00159" />
- <option name="presentableId" value="LOCAL-00159" />
- <option name="project" value="LOCAL" />
- <updated>1551017579586</updated>
+ <workItem from="1566458804773" duration="5114000" />
</task>
<task id="LOCAL-00160" summary=".">
<created>1551079784438</created>
<option name="project" value="LOCAL" />
<updated>1566458823293</updated>
</task>
- <option name="localTasksCounter" value="208" />
+ <task id="LOCAL-00208" summary=".">
+ <created>1566499257720</created>
+ <option name="number" value="00208" />
+ <option name="presentableId" value="LOCAL-00208" />
+ <option name="project" value="LOCAL" />
+ <updated>1566499257720</updated>
+ </task>
+ <option name="localTasksCounter" value="209" />
<servers />
</component>
<component name="TodoView">
return;
}
+ $swcorner = '';
+
if ($s['type'] == 'task') {
$attrs['class'] = 'ajax';
$attrs['href'] = 'scripts/tortugatask.php?task=' . $s['command'];
if (isset($s['seen']) && $s['seen']) {
$attrs['data-seen'] = '1';
}
+// if (isset($s['srt']) && count($s['srt'])) {
+// $langtoemoji = ['fr' => 'π«π·', 'en' => 'πΊπΈ'];
+// foreach ($s['srt'] as $item) {
+// $swcorner .= '<span>' . $langtoemoji[$item] . '</span>';
+// }
+// }
+
if (isset($s['poster'])) {
if (!isset($attrs['class'])) {
if (!isset($s['label'])) {
$s['label'] = '';
}
- $res .= '><span>' . $s['label'] . '</span></' . $markup . '>';
+ $res .= '><span>' . $s['label'] . '</span><div class="sw-corner">' . $swcorner . '</div></' . $markup . '>';
}
return $res;
}
}
$normPath = normPath($path);
$x264path = getX264Version($normPath);
- $results[] = array('path' => $x264path, 'seen' => isset($seen[$x264path]), 'dir' => false, 'name' => mediaName(implode(' ', $e), $context, false, $path));
+ $results[] = array('path' => $x264path, 'srt' => hasSRT($normPath), 'seen' => isset($seen[$x264path]), 'dir' => false, 'name' => mediaName(implode(' ', $e), $context, false, $path));
}
} else if ($value != "." && $value != ".." && $value != '@eaDir') {
$files = getMediaContents($path, $context, $seen);
return $results;
}
+function hasSRT($path)
+{
+ $langs = ['fr', 'en'];
+ $e = explode('.', $path);
+ $ext = array_pop($e);
+ $p = implode('.', $e);
+
+ $paths = [$p . '.srt' => 'fr', $p . '.fr.srt' => 'fr', $p . '.en.srt' => 'en'];
+ $res = [];
+ foreach ($paths as $path => $lang) {
+ if (file_exists($path)) {
+ $res[] = $lang;
+ }
+ }
+ return array_unique($res);
+}
+
function getX264Version($path)
{
$e = explode('.', $path);
function squeezeboxRemoteInfos()
{
- $status = squeezeRequest('status - 0 tags:galdcK')['result'];
+ $status = _squeezeRequest('status - 0 tags:galdcK')['result'];
$remoteMeta = $status['remoteMeta'];
$res['type'] = 'squeezebox';
$res['time'] = $status['time'];
squeezeRequest('sync -', $player);
squeezeRequest('stop', $player);
squeezeRequest('power 0', $player);
-
}
function stopAllSqueezebox()
}
}
-function squeezeRequest($params, $player = '')
+function squeezeRequest($params, $player)
+{
+ $redis = connectRedis();
+ $queue_name = 'squeezebox_queue';
+
+ $queue = $redis->get($queue_name);
+ if (!is_array($queue)) {
+ $queue = [];
+ }
+ array_push($queue, [$params, $player]);
+
+ $redis->igbset($queue_name, $queue);
+ $redis->publish('squeezebox_event', 'handle_queue');
+}
+
+function _squeezeRequest($params, $player = '')
{
global $rpcid;
if (!isAlive('cuisine')) {
$params[] = 'item_id:' . $root;
}
- $r = squeezeRequest($params, $squeezeboxPlayers['Salon']);
+ $r = _squeezeRequest($params, $squeezeboxPlayers['Salon']);
if (isset($r['result']) && isset($r['result']['loop_loop'])) {
$loop = $r['result']['loop_loop'];
$accounts = [
SQUEEZEBOX_SPOTIFY_USERNAME => SQUEEZEBOX_SPOTIFY_PASSWORD,
- 'jrme75009' => 'tortuga5009',
- 'v12l' => 'Lr8ka&7cs@fc%lW7'
];
foreach ($accounts as $user => $password) {
--- /dev/null
+#!/usr/bin/php
+
+<?php
+require_once __DIR__ . "/../scripts/import.php";
+
+// Set time limit to indefinite execution
+set_time_limit(0);
+ignore_user_abort(true);
+
+echo 'Run home server squeezebox' . "\n";
+
+$redis = connectRedis();
+redisEventListener('squeezebox_event', 'handleSqueezeboxQueue');
+
+function handleSqueezeboxQueue()
+{
+ global $redis;
+
+ while (true) {
+ $q = 'squeezebox_queue';
+ $queue = $redis->igbget($q);
+ if (!is_array($queue)) {
+ $queue = [];
+ $redis->igbset($q, $queue);
+ }
+ if (!count($queue)) {
+ echo 'End processing queue' . "\n";
+ break;
+ }
+
+ $command = array_shift($queue);
+ $redis->igbset($q, $queue);
+ echo 'Run command ' . json_encode($command) . "\n";
+ _squeezeRequest($command[0], $command[1]);
+ }
+}
\ No newline at end of file