Browse Source

Merge pull request #180 from causefx/develop

Develop
causefx 9 years ago
parent
commit
a1ebdc5940
12 changed files with 299 additions and 68 deletions
  1. 109 0
      functions.php
  2. 52 40
      homepage.php
  3. BIN
      images/rsscrawler.png
  4. 27 21
      lang/de.ini
  5. 7 1
      lang/en.ini
  6. 7 1
      lang/es.ini
  7. 7 1
      lang/fr.ini
  8. 7 1
      lang/it.ini
  9. 7 1
      lang/nl.ini
  10. 7 1
      lang/pl.ini
  11. 62 0
      settings.php
  12. 7 1
      user.php

+ 109 - 0
functions.php

@@ -507,6 +507,7 @@ function nzbgetConnect($url, $port, $username, $password, $list){
 
                                 <div class="progress-bar progress-bar-'.$downloadHealth.' '.$progressBar.'" role="progressbar" aria-valuenow="'.$downloadPercent.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$downloadPercent.'%">
 
+                                    <p class="text-center">'.round($downloadPercent).'%</p>
                                     <span class="sr-only">'.$downloadPercent.'% Complete</span>
 
                                 </div>
@@ -521,8 +522,116 @@ function nzbgetConnect($url, $port, $username, $password, $list){
     }
     
     if($i > 0){ return $gotNZB; }
+    if($i == 0){ echo '<tr><td colspan="4"><p class="text-center">No Results</p></td></tr>'; }
 
 }
 
+function sabnzbdConnect($url, $port, $key, $list){
+    
+    $urlCheck = stripos($url, "http");
+
+    if ($urlCheck === false) {
+        
+        $url = "http://" . $url;
+    
+    }
+    
+    if($port !== ""){ $url = $url . ":" . $port; }
+    
+    $address = $url;
+
+    $api = file_get_contents("$url/api?mode=$list&output=json&apikey=$key");
+                    
+    $api = json_decode($api, true);
+    
+    $i = 0;
+    
+    $gotNZB = "";
+    
+    foreach ($api[$list]['slots'] AS $child) {
+        
+        $i++;
+        if($list == "queue"){ $downloadName = $child['filename']; $downloadCategory = $child['cat']; $downloadPercent = (($child['mb'] - $child['mbleft']) / $child['mb']) * 100; $progressBar = "progress-bar-striped active"; } 
+        if($list == "history"){ $downloadName = $child['name']; $downloadCategory = $child['category']; $downloadPercent = "100"; $progressBar = ""; }
+        $downloadStatus = $child['status'];
+        //echo '<pre>' . var_export($child, true) . '</pre>';
 
+
+        
+        $gotNZB .= '<tr>
+
+                        <td>'.$downloadName.'</td>
+                        <td>'.$downloadStatus.'</td>
+                        <td>'.$downloadCategory.'</td>
+
+                        <td>
+
+                            <div class="progress">
+
+                                <div class="progress-bar progress-bar-success '.$progressBar.'" role="progressbar" aria-valuenow="'.$downloadPercent.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$downloadPercent.'%">
+
+                                    <p class="text-center">'.round($downloadPercent).'%</p>
+                                    <span class="sr-only">'.$downloadPercent.'% Complete</span>
+
+                                </div>
+
+                            </div>
+
+                        </td>
+
+                    </tr>';
+        
+        
+    }
+    
+    if($i > 0){ return $gotNZB; }
+    if($i == 0){ echo '<tr><td colspan="4"><p class="text-center">No Results</p></td></tr>'; }
+
+}
+
+function getHeadphonesCalendar($url, $port, $key, $list){
+
+    $urlCheck = stripos($url, "http");
+
+    if ($urlCheck === false) {
+        
+        $url = "http://" . $url;
+    
+    }
+    
+    if($port !== ""){ $url = $url . ":" . $port; }
+    
+    $address = $url;
+    
+    $api = file_get_contents($address."/api?apikey=".$key."&cmd=$list");
+                    
+    $api = json_decode($api, true);
+    
+    $i = 0;
+    
+    $gotCalendar = "";
+
+    foreach($api AS $child) {
+        
+        //echo '<pre>' . var_export($child, true) . '</pre>';
+
+        if($child['Status'] != "Skipped"){
+        
+            $i++;
+            $albumName = $child['AlbumTitle'];
+            $albumArtist = $child['ArtistName'];
+            $albumDate = $child['ReleaseDate'];
+            $albumStatus = $child['Status'];
+
+            if($albumStatus == "Wanted"){ $albumStatus = "red-bg";}elseif($albumStatus == "Downloaded"){ $albumStatus = "green-bg";}
+
+            $gotCalendar .= "{ title: \"$albumArtist - $albumName\", start: \"$albumDate\", className: \"$albumStatus\", imagetype: \"music\" }, \n";
+            
+        }
+        
+    }
+
+    if ($i != 0){ return $gotCalendar; }
+
+}
 ?>

