webbased library viewer/downloader
#1
I started on a little project of my own, I am still basic learner of PHP and haven't done too much in it so it might be a bit messy when it comes to the coding, any advise on those points is most welcome.

I started with this idea as I started sharing library between multiple devices through a sql server, I then got the idea that it would also have to be possible to extract that information into a webpage that has acces to the sql server.

It excists out of one page and a included file for database connection.
So far it is only made to show video library, mainly because I don't have any music imported in XBMC yet.

Main file shows the series that are stored on my pc and and when the "?show=" parameter is included it shows the episodes of those shows and basic informatie with download links to the shows.

Reason I use this is to download shows from my pc to other pc's when not at home.

I still desire to include some basic remote features, mainly to refresh or clean library, just don't have a clue how to start on that part yet.
If anyone here can see some points that might be improved I'd be glad to hear that.

Best way I learn stuff is to actually work with it and put it to use, and since this does offer some basic uses for me its a great start.

I included the codes I used below, can't actually show a site with this code since I would be illegally sharing files and I don't think anyone here would apreciate that.


inc/db.inc.php
PHP Code:
<?php

$host
="localhost";
$username="username";
$password="password";
$database="myvideos##";

mysql_connect("$host","$username","$password");
mysql_select_db("$database");

?>


index.php
PHP Code:
<?php
include('./inc/db.inc.php');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>XBMC Library</title>
<style>
body {
    color: #2F2F2F;
    font-size: small;
    font-family: arial, verdana, tahoma, sans-serif;
}
a {
    color: #39F;
    text-decoration: none;
}
a:hover {
    color: #00F;
    text-decoration: underline;
}
</style>
</head>
<body>
<table border="1">
<?php
if(empty($_GET['show'])) {

$result mysql_query("SELECT * FROM tvshow ORDER BY c00"); //sorted from a-z on title
while($row mysql_fetch_array($result))
  {
$showID="$row[idShow]";
    echo 
"<tr>";
echo 
"<td>" "<a href='?show=$showID'>" "$row[c00]"</a>" "</td>";
echo 
"<td NOWRAP>" "$row[c05]"</td>";
echo 
"<td>" "$row[c08]"</td>";
echo 
"<td>" "$row[c01]"</td>";
    echo 
"</tr>";
      }
    
} else {
$result mysql_query("SELECT * FROM tvshow WHERE idShow=$_GET[show]");
$seasons mysql_query("SELECT * FROM seasons WHERE idShow=$_GET[show]");
$episode mysql_query("SELECT * FROM episode WHERE idShow=$_GET[show] ORDER BY c12 AND c13");
$row mysql_fetch_array($result);
$ssn mysql_num_rows($seasons)-2//Seasons start at -1


echo "<h2><a href='./'>&lt; TV shows</a></h2>";
echo 
"<tr>";
echo 
"<h1>$row[c00]</h1>"
echo 
"<img src='http://thetvdb.com/banners/graphical/$row[c12]-g.jpg' border='0'><br>"//banners loaded from thetvdb site.
echo "<h3>$row[c01]</h3>";


while(
$ep mysql_fetch_array($episode)) {
    
$local "E:\Downloads\Sorted\Series";
$location "$ep[c18]";
$ftp str_replace($local"ftp://piko.pikorimugadgets.nl""$location"); //Replaces local path with the ftp path to files.

    
echo "<tr>";
echo 
"<td nowrap='nowrap'>" "<a href='$ftp'>Season: $ep[c12] - Episode $ep[c13]</a>" "</td>";    
echo 
"<td>" "$ep[c01]"</td>";    


}

}
?>

</table>
<?php  
  
///Error checking
  
if($result !== false){
    
//fetchen
}
else{
    echo 
mysql_error();
}
?>
</body>
<?php
mysql_close
();
?>
</html> 
Reply
#2
I was just looking for a similar tool as my library also resides on a NAS. It would very nice to manage the library from a web browser somewhere on the network, without the need to start XBMC to see what's in it. Good luck with the project! I'm sorry I can't be of any help to you as I'm not developer at all Sad
Reply
#3
I would love to see a video player built in so you can stream video right on the page. Like a private YouTube.
Reply
#4
Great idea.

I would suggest not going into video decoding, but focussing on media library management.
Ideally enable it read/write to the MySQL server such that programs such as Couchpotato and Sickbeard can initiate library updates without the need for an XBMC-box to be on.
Reply

Logout Mark Read Team Forum Stats Members Help
webbased library viewer/downloader0