Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaines committed Apr 6, 2012
0 parents commit e02ae58
Show file tree
Hide file tree
Showing 37 changed files with 1,312 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Usenet Intranet PHP Homepage
====

A simple little one-page Intranet homepage I created for my home server with the following features:

* Buttons to go directly to:
* Sickbeard
* CouchPotato
* Headphones
* SABnzbd
* Currently downloading on SABnzbd
* List of TV Shows that come out today
* Show Wifi Password
* Completely customisable to show or hide only the features you want

## Installation

Ideally this would go on the root of your web server, which is why the intranet resources are in a folder named intranet. The resources are all relative so you can move it in to a subfolder if you like.

All the set up variables are at the top of the php file.
At the very top of the configuration is switches to turn on or off each service. Set them to false to turn them off, set them to true to turn them on.
Underneath those switches are the URLs and Ports that you will need to configure before anything will work.

If you are wanting to show current downloads and TV Today, please ensure you have set the API keys for SABnzbd and SickBeard in the configuration section at the top of the php file.
167 changes: 167 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
<?php

/* =======================================================
INITIAL SET UP
======================================================= */

$config = array(

# Services
# Set these to false to disable them
"sickbeard" => true,
"couchpotato" => true,
"headphones" => true,
"sabnzbd" => true,

# URLs and Ports
"sickbeardURL" => "http://192.168.1.6",
"sickbeardPort" => "8081",
"sabnzbdURL" => "http://192.168.1.6",
"sabnzbdPort" => "8080",
"couchpotatoURL" => "http://192.168.1.6",
"couchpotatoPort" => "5000",
"headphonesURL" => "http://192.168.1.6",
"headphonesPort" => "8181",


# Sickbeard - Missed or Coming?
# Australia, for example, is almost an entire day ahead of America and so American TV shows
# air the day after they say they're going to air, so instead of "coming shows", we use "missed shows"
# to indicate what's coming out today.
# Set to true for "missed", false for "coming"
"sickMissed" => false,

# Show popups when hovering over coming shows?
"sickPopups" => true,

# Wifi
# WifiName is also used for page title
"showWifi" => true,
"wifiName" => "Shiznit Central",
"wifiPassword" => "CCE11A3403"

);

/* =======================================================
END SET UP
======================================================= */

?>
<!doctype html>
<html>
<head>
<title><?= $config['wifiName']; ?> Intranet</title>
<link rel="stylesheet" href="intranet/style.css" />
</head>
<body>
<h1><?= $config['wifiName']; ?> Server</h1>

<?php ## Check if everything is disabled
if (!$config['sickbeard'] && !$config['couchpotato'] && !$config['headphones'] && !$config['sabnzbd'] && !$config['showWifi']) :

echo "<img src='intranet/images/mymanjackie.png' />";

else :
?>

<?php if( $config['sickbeard'] ) :
if ( $config['sickMissed'] ) : $sbType = "missed"; else: $sbType = "today"; endif;
?>
<div class="sickbeardShows">
<h3>TV Today</h3>
<?php
$sbJSON = file_get_contents($config['sickbeardURL'].":".$config['sickbeardPort']."/api/2fcc92a573de2468ae7ee36e351b45a9/?cmd=future&sort=date&type=".$sbType);
$sbShows = json_decode($sbJSON);

echo "<ul>";

# List shows
if(empty($sbShows)){
# quick check if there are any shows today.
echo "<li>No shows today.</li>";
} else {
# Run through each show
foreach($sbShows->{'data'}->{$sbType} as $episode) {
echo "<li>";

# Sickbeard Popups
if($config ['sickPopups']) :
echo "<span class='showPopup'>";
echo "<img src='".$config['sickbeardURL'].":".$config['sickbeardPort']."/showPoster/?show=".$episode->{'tvdbid'}."&which=poster' class='showposter' />";
echo "</span>";
endif;

# Show name and number
echo "<strong class='showname'>".$episode->{'show_name'}."</strong><br />";
echo "<span class='showep'>".$episode->{'season'}."x".$episode->{'episode'}." - ". $episode->{'ep_name'};
echo "</li>";
}
}
echo "</ul>";
?>
</div>
<?php endif; ?>

<?php ## Action Buttons ?>
<?php if( $config['sickbeard'] ) : ?>
<a href="<?= $config['sickbeardURL']; ?>:<?= $config['sickbeardPort']; ?>" title="SickBeard" class="actionButton big sickbeard"><span>SickBeard</span></a>
<?php endif; ?>
<?php if( $config['couchpotato'] ) : ?>
<a href="<?= $config['couchpotatoURL']; ?>:<?= $config['couchpotatoPort']; ?>" title="CouchPoato" class="actionButton big couchpotato"><span>CouchPotato</span></a>
<?php endif; ?>
<?php if( $config['headphones'] ) : ?>
<a href="<?= $config['headphonesURL']; ?>:<?= $config['headphonesPort']; ?>" title="Headphones" class="actionButton big headphones"><span>Headphones</span></a>
<?php endif; ?>

<?php ## SABnzbd ?>
<?php if( $config['sabnzbd'] ) : ?>
<a href="<?= $config['sabnzbdURL']; ?>:<?= $config['sabnzbdPort']; ?>" title="SABnzbd" class="actionButton big sabnzb"><span>SABnzbd</span></a>

<div class="sabDownload">
<h2>Currently Downloading</h2>
<?php

$data = simplexml_load_file($config['sabnzbdURL'].":".$config['sabnzbdPort']."/sabnzbd/api?mode=qstatus&output=xml&apikey=9f12df23f52c19ae0ac55caac9dd161d");
$filename = $data->jobs[0]->job->filename;
$mbFull = $data->jobs[0]->job->mb;
$mbLeft = $data->jobs[0]->job->mbleft;
$mbDone = $mbFull - $mbLeft;

if($filename) {

$mbFullNoRound = explode(".",$mbFull);
$mbPercent = $mbDone / $mbFullNoRound[0] * 100;
$mbPercentPretty = explode(".",$mbPercent);

echo "<span class='currentdl'>".$filename."</span>";
echo "<progress value='".$mbDone."' max='".$mbFull."'></progress>";
echo "<span class='stats'>".$mbDone."mb / ".$mbFullNoRound[0]."mb (".$mbPercentPretty[0]."%) @ ". $data->speed ."</span>";

} else {

echo "<em class='currentdl'>No current downloads</em>";

}
?>

</div>
<?php endif; ?>
<div class="clearLeft"></div>

<?php ## Wifi ?>
<?php if( $config['showWifi'] ) : ?>
<div class="wifi">
<h2>Wifi Password for <?= $config['wifiName'] ?></h2>
<big><?= $config['wifiPassword']; ?></big>
</div>
<?php endif; ?>

<?php ## Ending check for all-disabled ?>
<?php endif; ?>

</body>
</html>
91 changes: 91 additions & 0 deletions intranet/fonts/SIL Open Font License 1.1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file added intranet/fonts/TitilliumText22L001-webfont.eot
Binary file not shown.
Loading

0 comments on commit e02ae58

Please sign in to comment.