Skip to content
Snippets Groups Projects
Commit e51035c7 authored by Jan Grewe's avatar Jan Grewe
Browse files

add images for Open Graph tags and brand logo

parent dc42d931
Branches
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ if ($_GET['get'] == 'shows' && $_GET['limit'] && isset($_GET['offset'])) { ...@@ -27,6 +27,7 @@ if ($_GET['get'] == 'shows' && $_GET['limit'] && isset($_GET['offset'])) {
} }
if ($_GET['get'] == 'movies' && $_GET['limit'] && isset($_GET['offset'])) { if ($_GET['get'] == 'movies' && $_GET['limit'] && isset($_GET['offset'])) {
$cpdb = new PDO('sqlite:'.$cpPath.'/couchpotato.db'); $cpdb = new PDO('sqlite:'.$cpPath.'/couchpotato.db');
...@@ -67,11 +68,11 @@ if ($_GET['get'] == 'poster' && (!empty($_GET['show']) || !empty($_GET['movie']) ...@@ -67,11 +68,11 @@ if ($_GET['get'] == 'poster' && (!empty($_GET['show']) || !empty($_GET['movie'])
if(!file_exists($poster)) { if(!file_exists($poster)) {
if($_GET['show'] && $_GET['season']) if($_GET['show'] && $_GET['season'])
$source = '/'.get_absolute_path($showsPath.'/'.$_GET['show'].'/season'.$_GET['season'].'-poster.jpg'); $source = '/'.get_absolute_path($showsPath.'/'.cleanName($_GET['show'], false).'/season'.$_GET['season'].'-poster.jpg');
elseif($_GET['show']) elseif($_GET['show'])
$source = '/'.get_absolute_path($showsPath.'/'.$_GET['show'].'/poster.jpg'); $source = '/'.get_absolute_path($showsPath.'/'.cleanName($_GET['show'], false).'/poster.jpg');
else else
$source = '/'.get_absolute_path($moviesPath.'/'.$_GET['movie'].'/'.$_GET['movie'].'-poster.jpg'); $source = '/'.get_absolute_path($moviesPath.'/'.cleanName($_GET['movie'], false).'/'.cleanName($_GET['movie'], false).'-poster.jpg');
if(file_exists($source)) { if(file_exists($source)) {
$img = new Imagick(); $img = new Imagick();
...@@ -95,6 +96,7 @@ if ($_GET['get'] == 'poster' && (!empty($_GET['show']) || !empty($_GET['movie']) ...@@ -95,6 +96,7 @@ if ($_GET['get'] == 'poster' && (!empty($_GET['show']) || !empty($_GET['movie'])
die; die;
} }
if ($_GET['get'] == 'fanart' && (!empty($_GET['show']) || !empty($_GET['movie']))) { if ($_GET['get'] == 'fanart' && (!empty($_GET['show']) || !empty($_GET['movie']))) {
if($_GET['show']) if($_GET['show'])
...@@ -106,9 +108,9 @@ if ($_GET['get'] == 'fanart' && (!empty($_GET['show']) || !empty($_GET['movie']) ...@@ -106,9 +108,9 @@ if ($_GET['get'] == 'fanart' && (!empty($_GET['show']) || !empty($_GET['movie'])
if(!file_exists($fanart)) { if(!file_exists($fanart)) {
if($_GET['show']) if($_GET['show'])
$source = '/'.get_absolute_path($showsPath.'/'.$_GET['show'].'/fanart.jpg'); $source = '/'.get_absolute_path($showsPath.'/'.cleanName($_GET['show'], false).'/fanart.jpg');
else else
$source = '/'.get_absolute_path($moviesPath.'/'.$_GET['movie'].'/'.$_GET['movie'].'-fanart.jpg'); $source = '/'.get_absolute_path($moviesPath.'/'.cleanName($_GET['movie'], false).'/'.cleanName($_GET['movie'], false).'-fanart.jpg');
if(file_exists($source)) { if(file_exists($source)) {
$img = new Imagick(); $img = new Imagick();
...@@ -134,6 +136,7 @@ if ($_GET['get'] == 'fanart' && (!empty($_GET['show']) || !empty($_GET['movie']) ...@@ -134,6 +136,7 @@ if ($_GET['get'] == 'fanart' && (!empty($_GET['show']) || !empty($_GET['movie'])
die; die;
} }
if ($_GET['get'] == 'logo' && (!empty($_GET['show']) || !empty($_GET['movie']))) { if ($_GET['get'] == 'logo' && (!empty($_GET['show']) || !empty($_GET['movie']))) {
if($_GET['show']) if($_GET['show'])
...@@ -144,9 +147,9 @@ if ($_GET['get'] == 'logo' && (!empty($_GET['show']) || !empty($_GET['movie']))) ...@@ -144,9 +147,9 @@ if ($_GET['get'] == 'logo' && (!empty($_GET['show']) || !empty($_GET['movie'])))
if(!file_exists($logo)) { if(!file_exists($logo)) {
if($_GET['show']) if($_GET['show'])
$source = '/'.get_absolute_path($showsPath.'/'.$_GET['show'].'/clearlogo.png'); $source = '/'.get_absolute_path($showsPath.'/'.cleanName($_GET['show'], false).'/clearlogo.png');
else else
$source = '/'.get_absolute_path($moviesPath.'/'.$_GET['movie'].'/'.$_GET['movie'].'-clearlogo.png'); $source = '/'.get_absolute_path($moviesPath.'/'.cleanName($_GET['movie'], false).'/'.cleanName($_GET['movie'], false).'-clearlogo.png');
if(file_exists($source)) { if(file_exists($source)) {
$img = new Imagick(); $img = new Imagick();
...@@ -165,6 +168,7 @@ if ($_GET['get'] == 'logo' && (!empty($_GET['show']) || !empty($_GET['movie']))) ...@@ -165,6 +168,7 @@ if ($_GET['get'] == 'logo' && (!empty($_GET['show']) || !empty($_GET['movie'])))
die; die;
} }
if ($_GET['get'] == 'episodes' && !empty($_GET['show']) && isset($_GET['season'])) { if ($_GET['get'] == 'episodes' && !empty($_GET['show']) && isset($_GET['season'])) {
$sbdb = new PDO('sqlite:'.$sbPath.'/sickbeard.db'); $sbdb = new PDO('sqlite:'.$sbPath.'/sickbeard.db');
$episodes = $sbdb->query("SELECT episode, name, airdate, status FROM tv_episodes WHERE showid = '".$_GET['show']."' AND season = '".$_GET['season']."' ORDER BY episode ASC;"); $episodes = $sbdb->query("SELECT episode, name, airdate, status FROM tv_episodes WHERE showid = '".$_GET['show']."' AND season = '".$_GET['season']."' ORDER BY episode ASC;");
...@@ -178,6 +182,7 @@ if ($_GET['get'] == 'episodes' && !empty($_GET['show']) && isset($_GET['season'] ...@@ -178,6 +182,7 @@ if ($_GET['get'] == 'episodes' && !empty($_GET['show']) && isset($_GET['season']
die; die;
} }
if ($_GET['get'] == 'latest' && $_GET['type'] == 'shows') { if ($_GET['get'] == 'latest' && $_GET['type'] == 'shows') {
$sbdb = new PDO('sqlite:'.$sbPath.'/sickbeard.db'); $sbdb = new PDO('sqlite:'.$sbPath.'/sickbeard.db');
$eps = $sbdb->query("SELECT s.show_name, ep.name, ep.episode, ep.season, ep.airdate FROM tv_episodes AS ep JOIN tv_shows AS s ON ep.showid=s.tvdb_id WHERE ep.status LIKE '%4' ORDER BY ep.airdate DESC LIMIT 10;"); $eps = $sbdb->query("SELECT s.show_name, ep.name, ep.episode, ep.season, ep.airdate FROM tv_episodes AS ep JOIN tv_shows AS s ON ep.showid=s.tvdb_id WHERE ep.status LIKE '%4' ORDER BY ep.airdate DESC LIMIT 10;");
...@@ -192,10 +197,14 @@ if ($_GET['get'] == 'latest' && $_GET['type'] == 'shows') { ...@@ -192,10 +197,14 @@ if ($_GET['get'] == 'latest' && $_GET['type'] == 'shows') {
} }
function cleanName($show) { function cleanName($name, $strict = true) {
return preg_replace("/[^a-zA-Z0-9]/", "_", $show); if($strict == true)
return preg_replace("/[^a-zA-Z0-9]/", "_", $name);
else
return preg_replace("/:/", "", $name);
} }
function get_absolute_path($path) { function get_absolute_path($path) {
$path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path); $path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen'); $parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
......
html { html {
overflow: -moz-scrollbars-vertical; overflow: -moz-scrollbars-vertical;
overflow: scroll; overflow: scroll;
/* overflow-y: scroll; *doesnt work with firefox*/ /* overflow-y: scroll; *doesnt work with firefox*/
} }
body { body {
padding-top: 70px; padding-top: 70px;
} }
.navbar-brand {
padding-top: 0;
padding-bottom: 0;
}
.show { .show {
margin-bottom: 50px; margin-bottom: 50px;
min-height: 200px; min-height: 200px;
......
img/logo.png

8.21 KiB

img/opengraph.jpg

83.6 KiB

...@@ -10,6 +10,12 @@ ...@@ -10,6 +10,12 @@
<title>MediaRack</title> <title>MediaRack</title>
<meta property="og:title" content="MediaRack" />
<meta property="og:description" content="My TV Show and Movie library" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://<?php echo $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; ?>" />
<meta property="og:image" content="http://<?php echo $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; ?>img/opengraph.jpg" />
<link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-slate.min.css" rel="stylesheet"> <link href="css/bootstrap-slate.min.css" rel="stylesheet">
<link href="css/mediarack.css" rel="stylesheet"> <link href="css/mediarack.css" rel="stylesheet">
...@@ -36,7 +42,7 @@ ...@@ -36,7 +42,7 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<a class="navbar-brand" href="#">MediaRack</a> <a class="navbar-brand" href="#"><img alt="MediaRack" src="img/logo.png" /></a>
</div> </div>
<div class="navbar-collapse collapse"> <div class="navbar-collapse collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
...@@ -76,5 +82,22 @@ ...@@ -76,5 +82,22 @@
<script src="js/jquery.lazyload.min.js"></script> <script src="js/jquery.lazyload.min.js"></script>
<script src="js/jquery.scrollstop.js"></script> <script src="js/jquery.scrollstop.js"></script>
<script src="js/mediarack.js"></script> <script src="js/mediarack.js"></script>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://stats.faked.org/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "7"]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Piwik Code -->
</body> </body>
</html> </html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment