]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Sun, 29 Nov 2020 19:23:20 +0000 (20:23 +0100)
committerVincent <vincent@enhydra.fr>
Sun, 29 Nov 2020 19:23:20 +0000 (20:23 +0100)
.idea/workspace.xml
js/home.js
scripts/accordionstate.php [new file with mode: 0644]
scripts/lib/lib.php
scripts/lib/medialibrary.php
scripts/lib/tmdb.php

index 7c4184e704dbaa4bd297864f0e874cf9bd292bc8..a1c542e73ff4c4dc716911f4c71de5e64f6c97fa 100644 (file)
@@ -2,11 +2,12 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
-      <change beforePath="$PROJECT_DIR$/.idea/php.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/php.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/scripts/accordionstate.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$/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$/scripts/lib/pc.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/pc.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/tmdb.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/tmdb.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="1606299989262" duration="135000" />
       <workItem from="1606480003955" duration="1588000" />
       <workItem from="1606647174961" duration="4677000" />
+      <workItem from="1606674601895" duration="2974000" />
     </task>
     <task id="LOCAL-00365" summary=".">
       <created>1604307642081</created>
     </state>
     <state x="635" y="216" key="FileChooserDialogImpl/0.0.1707.920@0.0.1707.920" timestamp="1604227698339" />
     <state x="952" y="244" key="FileChooserDialogImpl/0.0.2560.1040@0.0.2560.1040" timestamp="1605726960903" />
-    <state x="1114" y="443" key="NewPhpFileDialog" timestamp="1605344146097">
+    <state x="1114" y="443" key="NewPhpFileDialog" timestamp="1606676047797">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="743" y="392" key="NewPhpFileDialog/0.0.1707.920@0.0.1707.920" timestamp="1604238041494" />
-    <state x="1114" y="443" key="NewPhpFileDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1605344146097" />
+    <state x="1114" y="443" key="NewPhpFileDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1606676047797" />
     <state x="546" y="120" key="SettingsEditor" timestamp="1606112187843">
       <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="1606664599318">
+    <state x="977" y="257" width="607" height="536" key="find.popup" timestamp="1606675922613">
       <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="1606664599318" />
+    <state x="977" y="257" width="607" height="536" key="find.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1606675922613" />
     <state x="1056" y="292" key="refactoring.ChangeSignatureDialog" timestamp="1604518096294">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
