Sfoglia il codice sorgente

Splash and headphones fix and plex fix

causefx 8 anni fa
parent
commit
9e343d5903
5 ha cambiato i file con 136 aggiunte e 8 eliminazioni
  1. 36 0
      api.php
  2. 1 0
      config/configDefaults.php
  3. 6 6
      functions.php
  4. 87 2
      index.php
  5. 6 0
      settings.php

+ 36 - 0
api.php

@@ -0,0 +1,36 @@
+<?php
+// Include functions
+require_once('functions.php');
+// Lazyload settings
+$databaseConfig = configLazy('config/config.php');
+// Get Action
+if (isset($_POST['a'])) { $action = $_POST['a']; }
+if (isset($_POST['k'])) { $key = $_POST['k']; }
+if (isset($_GET['a'])) { $action = $_GET['a']; }
+if (isset($_GET['k'])) { $key = $_GET['k']; }
+unset($_POST['a']);
+unset($_POST['k']);
+//Set Default Result
+$result = "An error has occurred";
+//Check Key
+if (!isset($key)) {
+    exit(json_encode("No API Key set"));
+}elseif (strtolower(ORGANIZRAPI) != strtolower($key)) {
+    exit(json_encode("API Key mismatch"));
+}
+//Start API Call
+if (isset($action)) {
+    switch ($action) {
+        case "1":
+            $result = "test";
+            break;
+        case "2":
+            $result = "other test";
+            break;
+        default:
+            $result = "$action not defined";
+    }
+}
+//return JSON array
+exit(json_encode($result));
+?>

+ 1 - 0
config/configDefaults.php

@@ -90,4 +90,5 @@ return array(
 	"historyRefresh" => "120000",
 	"downloadRefresh" => "30000",
 	"organizrAPI" => "",
+	"splash" => "false",
 );

+ 6 - 6
functions.php