+ 52 - 40
homepage.php

@@ -184,8 +184,8 @@ endif; ?>
             <div id="content" class="container-fluid">
                 
                 <br>
-                <?php if(NZBGETURL != "") : ?>
-                <div class="row">
+                <?php if(NZBGETURL != "" || SABNZBDURL != "") : ?>
+                <div id="downloadClientRow" class="row">
 
                     <div class="col-md-12">
 
@@ -193,7 +193,7 @@ endif; ?>
 
                             <div class="panel-heading">
 
-                                <h3 class="pull-left">NZBGet</h3>
+                                <h3 class="pull-left"><?php if(NZBGETURL != ""){ echo "NZBGet "; } if(SABNZBDURL != ""){ echo "SABnzbd "; } ?></h3>
 
                                 <ul class="nav nav-tabs pull-right">
 
@@ -231,7 +231,8 @@ endif; ?>
                                                     </thead>
 
                                                     <tbody>
-                <?php echo nzbgetConnect(NZBGETURL, NZBGETPORT, NZBGETUSERNAME, NZBGETPASSWORD, "listgroups");?>                                   
+                <?php if(NZBGETURL != ""){ echo nzbgetConnect(NZBGETURL, NZBGETPORT, NZBGETUSERNAME, NZBGETPASSWORD, "listgroups"); }?>                                   
+                <?php if(SABNZBDURL != ""){ echo sabnzbdConnect(SABNZBDURL, SABNZBDPORT, SABNZBDKEY, "queue"); }?>                                   
 
                                                     </tbody>
 
@@ -261,7 +262,8 @@ endif; ?>
                                                 </thead>
 
                                                 <tbody>
-            <?php echo nzbgetConnect(NZBGETURL, NZBGETPORT, NZBGETUSERNAME, NZBGETPASSWORD, "history");?>                                        
+            <?php if(NZBGETURL != ""){ echo nzbgetConnect(NZBGETURL, NZBGETPORT, NZBGETUSERNAME, NZBGETPASSWORD, "history"); }?>  
+            <?php if(SABNZBDURL != ""){ echo sabnzbdConnect(SABNZBDURL, SABNZBDPORT, SABNZBDKEY, "history"); }?>                                        
 
                                                 </tbody>
 
@@ -282,7 +284,7 @@ endif; ?>
                 </div>
                 <?php endif; ?>
 
-                <div class="row">
+                <div id="plexRow" class="row">
 
                     <?php
                     $plexSize = 0;
@@ -301,7 +303,7 @@ endif; ?>
                 </div>
                 
                 <?php if(SONARRURL != "" || RADARRURL != "") : ?>
-                <div class="row" style="padding: 0 0 10px 0;">
+                <div id="calendarLegendRow" class="row" style="padding: 0 0 10px 0;">
                     
                     <div class="col-lg-4">
                     
@@ -314,7 +316,7 @@ endif; ?>
                     
                 </div>
                 
-                <div class="row">
+                <div id="calendarRow" class="row">
         
                     <div class="col-lg-12">
                     
@@ -374,41 +376,51 @@ endif; ?>
         </script>
         <?php if(SONARRURL != "" || RADARRURL != "") : ?>
         <script>
+            
             $(function () {
 
-              /* initialize the calendar */
-              var date = new Date();
-              var d = date.getDate();
-              var m = date.getMonth();
-              var y = date.getFullYear();
-              $('#calendar').fullCalendar({
-                  eventLimit: false, 
-                  height: "auto",
-                  //defaultDate: '2017-03-21',
-			      defaultView: 'basicWeek',
-                header: {
-                  left: 'prev,next,',
-                  center: 'title',
-                  right: 'today, month, basicDay,basicWeek,'
-                },
-                views: {
-                    basicDay: { buttonText: '<?php echo $language->translate("DAY");?>', eventLimit: false },
-                    basicWeek: { buttonText: '<?php echo $language->translate("WEEK");?>', eventLimit: false },
-                    month: { buttonText: '<?php echo $language->translate("MONTH");?>', eventLimit: false },
-                    today: { buttonText: '<?php echo $language->translate("TODAY");?>' },
-                },
-                events: [
-
-<?php if(SONARRURL != ""){ echo getSonarrCalendar(SONARRURL, SONARRPORT,SONARRKEY); } ?>
-<?php if(RADARRURL != ""){ echo getRadarrCalendar(RADARRURL, RADARRPORT,RADARRKEY); } ?>                    
-
-                  ],
-
-                editable: false,
-                droppable: false,
-
-              });
+                var date = new Date();
+                var d = date.getDate();
+                var m = date.getMonth();
+                var y = date.getFullYear();
+
+                $('#calendar').fullCalendar({
+                    
+                    eventLimit: false, 
+                  
+                    height: "auto",
+                    defaultView: 'basicWeek',
+                
+                    header: {
+                  
+                        left: 'prev,next,',
+                        center: 'title',
+                        right: 'today, month, basicDay,basicWeek,'
+                
+                    },
+                
+                    views: {
+                    
+                        basicDay: { buttonText: '<?php echo $language->translate("DAY");?>', eventLimit: false },
+                        basicWeek: { buttonText: '<?php echo $language->translate("WEEK");?>', eventLimit: false },
+                        month: { buttonText: '<?php echo $language->translate("MONTH");?>', eventLimit: false },
+                        today: { buttonText: '<?php echo $language->translate("TODAY");?>' },
+                
+                    },
+                
+                    events: [
+<?php if(SONARRURL != ""){ echo getSonarrCalendar(SONARRURL, SONARRPORT, SONARRKEY); } ?>
+<?php if(RADARRURL != ""){ echo getRadarrCalendar(RADARRURL, RADARRPORT, RADARRKEY); } ?>                    
+<?php if(HEADPHONESURL != ""){ echo getHeadphonesCalendar(HEADPHONESURL, HEADPHONESPORT, HEADPHONESKEY, "getUpcoming"); echo getHeadphonesCalendar(HEADPHONESURL, HEADPHONESPORT, HEADPHONESKEY, "getWanted"); } ?>                                
+                    ],
+
+                    editable: false,
+                    droppable: false,
+
+                });
+            
             });
+        
         </script>
         <?php endif; ?>
 

BIN
images/rsscrawler.png


+ 27 - 21
lang/de.ini

@@ -148,7 +148,7 @@ TRANSLATIONS = "Übersetzungen"
 TRANSLATIONS_ABOUT = "Wir benötigen immer Hilfe bei der Übersetzung. Sollten Sie eine andere Sprache als Englisch sprechen, so helfen Sie uns bitte, wenn Sie können. Wenn Sie bereit sind zu helfen, gehen Sie auf Github und bieten dort Ihre Hilfe an."
 UPGRADE = "Upgrade"
 LOADING_COLOR = "Hintergrund Ladebildschirm"
-HOVER_TEXT = "Hover Text"
+HOVER_TEXT = "Einblendungs-Text"
 COOKIE_PASSWORD = "Cookie-Passwort"
 CREATE_USER = "Konto registrieren"
 ENTER_PASSWORD_TO_REGISTER = "Registrierungspasswort eingeben"
@@ -169,34 +169,40 @@ SHOW_LESS = "Weniger zeigen"
 EDIT_CUSTOM_CSS = "Eigenes CSS"
 CUSTOM_COMPLETE = "EIGENES CSS GESPEICHERT!"
 SAVE_CSS = "CSS speichern"
-MENU = "Menu"
+MENU = "Menü"
 GRAVATAR = "Gravatar"
 PLEX_URL = "Plex URL"
 PLEX_PORT = "Plex Port"
 PLEX_TOKEN = "Plex Token"
-RECENT_MOVIES = "Recent Movies"
-RECENT_TV = "Recent TV"
-RECENT_MUSIC = "Recent Music"
-PLAYING_NOW = "Playing Now"
-PLAYING_NOW_ON_PLEX = "Playing Now on PLEX"
-RECENTLY_ADDED_TO_PLEX = "Recently Added to PLEX"
-MOVIES = "Movies"
-TV_SHOWS = "TV Shows"
-MUSIC = "Music"
+RECENT_MOVIES = "Aktuelle Filme"
+RECENT_TV = "Aktuelle Serien"
+RECENT_MUSIC = "Aktuelle Musik"
+PLAYING_NOW = "Aktuell läuft"
+PLAYING_NOW_ON_PLEX = "Aktuell läuft auf PLEX"
+RECENTLY_ADDED_TO_PLEX = "Zuletzt zu PLEX hinzugefügt"
+MOVIES = "Filme"
+TV_SHOWS = "Serien"
+MUSIC = "Musik"
 SONARR_URL = "Sonarr URL"
 SONARR_PORT = "Sonarr Port"
-SONARR_KEY = "Sonarr API Key"
+SONARR_KEY = "Sonarr API Schlüssel"
 RADARR_URL = "Radarr URL"
 RADARR_PORT = "Radarr Port"
-RADARR_KEY = "Radarr API Key"
-MONTH = "Month"
-DAY = "Day"
-WEEK = "Week"
+RADARR_KEY = "Radarr API Schlüssel"
+MONTH = "Monat"
+DAY = "Tag"
+WEEK = "Woche"
 NZBGET_URL = "NZBGet URL"
 NZBGET_PORT = "NZBGet Port"
-QUEUE = "Queue"
-HISTORY = "History"
-FILE = "File"
+QUEUE = "Warteschlange"
+HISTORY = "Historie"
+FILE = "Datei"
 STATUS = "Status"
-CATEGORY = "Category"
-PROGRESS = "Progress"
+CATEGORY = "Kategorie"
+PROGRESS = "Fortschritt"
+SABNZBD_URL = "SABnzbd URL"
+SABNZBD_PORT = "SABnzbd Port"
+SABNZBD_KEY = "SABnzbd API Key"
+HEADPHONES_URL = "Headphones URL"
+HEADPHONES_PORT = "Headphones Port"
+HEADPHONES_KEY = "Headphones API Key"

+ 7 - 1
lang/en.ini

@@ -199,4 +199,10 @@ HISTORY = "History"
 FILE = "File"
 STATUS = "Status"
 CATEGORY = "Category"
-PROGRESS = "Progress"
+PROGRESS = "Progress"
+SABNZBD_URL = "SABnzbd URL"
+SABNZBD_PORT = "SABnzbd Port"
+SABNZBD_KEY = "SABnzbd API Key"
+HEADPHONES_URL = "Headphones URL"
+HEADPHONES_PORT = "Headphones Port"
+HEADPHONES_KEY = "Headphones API Key"

+ 7 - 1
lang/es.ini

@@ -199,4 +199,10 @@ HISTORY = "History"
 FILE = "File"
 STATUS = "Status"
 CATEGORY = "Category"
-PROGRESS = "Progress"
+PROGRESS = "Progress"
+SABNZBD_URL = "SABnzbd URL"
+SABNZBD_PORT = "SABnzbd Port"
+SABNZBD_KEY = "SABnzbd API Key"
+HEADPHONES_URL = "Headphones URL"
+HEADPHONES_PORT = "Headphones Port"
+HEADPHONES_KEY = "Headphones API Key"

+ 7 - 1
lang/fr.ini

@@ -199,4 +199,10 @@ HISTORY = "History"
 FILE = "File"
 STATUS = "Status"
 CATEGORY = "Category"
-PROGRESS = "Progress"
+PROGRESS = "Progress"
+SABNZBD_URL = "SABnzbd URL"
+SABNZBD_PORT = "SABnzbd Port"
+SABNZBD_KEY = "SABnzbd API Key"
+HEADPHONES_URL = "Headphones URL"
+HEADPHONES_PORT = "Headphones Port"
+HEADPHONES_KEY = "Headphones API Key"

+ 7 - 1
lang/it.ini

@@ -199,4 +199,10 @@ HISTORY = "History"
 FILE = "File"
 STATUS = "Status"
 CATEGORY = "Category"
-PROGRESS = "Progress"
+PROGRESS = "Progress"
+SABNZBD_URL = "SABnzbd URL"
+SABNZBD_PORT = "SABnzbd Port"
+SABNZBD_KEY = "SABnzbd API Key"
+HEADPHONES_URL = "Headphones URL"
+HEADPHONES_PORT = "Headphones Port"
+HEADPHONES_KEY = "Headphones API Key"

+ 7 - 1
lang/nl.ini

@@ -199,4 +199,10 @@ HISTORY = "History"
 FILE = "File"
 STATUS = "Status"
 CATEGORY = "Category"
-PROGRESS = "Progress"
+PROGRESS = "Progress"
+SABNZBD_URL = "SABnzbd URL"
+SABNZBD_PORT = "SABnzbd Port"
+SABNZBD_KEY = "SABnzbd API Key"
+HEADPHONES_URL = "Headphones URL"
+HEADPHONES_PORT = "Headphones Port"
+HEADPHONES_KEY = "Headphones API Key"

+ 7 - 1
lang/pl.ini

@@ -199,4 +199,10 @@ HISTORY = "History"
 FILE = "File"
 STATUS = "Status"
 CATEGORY = "Category"
-PROGRESS = "Progress"
+PROGRESS = "Progress"
+SABNZBD_URL = "SABnzbd URL"
+SABNZBD_PORT = "SABnzbd Port"
+SABNZBD_KEY = "SABnzbd API Key"
+HEADPHONES_URL = "Headphones URL"
+HEADPHONES_PORT = "Headphones Port"
+HEADPHONES_KEY = "Headphones API Key"

+ 62 - 0
settings.php

@@ -1335,6 +1335,18 @@ endif; ?>
                                                             <a href="#tab-nzbget" data-toggle="tab" aria-expanded="false"><img style="height:40px; width:40px;" src="images/nzbget.png"></a>
 
                                                         </li>
+                                                        
+                                                        <li class="apps ">
+
+                                                            <a href="#tab-sabnzbd" data-toggle="tab" aria-expanded="false"><img style="height:40px; width:40px;" src="images/sabnzbd.png"></a>
+
+                                                        </li>
+                                                        
+                                                        <li class="apps ">
+
+                                                            <a href="#tab-headphones" data-toggle="tab" aria-expanded="false"><img style="height:40px; width:40px;" src="images/headphones.png"></a>
+
+                                                        </li>
 
                                                     </ul>
 
@@ -1488,6 +1500,56 @@ endif; ?>
                                                             </div>
 
                                                         </div>
+                                                        
+                                                        <div class="tab-pane big-box fade" id="tab-sabnzbd">
+
+                                                            <div class="form-group">
+
+                                                                <input type="text" class="form-control material input-sm" name="sabnzbdURL" placeholder="<?php echo $language->translate("SABNZBD_URL");?>" autocorrect="off" autocapitalize="off" value="<?php echo SABNZBDURL;?>">
+                                                                <p class="help-text"><?php echo $language->translate("SABNZBD_URL");?></p>
+
+                                                            </div>
+
+                                                            <div class="form-group">
+
+                                                                <input type="text" class="form-control material input-sm" name="nzbgetPort" placeholder="<?php echo $language->translate("SABNZBD_PORT");?>" autocorrect="off" autocapitalize="off" value="<?php echo SABNZBDPORT;?>">
+                                                                <p class="help-text"><?php echo $language->translate("SABNZBD_PORT");?></p>
+
+                                                            </div>
+
+                                                            <div class="form-group">
+
+                                                                <input type="text" class="form-control material input-sm" name="sabnzbdKey" placeholder="<?php echo $language->translate("SABNZBD_KEY");?>" autocorrect="off" autocapitalize="off" value="<?php echo SABNZBDKEY;?>">
+                                                                <p class="help-text"><?php echo $language->translate("SABNZBD_KEY");?></p>
+
+                                                            </div>
+
+                                                        </div>
+                                                        
+                                                        <div class="tab-pane big-box fade" id="tab-headphones">
+
+                                                            <div class="form-group">
+
+                                                                <input type="text" class="form-control material input-sm" name="headphonesURL" placeholder="<?php echo $language->translate("HEADPHONES_URL");?>" autocorrect="off" autocapitalize="off" value="<?php echo HEADPHONESURL;?>">
+                                                                <p class="help-text"><?php echo $language->translate("HEADPHONES_URL");?></p>
+
+                                                            </div>
+
+                                                            <div class="form-group">
+
+                                                                <input type="text" class="form-control material input-sm" name="headphonesPort" placeholder="<?php echo $language->translate("HEADPHONES_PORT");?>" autocorrect="off" autocapitalize="off" value="<?php echo HEADPHONESPORT;?>">
+                                                                <p class="help-text"><?php echo $language->translate("HEADPHONES_PORT");?></p>
+
+                                                            </div>
+
+                                                            <div class="form-group">
+
+                                                                <input type="text" class="form-control material input-sm" name="headphonesKey" placeholder="<?php echo $language->translate("HEADPHONES_KEY");?>" autocorrect="off" autocapitalize="off" value="<?php echo HEADPHONESKEY;?>">
+                                                                <p class="help-text"><?php echo $language->translate("HEADPHONES_KEY");?></p>
+
+                                                            </div>
+
+                                                        </div>
 
                                                     </div>
    

+ 7 - 1
user.php

@@ -8,7 +8,7 @@
 	 * salting subsequent password checks.
 	 */
     
-    define('INSTALLEDVERSION', '1.18');
+    define('INSTALLEDVERSION', '1.20');
 
     $databaseConfig = parse_ini_file('databaseLocation.ini.php', true);
     define('USER_HOME', $databaseConfig['databaseLocation'] . '/users/');
@@ -45,6 +45,12 @@
     if(!empty($homepageConfig['nzbgetPort'])) : define('NZBGETPORT', $homepageConfig['nzbgetPort']); else : define('NZBGETPORT', ''); endif;
     if(!empty($homepageConfig['nzbgetUsername'])) : define('NZBGETUSERNAME', $homepageConfig['nzbgetUsername']); else : define('NZBGETUSERNAME', ''); endif;
     if(!empty($homepageConfig['nzbgetPassword'])) : define('NZBGETPASSWORD', $homepageConfig['nzbgetPassword']); else : define('NZBGETPASSWORD', ''); endif;
+    if(!empty($homepageConfig['sabnzbdKey'])) : define('SABNZBDKEY', $homepageConfig['sabnzbdKey']); else : define('SABNZBDKEY', ''); endif;
+    if(!empty($homepageConfig['sabnzbdURL'])) : define('SABNZBDURL', $homepageConfig['sabnzbdURL']); else : define('SABNZBDURL', ''); endif;
+    if(!empty($homepageConfig['sabnzbdPort'])) : define('SABNZBDPORT', $homepageConfig['sabnzbdPort']); else : define('SABNZBDPORT', ''); endif;
+    if(!empty($homepageConfig['headphonesKey'])) : define('HEADPHONESKEY', $homepageConfig['headphonesKey']); else : define('HEADPHONESKEY', ''); endif;
+    if(!empty($homepageConfig['headphonesURL'])) : define('HEADPHONESURL', $homepageConfig['headphonesURL']); else : define('HEADPHONESURL', ''); endif;
+    if(!empty($homepageConfig['headphonesPort'])) : define('HEADPHONESPORT', $homepageConfig['headphonesPort']); else : define('HEADPHONESPORT', ''); endif;
 
     
     if(file_exists('custom.css')) : define('CUSTOMCSS', 'true'); else : define('CUSTOMCSS', 'false'); endif;