causefx 8 лет назад
Родитель
Сommit
f3a4f37f38
11 измененных файлов с 166 добавлено и 95 удалено
  1. 1 0
      config/configDefaults.php
  2. 49 8
      functions.php
  3. 101 86
      homepage.php
  4. 1 0
      lang/de.ini
  5. 1 0
      lang/en.ini
  6. 1 0
      lang/es.ini
  7. 1 0
      lang/fr.ini
  8. 1 0
      lang/it.ini
  9. 1 0
      lang/nl.ini
  10. 1 0
      lang/pl.ini
  11. 8 1
      settings.php

+ 1 - 0
config/configDefaults.php

@@ -13,6 +13,7 @@ return array(
 	"plexHomeAuth" => false,
 	"plexSearch" => false,
 	"plexRecentItems" => "20",
+	"plexPlaylists" => "false",
 	"plexTabName" => "",
 	"embyURL" => "",
 	"embyToken" => "",

+ 49 - 8
functions.php

@@ -642,7 +642,7 @@ function resolveEmbyItem($address, $token, $item, $nowPlaying = false, $showName
 		$itemDetails['Overview'] = '';
 	}
     
-if (file_exists('images/cache/'.$key.'.jpg')){ $image_url = 'images/cache/'.$key.'.jpg'; }
+	if (file_exists('images/cache/'.$key.'.jpg')){ $image_url = 'images/cache/'.$key.'.jpg'; }
     if (file_exists('images/cache/'.$key.'.jpg') && (time() - 604800) > filemtime('images/cache/'.$key.'.jpg') || !file_exists('images/cache/'.$key.'.jpg')) {
         $image_url = 'ajax.php?a=emby-image&type='.$imageType.'&img='.$imageId.'&height='.$height.'&width='.$width.'&key='.$key.'';        
     }
@@ -657,12 +657,12 @@ if (file_exists('images/cache/'.$key.'.jpg')){ $image_url = 'images/cache/'.$key
     if(isset($useImage)){ $image_url = $useImage; }
 	
 	// Assemble Item And Cache Into Array     
-if($nowPlaying){
-    //prettyPrint($itemDetails);
-    return '<div class="col-sm-6 col-md-3"><div class="thumbnail ultra-widget"><div style="display: none;" np="'.$id.'" class="overlay content-box small-box gray-bg">'.$streamInfo.'</div><span class="w-refresh w-p-icon gray" link="'.$id.'"><span class="fa-stack fa-lg" style="font-size: .5em"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-info-circle fa-stack-1x fa-inverse"></i></span></span><a href="'.$URL.'" target="_blank"><img style="width: 500px; display:inherit;" src="'.$image_url.'" alt="'.$itemDetails['Name'].'"></a><div class="progress progress-bar-sm zero-m"><div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$watched.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$watched.'%"></div><div class="progress-bar palette-Grey-500 bg" style="width: 0%"></div></div><div class="caption"><i style="float:left" class="fa fa-'.$state.'"></i>'.$topTitle.''.$bottomTitle.'</div></div></div>';
+	if($nowPlaying){
+    	//prettyPrint($itemDetails);
+    	return '<div class="col-sm-6 col-md-3"><div class="thumbnail ultra-widget"><div style="display: none;" np="'.$id.'" class="overlay content-box small-box gray-bg">'.$streamInfo.'</div><span class="w-refresh w-p-icon gray" link="'.$id.'"><span class="fa-stack fa-lg" style="font-size: .5em"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-info-circle fa-stack-1x fa-inverse"></i></span></span><a href="'.$URL.'" target="_blank"><img style="width: 500px; display:inherit;" src="'.$image_url.'" alt="'.$itemDetails['Name'].'"></a><div class="progress progress-bar-sm zero-m"><div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$watched.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$watched.'%"></div><div class="progress-bar palette-Grey-500 bg" style="width: 0%"></div></div><div class="caption"><i style="float:left" class="fa fa-'.$state.'"></i>'.$topTitle.''.$bottomTitle.'</div></div></div>';
     }else{
- return '<div class="item-'.$itemDetails['Type'].'"><a href="'.$URL.'" target="_blank"><img alt="'.$itemDetails['Name'].'" class="'.$image.'" data-lazy="'.$image_url.'"></a><small style="margin-right: 13px" class="elip">'.$title.'</small></div>';
-}
+		 return '<div class="item-'.$itemDetails['Type'].'"><a href="'.$URL.'" target="_blank"><img alt="'.$itemDetails['Name'].'" class="'.$image.'" data-lazy="'.$image_url.'"></a><small style="margin-right: 13px" class="elip">'.$title.'</small></div>';
+	}
 }
 
 // Format item from Plex for Carousel
@@ -881,9 +881,10 @@ function outputRecentAdded($header, $items, $script = false, $array) {
     $hideMenu .= '</ul></div></div>';
     // If None Populate Empty Item
     if (!count($items)) {
-        return '<div id=recentMedia><h5 class="text-center">'.$header.'</h5><p class="text-center">No Media Found</p></div>';
+        return '<div id="recentMedia" class="content-box box-shadow big-box"><h5 class="text-center">'.$header.'</h5><p class="text-center">No Media Found</p></div>';
     }else{
-        return '<div id=recentMedia><h5 style="margin-bottom: -20px" class="text-center">'.$header.'</h5><div class="recentHeader inbox-pagination">'.$hideMenu.'</div><br/><div class="recentItems">'.implode('',$items).'</div></div>'.($script?'<script>'.$script.'</script>':'');
+		$className = str_replace(' ', '', $header);
+        return '<div id="recentMedia" class="content-box box-shadow big-box"><h5 style="margin-bottom: -20px" class="text-center">'.$header.'</h5><div class="recentHeader inbox-pagination '.$className.'">'.$hideMenu.'</div><br/><div class="recentItems" data-name="'.$className.'">'.implode('',$items).'</div></div>'.($script?'<script>'.$script.'</script>':'');
     }
     
 }
@@ -3601,6 +3602,46 @@ function tvdbGet($id){
 	return $api;
 }
 
+function getPlexPlaylists(){
+    $address = qualifyURL(PLEXURL);
+    
+	// Perform API requests
+    $api = @curl_get($address."/playlists?X-Plex-Token=".PLEXTOKEN);
+    $api = simplexml_load_string($api);
+	if (is_array($api) || is_object($api)){
+		if (!$api->head->title){
+			$getServer = simplexml_load_string(@curl_get($address."/?X-Plex-Token=".PLEXTOKEN));
+			if (!$getServer) { return 'Could not load!'; }
+			// Identify the local machine
+			$gotServer = $getServer['machineIdentifier'];
+			$output = "";
+			foreach($api AS $child) {
+				$items = "";
+				if($child['playlistType'] == "video"){
+					$api = @curl_get($address.$child['key']."?X-Plex-Token=".PLEXTOKEN);
+					$api = simplexml_load_string($api);
+					if (is_array($api) || is_object($api)){
+						if (!$api->head->title){
+							foreach($api->Video AS $child){
+								$items[] = resolvePlexItem($gotServer, PLEXTOKEN, $child, false, false,false);
+							}
+							if (count($items)) {
+								$className = str_replace(' ', '', $api['title']);
+								$output .= '<div id="playlist-'.$className.'" class="content-box box-shadow big-box"><h5 style="margin-bottom: -20px" class="text-center">'.$api['title'].'</h5><div class="recentHeader inbox-pagination '.$className.'"></div><br/><div class="recentItems" data-name="'.$className.'">'.implode('',$items).'</div></div>';
+							}							
+						}
+					}
+				}
+			}
+			return $output;
+		}else{
+			writeLog("error", "PLEX PLAYLIST ERROR: could not connect - check token - if HTTPS, is cert valid");
+		}
+	}else{
+		writeLog("error", "PLEX PLAYLIST ERROR: could not connect - check URL - if HTTPS, is cert valid");
+	}
+}
+
 function orgEmail($header = "Message From Admin", $title = "Important Message", $user = "Organizr User", $mainMessage = "", $button = null, $buttonURL = null, $subTitle = "", $subMessage = ""){
 	$path = getServerPath();
 	return '

+ 101 - 86
homepage.php

@@ -444,7 +444,17 @@ $endDate = date('Y-m-d',strtotime("+".CALENDARENDDAY." days"));
                     ?>
                     </div>
                 </div>
-				<?php } ?>
+                <div id="plexPlaylists" class="row">
+                    <div class="col-lg-12">
+                    <?php
+                    if(PLEXPLAYLISTS == "true"){  
+                        echo getPlexPlaylists($plexArray);
+                    } 
+                    ?>
+                    </div>
+                </div>
+                <?php } ?>
+    
 				<?php if (qualifyUser(EMBYHOMEAUTH) && EMBYTOKEN) { ?>
                 <div id="embyRowNowPlaying" class="row">
                     <?php if(EMBYPLAYINGNOW == "true"){ echo getEmbyStreams(12, EMBYSHOWNAMES, $USER->role); } ?>
@@ -564,91 +574,96 @@ $endDate = date('Y-m-d',strtotime("+".CALENDARENDDAY." days"));
                 var id = $(this).attr("link");
                 $("div[np^='"+id+"']").toggle();
             });
