]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Fri, 3 Jan 2020 08:37:34 +0000 (09:37 +0100)
committerVincent <vincent@enhydra.fr>
Fri, 3 Jan 2020 08:37:34 +0000 (09:37 +0100)
.idea/workspace.xml
gradient.php
scripts/gradient.php
scripts/lib/mediarasp.php
scripts/youtubedl-download.php

index ba04ba3cc5ba0355816b7b1a639ea6ca75b86554..30ed578af70efff0d2179963e85b4f585be404a0 100644 (file)
@@ -2,11 +2,11 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
-      <change afterPath="$PROJECT_DIR$/scripts/youtubedl-download.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/js/home.js" beforeDir="false" afterPath="$PROJECT_DIR$/js/home.js" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/gradient.php" beforeDir="false" afterPath="$PROJECT_DIR$/gradient.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/gradient.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/gradient.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/lib/mediarasp.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/mediarasp.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/raspberrycast.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/raspberrycast.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/youtubedl-download.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/youtubedl-download.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
       <workItem from="1577378088885" duration="2201000" />
       <workItem from="1577380387468" duration="866000" />
       <workItem from="1577785483253" duration="3506000" />
-      <workItem from="1577891426611" duration="4801000" />
-    </task>
-    <task id="LOCAL-00214" summary=".">
-      <created>1566737418166</created>
-      <option name="number" value="00214" />
-      <option name="presentableId" value="LOCAL-00214" />
-      <option name="project" value="LOCAL" />
-      <updated>1566737418166</updated>
+      <workItem from="1577891426611" duration="5672000" />
     </task>
     <task id="LOCAL-00215" summary=".">
       <created>1566808495062</created>
       <option name="project" value="LOCAL" />
       <updated>1578036926863</updated>
     </task>
-    <option name="localTasksCounter" value="263" />
+    <task id="LOCAL-00263" summary=".">
+      <created>1578039845044</created>
+      <option name="number" value="00263" />
+      <option name="presentableId" value="LOCAL-00263" />
+      <option name="project" value="LOCAL" />
+      <updated>1578039845044</updated>
+    </task>
+    <option name="localTasksCounter" value="264" />
     <servers />
   </component>
   <component name="TodoView">
     </state>
     <state x="720" y="247" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1577298128269" />
     <state x="960" y="247" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1576479992407" />
-    <state x="935" y="114" key="CommitChangelistDialog2" timestamp="1578036915321">
+    <state x="935" y="114" key="CommitChangelistDialog2" timestamp="1578039839316">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="701" y="114" key="CommitChangelistDialog2/0.0.1920.1040@0.0.1920.1040" timestamp="1577381105204" />
     <state x="701" y="127" key="CommitChangelistDialog2/0.0.1920.1160@0.0.1920.1160" timestamp="1575647157027" />
-    <state x="935" y="114" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1578036915321" />
+    <state x="935" y="114" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1578039839316" />
     <state x="1114" y="443" key="NewPhpFileDialog" timestamp="1578038647334">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="732" y="343" key="com.intellij.ide.util.TipDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1577380394903" />
     <state x="732" y="383" key="com.intellij.ide.util.TipDialog/0.0.1920.1160@0.0.1920.1160" timestamp="1575647093028" />
     <state x="976" y="343" key="com.intellij.ide.util.TipDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1577891427221" />
-    <state x="976" y="257" width="607" height="536" key="find.popup" timestamp="1578037318294">
+    <state x="976" y="257" width="607" height="536" key="find.popup" timestamp="1578040021331">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="732" y="257" width="607" height="536" key="find.popup/0.0.1920.1040@0.0.1920.1040" timestamp="1577380471547" />
-    <state x="976" y="257" width="607" height="536" key="find.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1578037318294" />
+    <state x="976" y="257" width="607" height="536" key="find.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1578040021331" />
   </component>
   <component name="antWorkspaceConfiguration">
     <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