index 50eb4301cdc67b0cf665013f3363580518c74f80..02383d8c116ecfefdec3f35ac1bd512753ba17d4 100644 (file)
@@ -143,7 +143,6 @@ $(function () {
     });
 
     $(document).on(clicktouchevent, '[data-menu]', function () {
-        console.log('!!!!');
         $("#iframeHolder").hide();
         window.location.hash = "#/section/" + $(this).data('menu');
         return false;
@@ -159,7 +158,34 @@ $(function () {
     });
 
     $(document).on(clickevent, 'accordion>a', function () {
-        $(this).closest('accordion').toggleClass('closed');
+        var close = [];
+        var open = [];
+        var a = $(this).closest('accordion');
+        if (a.hasClass('closed')) {
+            var notClosed = $(this).closest('section').find('accordion:not(.closed)');
+            $(notClosed).each(function () {
+                close.push($(this).attr('id'));
+            });
+            $(notClosed).addClass('closed');
+
+            open.push(a.attr('id'));
+            a.removeClass('closed');
+        } else {
+            close.push(a.attr('id'));
+            a.addClass('closed');
+        }
+
+        $.ajax({
+            url: '/scripts/accordionstate.php',
+            method: 'post',
+            data: {close: close, open: open}
+        });
+
+        $('#scrollholder').scrollTo(0);
+        setTimeout(function () {
+           $('#scrollholder').scrollTo(0);
+        }, 50);
+
         resize();
         return false;
     });
@@ -374,7 +400,6 @@ $(function () {
         return false;
     });
 
-
     changeAddress();
     initScreenSaver();
     initWeather();
@@ -468,7 +493,6 @@ function runSSHQueue() {
 }
 
 function soundsOff() {
-
     $("#iframeHolder").remove();
     stopSqueeze();
 }
diff --git a/scripts/accordionstate.php b/scripts/accordionstate.php
new file mode 100644 (file)
index 0000000..3782784
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+require_once "import.php";
+
+if (isset($_POST['close'])) {
+    foreach ($_POST['close'] as $item) {
+        setState($item, '0');
+    }
+}
+if (isset($_POST['open'])) {
+    foreach ($_POST['open'] as $item) {
+        setState($item, '1');
+    }
+}
\ No newline at end of file
index d199633a6363607ed493fe483dcebf942ff92cd1..88bf717ab69263c844d6508feda39a575a894f6a 100644 (file)
@@ -120,6 +120,11 @@ function getLinkHash($s)
     return sha1(json_encode($s));
 }
 
+function accordionClosed($accordionId)
+{
+    return getState($accordionId, '0') == '0';
+}
+
 function shortcutDir($allshortcuts)
 {
     $res = array();
@@ -145,11 +150,6 @@ function shortcutDir($allshortcuts)
             $section .= '<div class="fit">';
         }
         foreach ($shortcuts as $k => $s) {
-            if ($s['type'] == 'accordion-end') {
-                $html = '</accordion>';
-            } else if ($s['type'] == 'accordion') {
-                $html = '<accordion class="accordion ' . (isset($s['closed']) && $s['closed'] ? 'closed' : '') . '"><a href="#"><span>' . $s['label'] . '</span></a>';
-            }
             if ($s['type'] == 'clear' || $s['type'] == 'accordion' || $s['type'] == 'accordion-end') {
                 if ($i % 2 == 1) {
                     $section .= '</div>';
@@ -159,7 +159,7 @@ function shortcutDir($allshortcuts)
                 if ($s['type'] === 'clear') {
                     $section .= '<div class="clearcol"></div>';
                 } else if ($s['type'] === 'accordion') {
-                    $section .= '<accordion class="accordion ' . (isset($s['closed']) && $s['closed'] ? 'closed' : '') . '"><a><span>' . $s['label'] . '</span></a>';
+                    $section .= '<accordion id="' . $s['id'] . '" class="accordion ' . (isset($s['closed']) && $s['closed'] ? 'closed' : '') . '"><a><span>' . $s['label'] . '</span></a>';
                 } else if ($s['type'] === 'accordion-end') {
                     $section .= '</accordion>';
                 }
index a0c95878dd826803d23bae50bea7da3f73f5b419..d98f7ed418d4d3b228325eabf8ed1fd5b9fbbdb4 100644 (file)
@@ -176,7 +176,6 @@ function transcodeOneVideo()
 
         $resize = getVideoHeight($path) > 1080 ? ' 1' : ' 0';
         $cmd = 'C:\Scripts\convertvideo.bat "' . nasToAvion($item) . '" "' . nasToAvion($to) . '" ' . $destext . ' ' . getVideoCodec($path) . $resize;
-        print_r(sshCommand($cmd, 'avion'));
         return;
     }
     echo 'no file to transcode';
index 463138d1e88dd639238551b649553c558c1c4568..722050d6b93bc7f5490179d7ec9f037435b69af4 100644 (file)
@@ -72,7 +72,7 @@ function _getTVShows($force = false, $forceapi = false)
         global $directories;
         $library = new tvShowLibrary($directories, $forceapi);
         $res = $library->getShortcuts();
-        connectRedis()->igbsetex('medialibrary.tvshows', 259200, $res);
+        connectRedis()->igbsetex('medialibrary.tvshows', 1800, $res);
         return $res;
     }
     $res = connectRedis()->igbget('medialibrary.tvshows');
@@ -93,7 +93,7 @@ function _getMovies($force = false, $forceapi = false)
         global $directories;
         $library = new moviesLibrary($directories, $forceapi);
         $res = $library->getShortcuts();
-        connectRedis()->igbsetex('medialibrary.movies', 259200, $res);
+        connectRedis()->igbsetex('medialibrary.movies', 1800, $res);
         return $res;
     }
     $res = connectRedis()->igbget('medialibrary.movies');
@@ -217,7 +217,6 @@ class tvShowLibrary extends mediaLibrary
     {
         global $videoExt;
 
-
         $e = explode(':', $tvShow['dir']);
         if ($e[0] === 'netflix') {
             $res['shortcuts'][] = ['label' => $tvShow['data']['name'], 'type' => 'netflix', 'url' => '/scripts/netflix.php?id=' . $e[1], 'poster' => $this->_poster($tvShow['data']['poster_path'])];
@@ -256,9 +255,8 @@ class tvShowLibrary extends mediaLibrary
                 continue;
             }
 
-            $res['subs']['sub-' . $subname][] = ['label' => $ns, 'type' => 'accordion'];
-            $startIndex = count($res['subs']['sub-' . $subname]) - 2;
-            $lastSeen = true;
+            $accordionId = 'acc_' . sha1($subname . '--' . $ns);
+            $res['subs']['sub-' . $subname][] = ['label' => $ns, 'type' => 'accordion', 'id' => $accordionId, 'closed' => accordionClosed($accordionId)];
             for ($i = 1; $i <= $season['episode_count']; $i++) {
                 $es = $this->_n($i, 'e');
                 $exists = false;
@@ -279,16 +277,12 @@ class tvShowLibrary extends mediaLibrary
                 if ($exists) {
                     $path = $this->_path($exists);
                     $res['subs']['sub-' . $subname][] = ['label' => $es, 'type' => 'media', 'srt' => hasSRT($path), 'seen' => $this->_seen($path), 'path' => $path];
-                    $missing = false;
                 } else {
                     $res['subs']['sub-' . $subname][] = ['label' => $es, 'type' => 'missing'];
                 }
-                $lastSeen = $this->_seen($path);
-            }
-            if ($lastSeen || $missing) {
-                $closed = true;
+
             }
-            $res['subs']['sub-' . $subname][$startIndex]['closed'] = $closed;
+
             $res['subs']['sub-' . $subname][] = ['type' => 'accordion-end'];
         }
     }