@@ -686,7 +686,7 @@ function resolvePlexItem($server, $token, $item, $nowPlaying = false, $showNames
                 $thumb = $item['art'];
                 $key = $item['ratingKey'] . "-np";
                 $elapsed = $item['viewOffset'];
-                $duration = $item['duration'];
+                $duration = ($item['duration']) ? $item['duration'] : $item->Media['duration'];
                 $watched = (!empty($elapsed) ? floor(($elapsed / $duration) * 100) : 0);
                 $transcoded = floor($item->TranscodeSession['progress']- $watched);
                 $stream = $item->Media->Part->Stream['decision'];
@@ -717,7 +717,7 @@ function resolvePlexItem($server, $token, $item, $nowPlaying = false, $showNames
                 $thumb = $item['art'];
                 $key = $item['ratingKey'] . "-np";
                 $elapsed = $item['viewOffset'];
-                $duration = $item['duration'];
+                $duration = ($item['duration']) ? $item['duration'] : $item->Media['duration'];
                 $watched = (!empty($elapsed) ? floor(($elapsed / $duration) * 100) : 0);
                 $transcoded = floor($item->TranscodeSession['progress']- $watched);
                 $stream = $item->Media->Part->Stream['decision'];
@@ -753,7 +753,7 @@ function resolvePlexItem($server, $token, $item, $nowPlaying = false, $showNames
 				$useImage = (isset($item['live']) ? "images/livetv.png" : null);
 				$extraInfo = isset($item['extraType']) ? "Trailer" : (isset($item['live']) ? "Live TV" : ":)");
                 $elapsed = $item['viewOffset'];
-                $duration = $item['duration'];
+                $duration = ($item['duration']) ? $item['duration'] : $item->Media['duration'];
                 $watched = (!empty($elapsed) ? floor(($elapsed / $duration) * 100) : 0);
                 $transcoded = floor($item->TranscodeSession['progress']- $watched);
                 $stream = $item->Media->Part->Stream['decision'];
@@ -789,7 +789,7 @@ function resolvePlexItem($server, $token, $item, $nowPlaying = false, $showNames
                 $thumb = $item['art'];
                 $key = $item['ratingKey'] . "-np";
                 $elapsed = $item['viewOffset'];
-                $duration = $item['duration'];
+                $duration = ($item['duration']) ? $item['duration'] : $item->Media['duration'];
                 $watched = (!empty($elapsed) ? floor(($elapsed / $duration) * 100) : 0);
                 $transcoded = floor($item->TranscodeSession['progress']- $watched);
                 $stream = $item->Media->Part->Stream['decision'];
@@ -822,7 +822,7 @@ function resolvePlexItem($server, $token, $item, $nowPlaying = false, $showNames
                 $thumb = $item['art'];
                 $key = $item['ratingKey'] . "-np";
                 $elapsed = $item['viewOffset'];
-                $duration = $item['duration'];
+                $duration = ($item['duration']) ? $item['duration'] : $item->Media['duration'];
                 $watched = (!empty($elapsed) ? floor(($elapsed / $duration) * 100) : 0);
                 $transcoded = floor($item->TranscodeSession['progress']- $watched);
                 $stream = $item->Media->Part->Stream['decision'];
@@ -2909,7 +2909,7 @@ function getHeadphonesCalendar($url, $key, $list){
 				$i++;
 				$albumName = addslashes($child['AlbumTitle']);
 				$albumArtist = htmlentities($child['ArtistName'], ENT_QUOTES);
-				$albumDate = $child['ReleaseDate'];
+				$albumDate = (strlen($child['ReleaseDate']) > 4) ? $child['ReleaseDate'] : $child['ReleaseDate']."-01-01";
 				$albumID = $child['AlbumID'];
 				$albumDate = strtotime($albumDate);
 				$albumDate = date("Y-m-d", $albumDate);

+ 87 - 2
index.php

@@ -128,6 +128,7 @@ if (file_exists('config/config.php')) {
         if($USER->authenticated && $USER->role == "admin") :
 
             $result = $file_db->query('SELECT * FROM tabs WHERE active = "true" ORDER BY `order` asc');
+            $splash = $file_db->query('SELECT * FROM tabs WHERE active = "true" ORDER BY `order` asc');
             $getsettings = $file_db->query('SELECT * FROM tabs WHERE active = "true" ORDER BY `order` asc');
 
             foreach($getsettings as $row) :
@@ -143,10 +144,12 @@ if (file_exists('config/config.php')) {
         elseif($USER->authenticated && $USER->role == "user") :
 
             $result = $file_db->query('SELECT * FROM tabs WHERE active = "true" AND user = "true" ORDER BY `order` asc');
+            $splash = $file_db->query('SELECT * FROM tabs WHERE active = "true" AND user = "true" ORDER BY `order` asc');
 
         else :
 
             $result = $file_db->query('SELECT * FROM tabs WHERE active = "true" AND guest = "true" ORDER BY `order` asc');
+            $splash = $file_db->query('SELECT * FROM tabs WHERE active = "true" AND guest = "true" ORDER BY `order` asc');
 
         endif;
 
@@ -285,6 +288,23 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
         <![endif]-->
     </head>
     <style>
+        .splash-item {
+            max-width: 100%;
+
+            -moz-transition: all 0.3s;
+            -webkit-transition: all 0.3s;
+            transition: all 0.3s;
+            opacity: .8 !important;
+        }
+        .splash-item:hover {
+            -moz-transform: scale(1.1);
+            -webkit-transform: scale(1.1);
+            transform: scale(1.1);
+            z-index: 10000000;
+            border-radius: 10px;
+            opacity: 1 !important;
+            box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
+        }
         .TabOpened {
             -webkit-filter: drop-shadow(0px 0px 5px <?=$topbartext;?>);
             filter: drop-shadow(0px 0px 5px <?=$topbartext;?>);
@@ -1127,7 +1147,62 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 				</div>
 			</div>
 		</div>
-		<?php } ?>
+        <?php } ?>
+        <?php if (file_exists('config/config.php') && $configReady = "Yes" && $tabSetup == "No" && SPLASH == "true") {?>
+        <div id="splashScreen" class="splash-modal modal fade">
+			<div style="background:<?=$sidebar;?>;" class="table-wrapper big-box">
+				
+                <button style="color:<?=$topbartext;?>;" type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">&times;</span>
+                </button>
+                <br/><br/>
+                <div class="row">
+                    <div class="col-lg-12">
+                        <div class="row">                      
+                            <?php if($tabSetup == "No") : $tabCount = 1; foreach($splash as $row) : ?>
+                            <div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">
+                                <li style="list-style-type: none; cursor: pointer;" window="<?=$row['window'];?>" class="splash-item content-box small-box ultra-widget gray-bg" id="<?=$row['url'];?>x" data-title="<?=$row['name'];?>" name="<?php echo strtolower($row['name']);?>">
+                                    <div class="w-content">
+                                        <div class="w-icon">
+                                            <center>
+                                                <?php if($row['iconurl']) : ?>
+                                                    <i style="">
+                                                        <img src="<?=$row['iconurl'];?>" style="height: 100px; margin-top: -10px;" class="">
+                                                    </i>
+                                                <?php else : ?>
+                                                    <i style="padding-bottom: 8px" class="fa <?=$row['icon'];?> fa-sm"></i>
+                                                <?php endif; ?>
+                                            </center>
+                                        </div>
+                                        <div class="text-center"><span class="text-uppercase w-name elip"><?=$row['name'];?></span></div>
+                                    </div>
+                                </li>
+                            </div>
+                            <?php $tabCount++; endforeach; endif;?>  
+                        </div>
+                        <?php if( $USER->authenticated && $USER->role == "admin" ){ ?>
+                        <div class="row">                      
+                            <div class="col-lg-12">
+                                <li style="list-style-type: none; cursor: pointer;" class="splash-item content-box small-box ultra-widget gray-bg" data-title="" name="settings">
+                                    <div class="w-content">
+                                        <div class="w-icon">
+                                            <center>
+                                                <i style="">
+                                                    <img src="images/settings.png" style="height: 100px; margin-top: -10px;" class="">
+                                                </i>
+                                            </center>
+                                        </div>
+                                        <div class="text-center"><span class="text-uppercase w-name elip">Settings</span></div>
+                                    </div>
+                                </li>
+                            </div>
+                        </div>
+                        <?php } ?>
+                    </div>
+                </div>
+			</div>
+        </div>
+        <?php } ?>
 
         <!--Scripts-->
         <script src="<?=$baseURL;?>bower_components/jquery/dist/jquery.min.js"></script>
@@ -1159,7 +1234,9 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
         <script src="js/jquery.mousewheel.min.js" type="text/javascript"></script>
 
         <script>
-
+        <?php if (file_exists('config/config.php') && $configReady = "Yes" && $tabSetup == "No" && SPLASH == "true") {?>    
+        $('.splash-modal').modal("show");
+        <?php } ?>
         var fixed = document.getElementById('gn-scroller');
         fixed.addEventListener('touchmove', function(e) {
 
@@ -1575,6 +1652,14 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
             setHeight();
 
         });
+
+        $("li[class^='splash-item']").on('click vclick', function(){
+            var thisname = $(this).attr("name");
+            var splashTab = $("#tabList li[name^='" + thisname + "']");
+            splashTab.trigger("click");
+            $('.splash-modal').modal("hide");
+
+        });
             
         $("li[class^='tab-item']").on('click vclick', function(){
             var thisidfull = $(this).attr("id");

+ 6 - 0
settings.php

@@ -1546,6 +1546,12 @@ echo buildSettings(
 						),
 					),
 					array(
+                        array(
+							'type' => 'checkbox',
+							'labelTranslate' => 'ENABLE_SPLASH_SCREEN',
+							'name' => 'splash',
+							'value' => SPLASH,
+						),
 						array(
 							'type' => 'checkbox',
 							'labelTranslate' => 'ENABLE_LOADING_SCREEN',