index c33fdfcbda82a60ae39cc3c61208567a595f05ab..1aa174819085319180f21b75bae510d7db52cd71 100644 (file)
                             css.backgroundImage = 'none';
                             //videoURL = data.data.video_path;
                             videoURL = data.data.video_path.replace('/nas/', 'file:///Z:/');
+                            startVideo = 1;
+                            if (data.data.start) {
+                                startVideo = data.data.start;
+                            }
                         }
 
                         if (videoURL === false) {
@@ -52,7 +56,7 @@
                                 $('.video-background video').attr('src', videoURL);
                                 var video = $('.video-background video').get(0);
                                 video.pause();
-                                video.currentTime = 25;
+                                video.currentTime = startVideo;
                                 video.play();
 
                             }
index 93259cc928fb851d47ab209c9edd520ec00942a9..ef8b55048edb00ceafb14ca8809755d3e0466153 100644 (file)
@@ -12,7 +12,7 @@ switch ($c) {
         //$type = 'image';
         //$res = ['image' => '/images/ambiance/floral.jpg', 'position' => '50% 50%'];
         $type = 'youtube';
-        $res = ['videoid' => 'R3AKlscrjmQ'];
+        $res = ['videoid' => 'R3AKlscrjmQ', 'start' => 5];
         break;
     case 'savane':
         $type = 'image';
@@ -22,17 +22,17 @@ switch ($c) {
 //             $type = 'image';
 //             $res = ['image' => '/images/ambiance/borealis.jpg', 'position' => '50% 100%'];
         $type = 'youtube';
-        $res = ['videoid' => 'T75IKSXVXlc'];
+        $res = ['videoid' => 'T75IKSXVXlc', 'start' => 5];
         break;
     case 'tropical':
         $type = 'youtube';
-        $res = ['videoid' => 'tYfsxnDTpcI'];
+        $res = ['videoid' => 'tYfsxnDTpcI', 'start' => 5];
         //$type = 'image';
         //$res = ['image' => '/images/ambiance/clouds.jpg', 'position' => '50% 100%'];
         break;
     case 'lounge':
         $type = 'youtube';
-        $res = ['videoid' => 'jfttWulByFI'];
+        $res = ['videoid' => 'jfttWulByFI', 'start' => 5];
         //$type = 'gradient';
         //$res = ['#d442f4', '#ebc3f4'];
         break;
@@ -57,20 +57,20 @@ switch ($c) {
 //        $type = 'image';
 //        $res = ['image' => '/images/ambiance/lapared.jpg', 'position' => '50% 50%'];
         $type = 'youtube';
-        $res = ['videoid' => 'xGlVPzmgpSM'];
+        $res = ['videoid' => 'xGlVPzmgpSM', 'start' => 5];
         break;
     case 'jellyfish':
         $type = 'youtube';
-        $res = ['videoid' => '95Tc8qIJRuI'];
+        $res = ['videoid' => '95Tc8qIJRuI', 'start' => 5];
         break;
     case 'sharks':
         $type = 'youtube';
-        $res = ['videoid' => 'ehC5kXA70Ao'];
+        $res = ['videoid' => 'ehC5kXA70Ao', 'start' => 10];
         break;
     case 'space':
         $type = 'youtube';
 //        $res = ['videoid' => 'wnhvanMdx4s'];
-        $res = ['videoid' => 'Xjs6fnpPWy4'];
+        $res = ['videoid' => 'Xjs6fnpPWy4', 'start' => 90];
         break;
     case 'off':
         $type = 'off';
@@ -81,7 +81,7 @@ if ($type == 'gradient' && (!is_array($res) || !count($res))) {
     $res = ['#ffffff', '#ffffff'];
 }
 if ($type == 'youtube') {
-    $res['video_path'] = downloadYoutubeDL('https://www.youtube.com/watch?v=' . $res['videoid'], 'webm');
+    $res['video_path'] = downloadYoutubeDL('https://www.youtube.com/watch?v=' . $res['videoid'], false, 'webm');
 }
 header('Content-type: application/json');
 $r = ['type' => $type, 'data' => $res];
index bf3b7a7631021085e2bf3dd3d0e59ec1d56538ff..b296a9e594f71fa72338470b603afea00ce29942 100644 (file)
@@ -346,10 +346,7 @@ function mediaRaspPostPlay($device)
 {
     $rasps = ['entree', 'bureausun', 'litvincent', 'litjerome', 'sdb'];
     if (in_array($device, $rasps)) {
-//        OMXCmd(['action' => 'dbus', 'command' => 'volume', 'parameter' => '-12.0'])->getBody();
-//        OMXCmd(['action' => 'dbus', 'command' => 'volume', 'parameter' => '-12.0'])->getBody();
-//        OMXCmd(['action' => 'dbus', 'command' => 'setaspectmode', 'parameter' => 'stretch'])->getBody();
-//        OMXCmd(['action' => 'dbus', 'command' => 'setvideopos', 'parameter' => '0 0 800 480'])->getBody();
+
     }
 }
 
@@ -385,21 +382,26 @@ function getYoutubeDLCastURL($url)
     return trim($res);
 }
 
-function getYoutubeDLPath($url)
+function getYoutubeDLPath($url, $ext = 'mkv')
 {
     $hash = sha1($url);
-    return "/nas/Videos/YoutubeDL/" . $hash . '.mkv';
+    return "/nas/Videos/YoutubeDL/" . $hash . '.' . $ext;
 }
 
-function downloadYoutubeDL($url)
+function downloadYoutubeDL($url, $cast = true, $ext = 'mkv')
 {
-    $dest = getYoutubeDLPath($url);
+    $dest = getYoutubeDLPath($url, $ext);
     $wip = $dest . '.wip';
     if (!file_exists($dest)) {
         if (!file_exists($wip)) {
-            httpRequest('https://' . $_SERVER['HTTP_HOST'] . '/scripts/youtubedl-download.php?url=' . rawurldecode($url), 'get', [], null, 1);
+            httpRequest('https://' . $_SERVER['HTTP_HOST'] . '/scripts/youtubedl-download.php?url=' . rawurldecode($url) . '&ext=' . $ext, 'get', [], null, $cast ? 1 : 0);
+            if (!$cast) {
+                return $dest;
+            }
+        }
+        if ($cast) {
+            return getYoutubeDLCastURL($url);
         }
-        return getYoutubeDLCastURL($url);
     } else {
         return $dest;
     }
@@ -514,21 +516,3 @@ function VLCPlay($fileorstream, $device = null, $timeout = 5)
     return VLCCmd(['command' => 'in_play', 'input' => $fileorstream], $device, $timeout);
 }
 
-function OMXCmd($params, $device = null, $timeout = 5)
-{
-    global $devices;
-    if (null === $device) {
-        $device = config('DEVICE');
-    }
-    $d = $devices[$device];
-
-    $client = getMediaRaspClient();
-    try {
-        $response = $client->post('http://' . $d['host'] . ':4321/index.php/index/', ['form_params' => $params, 'timeout' => $timeout]);
-    } catch (Exception $e) {
-        echo $d['host'] . print_r($params) . ':' . $e->getMessage();
-        return false;
-    }
-    return $response;
-}
-
index f4fd13575cfb26550b4c2d49756195adff68dc11..a91363a1cec16e961248e69b1fcbe454be3897e2 100644 (file)
@@ -1,8 +1,9 @@
 <?php
 require_once "import.php";
 $url = $_GET['url'];
+$ext=$_GET['ext'];
 
-$dest = getYoutubeDLPath($url);
+$dest = getYoutubeDLPath($url,$ext);
 $wip = $dest . '.wip';
 if (!file_exists($dest) && !file_exists($wip)) {
     set_time_limit(0);