-     
-            $('.recentItems').slick({
-              
-                slidesToShow: 13,
-                slidesToScroll: 13,
-                infinite: true,
-                lazyLoad: 'ondemand',
-                prevArrow: '<a class="zero-m pull-left prev-mail btn btn-default waves waves-button btn-sm waves-effect waves-float"><i class="fa fa-angle-left"></i></a>',
-                nextArrow: '<a class="pull-left next-mail btn btn-default waves waves-button btn-sm waves-effect waves-float"><i class="fa fa-angle-right"></i></a>',
-                appendArrows: '.recentHeader',
-                responsive: [
-                {
-                  breakpoint: 1750,
-                  settings: {
-                    slidesToShow: 12,
-                    slidesToScroll: 12,
-                  }
-                },
-                {
-                  breakpoint: 1600,
-                  settings: {
-                    slidesToShow: 11,
-                    slidesToScroll: 11,
-                  }
-                },
-                {
-                  breakpoint: 1450,
-                  settings: {
-                    slidesToShow: 10,
-                    slidesToScroll: 10,
-                  }
-                },
-                {
-                  breakpoint: 1300,
-                  settings: {
-                    slidesToShow: 9,
-                    slidesToScroll: 9,
-                  }
-                },
-                {
-                  breakpoint: 1150,
-                  settings: {
-                    slidesToShow: 8,
-                    slidesToScroll: 8,
-                  }
-                },
-                {
-                  breakpoint: 1000,
-                  settings: {
-                    slidesToShow: 7,
-                    slidesToScroll: 7,
-                  }
-                },
-                {
-                  breakpoint: 850,
-                  settings: {
-                    slidesToShow: 6,
-                    slidesToScroll: 6,
-                  }
-                },
-                {
-                  breakpoint: 700,
-                  settings: {
-                    slidesToShow: 5,
-                    slidesToScroll: 5,
-                  }
-                },
-                {
-                  breakpoint: 675,
-                  settings: {
-                    slidesToShow: 4,
-                    slidesToScroll: 4
-                  }
-                },
-                {
-                  breakpoint: 480,
-                  settings: {
-                    slidesToShow: 3,
-                    slidesToScroll: 3
-                  }
-                }
-                // You can unslick at a given breakpoint now by adding:
-                // settings: "unslick"
-                // instead of a settings object
-              ]
+
+            $('.recentItems').each(function() {
+                var name = $(this).attr("data-name");
+                console.log(name);
+                $(this).slick({
+                
+                    slidesToShow: 13,
+                    slidesToScroll: 13,
+                    infinite: true,
+                    lazyLoad: 'ondemand',
+                    prevArrow: '<a class="zero-m pull-left prev-mail btn btn-default waves waves-button btn-sm waves-effect waves-float"><i class="fa fa-angle-left"></i></a>',
+                    nextArrow: '<a class="pull-left next-mail btn btn-default waves waves-button btn-sm waves-effect waves-float"><i class="fa fa-angle-right"></i></a>',
+                    appendArrows: $('.'+name),
+                    arrows: true,
+                    responsive: [
+                    {
+                    breakpoint: 1750,
+                    settings: {
+                        slidesToShow: 12,
+                        slidesToScroll: 12,
+                    }
+                    },
+                    {
+                    breakpoint: 1600,
+                    settings: {
+                        slidesToShow: 11,
+                        slidesToScroll: 11,
+                    }
+                    },
+                    {
+                    breakpoint: 1450,
+                    settings: {
+                        slidesToShow: 10,
+                        slidesToScroll: 10,
+                    }
+                    },
+                    {
+                    breakpoint: 1300,
+                    settings: {
+                        slidesToShow: 9,
+                        slidesToScroll: 9,
+                    }
+                    },
+                    {
+                    breakpoint: 1150,
+                    settings: {
+                        slidesToShow: 8,
+                        slidesToScroll: 8,
+                    }
+                    },
+                    {
+                    breakpoint: 1000,
+                    settings: {
+                        slidesToShow: 7,
+                        slidesToScroll: 7,
+                    }
+                    },
+                    {
+                    breakpoint: 850,
+                    settings: {
+                        slidesToShow: 6,
+                        slidesToScroll: 6,
+                    }
+                    },
+                    {
+                    breakpoint: 700,
+                    settings: {
+                        slidesToShow: 5,
+                        slidesToScroll: 5,
+                    }
+                    },
+                    {
+                    breakpoint: 675,
+                    settings: {
+                        slidesToShow: 4,
+                        slidesToScroll: 4
+                    }
+                    },
+                    {
+                    breakpoint: 480,
+                    settings: {
+                        slidesToShow: 3,
+                        slidesToScroll: 3
+                    }
+                    }
+                    // You can unslick at a given breakpoint now by adding:
+                    // settings: "unslick"
+                    // instead of a settings object
+                ]
+                });
             });
             
             var movieFiltered = false;

+ 1 - 0
lang/de.ini

@@ -305,3 +305,4 @@ EMAIL_NEWUSER_MESSAGE = "Welcome, to my website.  I have many things here... man
 EMAIL_NEWUSER_BUTTON = "Login"
 EMAIL_NEWUSER_SUBTITLE = "What do I do?"
 EMAIL_NEWUSER_SUBMESSAGE = "Now that you have signed up, you can basically do whatever you like.  Enjoy"
+PLAYLISTS = "Playlists"

+ 1 - 0
lang/en.ini

@@ -305,3 +305,4 @@ EMAIL_NEWUSER_MESSAGE = "Welcome, to my website.  I have many things here... man
 EMAIL_NEWUSER_BUTTON = "Login"
 EMAIL_NEWUSER_SUBTITLE = "What do I do?"
 EMAIL_NEWUSER_SUBMESSAGE = "Now that you have signed up, you can basically do whatever you like.  Enjoy"
+PLAYLISTS = "Playlists"

+ 1 - 0
lang/es.ini

@@ -305,3 +305,4 @@ EMAIL_NEWUSER_MESSAGE = "Welcome, to my website.  I have many things here... man
 EMAIL_NEWUSER_BUTTON = "Login"
 EMAIL_NEWUSER_SUBTITLE = "What do I do?"
 EMAIL_NEWUSER_SUBMESSAGE = "Now that you have signed up, you can basically do whatever you like.  Enjoy"
+PLAYLISTS = "Playlists"

+ 1 - 0
lang/fr.ini

@@ -305,3 +305,4 @@ EMAIL_NEWUSER_MESSAGE = "Welcome, to my website.  I have many things here... man
 EMAIL_NEWUSER_BUTTON = "Login"
 EMAIL_NEWUSER_SUBTITLE = "What do I do?"
 EMAIL_NEWUSER_SUBMESSAGE = "Now that you have signed up, you can basically do whatever you like.  Enjoy"
+PLAYLISTS = "Playlists"

+ 1 - 0
lang/it.ini

@@ -305,3 +305,4 @@ EMAIL_NEWUSER_MESSAGE = "Welcome, to my website.  I have many things here... man
 EMAIL_NEWUSER_BUTTON = "Login"
 EMAIL_NEWUSER_SUBTITLE = "What do I do?"
 EMAIL_NEWUSER_SUBMESSAGE = "Now that you have signed up, you can basically do whatever you like.  Enjoy"
+PLAYLISTS = "Playlists"

+ 1 - 0
lang/nl.ini

@@ -305,3 +305,4 @@ EMAIL_NEWUSER_MESSAGE = "Welcome, to my website.  I have many things here... man
 EMAIL_NEWUSER_BUTTON = "Login"
 EMAIL_NEWUSER_SUBTITLE = "What do I do?"
 EMAIL_NEWUSER_SUBMESSAGE = "Now that you have signed up, you can basically do whatever you like.  Enjoy"
+PLAYLISTS = "Playlists"

+ 1 - 0
lang/pl.ini

@@ -305,3 +305,4 @@ EMAIL_NEWUSER_MESSAGE = "Welcome, to my website.  I have many things here... man
 EMAIL_NEWUSER_BUTTON = "Login"
 EMAIL_NEWUSER_SUBTITLE = "What do I do?"
 EMAIL_NEWUSER_SUBMESSAGE = "Now that you have signed up, you can basically do whatever you like.  Enjoy"
+PLAYLISTS = "Playlists"

+ 8 - 1
settings.php

@@ -146,7 +146,7 @@ if(SLIMBAR == "true") {
 				});
 				$element.appendTo('#submitTabs ul');
 				$element.find('.icp-auto-pend').iconpicker({placement: 'left', hideOnSelect: false, collision: true}).hide();
-    $('.tab-box').scrollTop($('.tab-box')[0].scrollHeight);
+                $('.tab-box').scrollTop($('.tab-box')[0].scrollHeight);
 			}
 			function submitTabs(form) {
 				var formData = {};
@@ -768,6 +768,12 @@ echo buildSettings(
 							'name' => 'plexRecentMusic',
 							'value' => PLEXRECENTMUSIC,
 						),
+                        array(
+							'type' => 'checkbox',
+							'labelTranslate' => 'PLAYLISTS',
+							'name' => 'plexPlaylists',
+							'value' => PLEXPLAYLISTS,
+						),
 						array(
 							'type' => 'checkbox',
 							'labelTranslate' => 'PLAYING_NOW',
@@ -1360,6 +1366,7 @@ echo buildSettings(
 						array(
 							'type' => 'button',
 							'id' => 'gitForceInstall',
+                            'style' => (extension_loaded("ZIP")) ? "" : "display : none",
 							'labelTranslate' => 'GIT_FORCE',
 							'icon' => 'gear',
 							'onclick' => 'if ($(\'#git_branch_id[data-changed]\').length) { alert(\'Branch was altered, save settings first!\') } else { if (confirm(\''.translate('GIT_FORCE_CONFIRM').'\')) { performUpdate(); ajax_request(\'POST\', \'forceBranchInstall\'); } }',