From 6b31e11a73ca6a4417899db792919a8587bd1390 Mon Sep 17 00:00:00 2001 From: Vincent Date: Sat, 14 Sep 2019 19:05:08 +0200 Subject: [PATCH] . --- .idea/workspace.xml | 23 +++++++++++++---------- manifest.php | 2 +- scripts/share.php | 15 ++++++++++----- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index a0aef0c..e5362d3 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,7 +3,8 @@ - + + diff --git a/manifest.php b/manifest.php index 25d72cd..fbd1eb7 100644 --- a/manifest.php +++ b/manifest.php @@ -12,7 +12,7 @@ $manifest = [ 'scope' => '/', 'icons' => [], 'share_target' => [ - 'action' => '/scripts/share.php', + 'action' => 'https://' . $_SERVER['HTTP_HOST'] . '/scripts/share.php', 'method' => 'POST', 'enctype' => 'application/x-www-form-urlencoded', 'params' => [ diff --git a/scripts/share.php b/scripts/share.php index 56a8072..2ad2b08 100644 --- a/scripts/share.php +++ b/scripts/share.php @@ -2,7 +2,6 @@ require_once "import.php"; shareIntent($_REQUEST['text']); - function shareIntent($content, $device = null) { $hasScreen = ['bureau', 'salon', 'sdb', 'litvincent', 'litjerome']; @@ -13,17 +12,23 @@ function shareIntent($content, $device = null) if (strpos($content, 'http') === 0) { $u = parse_url($content); if ($u['host'] == 'open.spotify.com') { + if ($device == 'salon') { + harmonyActivity('musique-radio'); + } $p = explode('/', trim($u['path'], '/')); $spotify = 'spotify:' . implode(':', $p); - $commands = ['playlist clear', 'playlist play ' . $spotify, 'playlist repeat 2', 'playlist shuffle 0']; + $commands = ['playlist clear', 'playlist play ' . $spotify, 'playlist repeat 0']; foreach ($commands as $command) { - squeezeRequest($command); + squeezeRequest($command, config('SQUEEZEBOX_PLAYER')); } - setPlaying('squeezebox'); + setPlaying('squeezebox', $device); + $sleep = 1; } else if (in_array($device, $hasScreen)) { + $sleep = 5; mediaRaspPlayCast($content, $device); } - sleep(5); + sleep($sleep); + header('Location: /#/section/remote'); exit; } -- 2.39.5