Explorar el Código

added couchpotato

causefx hace 8 años
padre
commit
17e4406093

+ 6 - 1
api/config/default.php

@@ -35,6 +35,8 @@ return array(
 	'sonarrToken' => '',
     'radarrURL' => '',
 	'radarrToken' => '',
+	'couchpotatoURL' => '',
+	'couchpotatoToken' => '',
     'sickrageURL' => '',
 	'sickrageToken' => '',
 	'sabnzbdURL' => '',
@@ -56,6 +58,8 @@ return array(
     'homepageSabnzbdAuth' => '1',
 	'homepageSonarrEnabled' => false,
     'homepageSonarrAuth' => '1',
+    'homepageCouchpotatoEnabled' => false,
+    'homepageCouchpotatoAuth' => '1',
     'homepageSickrageEnabled' => false,
     'homepageSickrageAuth' => '1',
     'homepageRadarrEnabled' => false,
@@ -104,5 +108,6 @@ return array(
     'calendarStart' => '14',
     'calendarEnd' => '14',
     'calendarRefresh' => '60000',
-    'calendarTimeFormat' => 'h(:mm)t'
+    'calendarTimeFormat' => 'h(:mm)t',
+    'calendarLimit' => false
 );

+ 52 - 0
api/functions/homepage-connect-functions.php

@@ -737,6 +737,29 @@ function getCalendar(){
             }
         }
     }
+	// COUCHPOTATO CONNECT
+    if($GLOBALS['homepageCouchpotatoEnabled'] && qualifyRequest($GLOBALS['homepageCouchpotatoAuth']) && !empty($GLOBALS['couchpotatoURL']) && !empty($GLOBALS['couchpotatoToken'])){
+        $couchs = array();
+        $couchpotatoURLList = explode(',', $GLOBALS['couchpotatoURL']);
+        $couchpotatoTokenList = explode(',', $GLOBALS['couchpotatoToken']);
+        if(count($couchpotatoURLList) == count($couchpotatoTokenList)){
+            foreach ($couchpotatoURLList as $key => $value) {
+                $couchs[$key] = array(
+                    'url' => $value,
+                    'token' => $couchpotatoTokenList[$key]
+                );
+            }
+            foreach ($couchs as $key => $value) {
+                try {
+                    $couchpotato = new Kryptonit3\CouchPotato\CouchPotato($value['url'], $value['token']);
+        			$couchCalendar = getCouchCalendar($couchpotato->getMediaList(),$key);
+        			if(!empty($couchCalendar)) { $calendarItems = array_merge($calendarItems, $couchCalendar); }
+        		} catch (Exception $e) {
+        			writeLog('error', 'Sickrage Connect Function - Error: '.$e->getMessage(), 'SYSTEM');
+        		}
+            }
+        }
+    }
 
 
 	return ($calendarItems) ? $calendarItems : false;
@@ -795,6 +818,35 @@ function getRadarrCalendar($array,$number){
     }
     if ($i != 0){ return $gotCalendar; }
 }
