Skip to content

Commit

Permalink
Merge pull request #180 from causefx/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
causefx authored Mar 24, 2017
2 parents b37c99d + f470dd9 commit a1ebdc5
Show file tree
Hide file tree
Showing 12 changed files with 299 additions and 68 deletions.
109 changes: 109 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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; }

}
?>
92 changes: 52 additions & 40 deletions homepage.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,16 @@
<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">

<div class="tabbable panel with-nav-tabs panel-default">

<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">

Expand Down Expand Up @@ -231,7 +231,8 @@
</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>

Expand Down Expand Up @@ -261,7 +262,8 @@
</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>

Expand All @@ -282,7 +284,7 @@
</div>
<?php endif; ?>

<div class="row">
<div id="plexRow" class="row">

<?php
$plexSize = 0;
Expand All @@ -301,7 +303,7 @@
</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">

Expand All @@ -314,7 +316,7 @@

</div>

<div class="row">
<div id="calendarRow" class="row">

<div class="col-lg-12">

Expand Down Expand Up @@ -374,41 +376,51 @@
</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; ?>

Expand Down
Binary file added images/rsscrawler.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 27 additions & 21 deletions lang/de.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
8 changes: 7 additions & 1 deletion lang/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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"
8 changes: 7 additions & 1 deletion lang/es.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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"
8 changes: 7 additions & 1 deletion lang/fr.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Loading

0 comments on commit a1ebdc5

Please sign in to comment.