+function getCouchCalendar($array,$number){
+    $api = json_decode($array, true);
+    $gotCalendar = array();
+    $i = 0;
+	foreach($api['movies'] AS $child) {
+		if($child['status'] == "active" || $child['status'] == "done" ){
+			$i++;
+			$movieName = $child['info']['original_title'];
+			$movieID = $child['info']['tmdb_id'];
+			if(!isset($movieID)){ $movieID = ""; }
+			$physicalRelease = (isset($child['info']['released']) ? $child['info']['released'] : null);
+			$backupRelease = (isset($child['info']['release_date']['theater']) ? $child['info']['release_date']['theater'] : null);
+			$physicalRelease = (isset($physicalRelease) ? $physicalRelease : $backupRelease);
+			$physicalRelease = strtotime($physicalRelease);
+			$physicalRelease = date("Y-m-d", $physicalRelease);
+			if (new DateTime() < new DateTime($physicalRelease)) { $notReleased = "true"; }else{ $notReleased = "false"; }
+			$downloaded = ($child['status'] == "active") ? "0" : "1";
+			if($downloaded == "0" && $notReleased == "true"){ $downloaded = "bg-info"; }elseif($downloaded == "1"){ $downloaded = "bg-success"; }else{ $downloaded = "bg-danger"; }
+			array_push($gotCalendar, array(
+				"id" => "CouchPotato-".$number."-".$i,
+				"title" => $movieName,
+				"start" => $physicalRelease,
+				"className" => $downloaded." movieID--".$movieID,
+				"imagetype" => "film",
+			));
+		}
+	}
+	if ($i != 0){ return $gotCalendar; }
+}
 function getSickrageCalendarWanted($array,$number){
     $array = json_decode($array, true);
     $gotCalendar = array();

+ 92 - 0
api/functions/homepage-functions.php

@@ -819,6 +819,12 @@ function getHomepageList(){
                         'label' => 'Time Format',
                         'value' => $GLOBALS['calendarTimeFormat'],
                         'options' => $timeFormat
+                    ),
+					array(
+                        'type' => 'switch',
+                        'name' => 'calendarLimit',
+                        'label' => 'Limit Entries',
+                        'value' => $GLOBALS['calendarLimit']
                     ),
                     array(
                         'type' => 'select',
@@ -901,6 +907,86 @@ function getHomepageList(){
                         'label' => 'Time Format',
                         'value' => $GLOBALS['calendarTimeFormat'],
                         'options' => $timeFormat
+                    ),
+					array(
+                        'type' => 'switch',
+                        'name' => 'calendarLimit',
+                        'label' => 'Limit Entries',
+                        'value' => $GLOBALS['calendarLimit']
+                    ),
+                    array(
+                        'type' => 'select',
+                        'name' => 'calendarRefresh',
+                        'label' => 'Refresh Seconds',
+                        'value' => $GLOBALS['calendarRefresh'],
+                        'options' => $time
+                    )
+                )
+            )
+        ),
+		array(
+            'name' => 'CouchPotato',
+            'enabled' => false,
+            'image' => 'plugins/images/tabs/couchpotato.png',
+            'category' => 'PVR',
+            'settings' => array(
+                'Enable' => array(
+                    array(
+                        'type' => 'switch',
+                        'name' => 'homepageCouchpotatoEnabled',
+                        'label' => 'Enable',
+                        'value' => $GLOBALS['homepageCouchpotatoEnabled']
+                    ),
+                    array(
+                        'type' => 'select',
+                        'name' => 'homepageCouchpotatoAuth',
+                        'label' => 'Minimum Authentication',
+                        'value' => $GLOBALS['homepageCouchpotatoAuth'],
+                        'options' => $groups
+                    )
+                ),
+                'Connection' => array(
+                    array(
+                        'type' => 'input',
+                        'name' => 'couchpotatoURL',
+                        'label' => 'URL',
+                        'value' => $GLOBALS['couchpotatoURL'],
+                        'placeholder' => 'http(s)://hostname:port'
+                    ),
+                    array(
+                        'type' => 'input',
+                        'name' => 'couchpotatoToken',
+                        'label' => 'Token',
+                        'value' => $GLOBALS['couchpotatoToken']
+                    )
+                ),
+                'Misc Options' => array(
+					array(
+                        'type' => 'select',
+                        'name' => 'calendarFirstDay',
+                        'label' => 'Start Day',
+                        'value' => $GLOBALS['calendarFirstDay'],
+                        'options' => $day
+                    ),
+					array(
+                        'type' => 'select',
+                        'name' => 'calendarDefault',
+                        'label' => 'Default View',
+                        'value' => $GLOBALS['calendarDefault'],
+                        'options' => $calendarDefault
+                    ),
+					array(
+                        'type' => 'select',
+                        'name' => 'calendarTimeFormat',
+                        'label' => 'Time Format',
+                        'value' => $GLOBALS['calendarTimeFormat'],
+                        'options' => $timeFormat
+                    ),
+					array(
+                        'type' => 'switch',
+                        'name' => 'calendarLimit',
+                        'label' => 'Limit Entries',
+                        'value' => $GLOBALS['calendarLimit']
                     ),
                     array(
                         'type' => 'select',
@@ -969,6 +1055,12 @@ function getHomepageList(){
                         'label' => 'Time Format',
                         'value' => $GLOBALS['calendarTimeFormat'],
                         'options' => $timeFormat
+                    ),
+					array(
+                        'type' => 'switch',
+                        'name' => 'calendarLimit',
+                        'label' => 'Limit Entries',
+                        'value' => $GLOBALS['calendarLimit']
                     ),
                     array(
                         'type' => 'select',

+ 1 - 0
api/pages/homepage.php

@@ -38,6 +38,7 @@ $pageHomepage = '
             editable: false,
             droppable: false, // this allows things to be dropped onto the calendar !!!
             eventLimit: false, // allow "more" link when too many events
+            //eventLimit: tof("'.$GLOBALS['calendarLimit'].'","b"), // allow "more" link when too many events
             selectable: false,
             height: "auto",
             eventRender: function eventRender( event, element, view ) {

+ 1 - 1
index.php

@@ -132,7 +132,7 @@
     <script src="plugins/bower_components/jquery-asColorPicker-master/dist/jquery-asColorPicker.min.js"></script>
 	<script src="plugins/bower_components/dropzone-master/dist/dropzone.js"></script>
 	<script src="plugins/bower_components/owl.carousel/owl.carousel.min.js"></script>
-	<script src='plugins/bower_components/calendar/dist/fullcalendar.js'></script>
+	<script src="plugins/bower_components/calendar/dist/fullcalendar.js"></script>
 	<script src="js/functions.js?v=<?php echo $GLOBALS['installedVersion']; ?>"></script>
 	<script src="js/custom.js?v=<?php echo $GLOBALS['installedVersion']; ?>"></script>
 	<?php echo pluginFiles('js'); ?>

+ 1 - 1
js/functions.js

@@ -1971,7 +1971,7 @@ function buildRecent(array, type){
         <div class="col-lg-12">
             <div class="panel panel-default">
                 <div class="panel-heading bg-info p-t-10 p-b-10">
-					<span class="pull-left m-t-5" lang="en">Recently Added to `+toUpper(type)+`</span>
+					<span class="pull-left m-t-5" lang="en"><img class="lazyload homepageImageTitle" data-src="plugins/images/tabs/`+type+`.png"> &nbsp; Recently Added</span>
 					<div class="btn-group pull-right">
 	                    <button aria-expanded="false" data-toggle="dropdown" class="btn btn-info dropdown-toggle waves-effect waves-light" type="button">
 							<i class="fa fa-filter m-r-5"></i><span class="caret"></span>

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
plugins/bower_components/calendar/dist/fullcalendar.min.css


Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio