Jump to content

Data Build Tool for External Database.


Koleckai Silvestri

Recommended Posts

Koleckai Silvestri

I am working on a website to display my movie collection to friends and family. They can then borrow a disc or pick movies to watch when they visit. I had thought about exposing my entire MediaBrowser library to the web but didn't want to get dinged by my provider for running a public server. In order to get the data needed for my website, I needed to pull it out of media browser. Originally I was just using JSON files but they were inefficient, didn't get the quick sorting capabilities, etc..., so I built a MySQL database that can be accessed via PHP (or any other language).

 

I thought I would share what I have so far in case anyone else was interested in doing the same. You can find it here: 

https://github.com/wayneluke/wayneflix-build

 

Nothing really fancy. It is meant to be run from the command line. I am using PHP 5.5.9 and MySQL 5.6.16.

Edited by Wayne Luke
  • Like 5
Link to comment
Share on other sites

chenglee

Hey, this is nice.

I,ve tried it, but it only caches 2 movies and than stops.

Link to comment
Share on other sites

Koleckai Silvestri

There is probably a debug break at the bottom of the loop. You can comment out that line. I will commit a change with it commented out later.

Link to comment
Share on other sites

  • 4 weeks later...
chenglee

Hey Wayne and all the other MB3 users,

 

I modified your script and added a basic PHP website, to show your MB3 library online.

I created a new git for it: 

https://github.com/Chilldebert/MB3flix

 

I never did any programming and this website is my first step, so maybe it will work very poorly or won't work at all.

But if you're brave, you can try to install it :)

 

If you got any features you want to see or if you find bugs, security flaws etc. pls tell me.

  • Like 2
Link to comment
Share on other sites

  • 1 month later...
candyman

Could you guys please help a noob on setting this up

 

 

>> Insert the SQL located at /scripts/mb3flix.sql to create the tables.

 

how do i do the above

 

>>Update /config.php and /scripts/settings.php to match your current database setup.

not sure what needs changing here

 

rgd's

Andrew

 
Link to comment
Share on other sites

Koleckai Silvestri

Do you have PHP and MySQL installed on your computer? If not, do a search for XAMPP and install that. It will help you in the process.

 

Once you have MySQL installed, you would change the config.php file to represent your login information MySQL. These values have to change:

 

 

$hostname = "localhost";
$user = "root";
$password = "";
$database = "mbflix";
You can use this command to import the SQL file into MySQL:

mysql -p -u[user] [database] < backup-file.sql
Replace [user] and [database] with the same values as in config.php. Or you can use an application like HeidiSQL to do this. Edited by Wayne Luke
Link to comment
Share on other sites

Beardyname

Totally different question Wayne but i hope it is still ok :)

 

Since you are getting data out from the mb3 library, would you know if it was possible to combine this with :

http://wiki.xbmc.org/index.php?title=MySQL for synced playback etc! (possibly in the form of some sort of plugin for mb3)

this way you have easy playback sync from xbmc <--> mb3.

 

Cheers /beardyname

Link to comment
Share on other sites

candyman

thanks for the help wayne, now im having another problem when i run 'http://localhost//scripts/cachemovies.php' it fails with the following output -

 

Retrieving list of movies from server... 

Notice: Undefined index: TotalRecordCount in C:\inetpub\wwwroot\scripts\cachemovies.php on line 265
Found movies. 

Notice: Undefined index: Items in C:\inetpub\wwwroot\scripts\cachemovies.php on line 270

Warning: Invalid argument supplied for foreach() in C:\inetpub\wwwroot\scripts\cachemovies.php on line 270
Total Movies Processed: 0

 

any help would be greatfully appreciated.

 

rgds

Andrew

Link to comment
Share on other sites

Koleckai Silvestri

Did you add your user hash to the config.pho file?

 

I'll need to spend some time and update it to use the new security API in order to make it easier to use. Plus a few other changes.

Edited by Wayne Luke
Link to comment
Share on other sites

candyman

sorry for being a right PITA  ;) wayne but hit another problem, it now bombs out with -

 

Retrieving list of movies from server... 
Found 766 movies. 
Processing $50K and a Call Girl: A Love Story (ID:8744e23e6bb152cf0fb3a7abd786ecc4). Updating Database Record... 

Notice: Undefined index: CriticRating in C:\inetpub\wwwroot\scripts\cachemovies.php on line 150

Notice: Undefined index: Metascore in C:\inetpub\wwwroot\scripts\cachemovies.php on line 150

Notice: Undefined index: AwardSummary in C:\inetpub\wwwroot\scripts\cachemovies.php on line 150

Notice: Undefined index: CriticRatingSummary in C:\inetpub\wwwroot\scripts\cachemovies.php on line 150

Notice: Undefined offset: 0 in C:\inetpub\wwwroot\scripts\cachemovies.php on line 150

Notice: Undefined index: HomePageUrl in C:\inetpub\wwwroot\scripts\cachemovies.php on line 150
SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'virtual' at row 1

Link to comment
Share on other sites

Koleckai Silvestri

I'll look into that. What is the TMDB ID for that movie so I can add it to my system.

Link to comment
Share on other sites

candyman

Wayne i am actually receiving lots of errors from the following scripts:-

cachemovies.php, cachepeople.php, cacheseries.php

 

 

 

 

 

 

$50K and a Call Girl: A Love Story TMDbId = 248268

Link to comment
Share on other sites

candyman

Wayne i am actually receiving lots of errors from the following scripts:-

cachemovies.php, cachepeople.php, cacheseries.php

 

 

 

 

 

 

$50K and a Call Girl: A Love Story TMDbId = 248268

Just checked my metadata in MBS and all the fields that give the error are empty, could this be the problem ?

 

rgds

Andrew

Link to comment
Share on other sites

Koleckai Silvestri

Lines like this aren't actually errors: Notice: Undefined offset: 0 in C:\inetpub\wwwroot\scripts\cachemovies.php on line 150
 
They are ugly but not technically errors. They can be cleaned up or hidden though. I'll see if I can get them properly defined though as that is good practice. cachepeople.php and cacheseries.php aren't my scripts but they should be easy enough to troubleshoot. However empty values can cause errors like this: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'virtual' at row 1

 

I'll fix the queries so they don't crash. Might not get to it until this weekend though.

Link to comment
Share on other sites

candyman

@Koleckai Silvestri Thanks for your help with this, after a steep learning curve iv managed to get thins running and even managed a few improvements/enhancements :)

 

 

Rgds

Andrew., 

Link to comment
Share on other sites

  • 2 weeks later...
Swynol

this looks really interesting. i have my own website which is hosted by a company, can i add this to my website?

Link to comment
Share on other sites

Swynol

if i upload the git hub files to my host, setting up the config.php - for hostname will that the myhosts sql database location? then how do i point mbflix to see my media browser server?

Link to comment
Share on other sites

chenglee

if i upload the git hub files to my host, setting up the config.php - for hostname will that the myhosts sql database location? 

Yes

 

 then how do i point mbflix to see my media browser server?

One option would be run it locally and then add the local database files to your hosts mysql database. Or you could try to connect to MB3 remotely, but I don't know if this will work, I've never tried it.

The way I do it: I run the cachescripts locally on my PC , but in the settings I build a remote connection to the mysql DB from my hoster. (You have to activate remote connection for your mysql DB)

The only problem at the moment its, that I have to upload the image files manually afterwards. 

This whole thing isn't really made for daily use, a few additional features would be needed, but I don't have the time for this now.

Link to comment
Share on other sites

Swynol

ok thanks, so i could import the local database to my hosts mysql.

 

so the image files what directory would i upload them to? with a huge library that will take some time to do.

Link to comment
Share on other sites

Swynol

attempted to install this on my host using my media browser external IP, running cachemovies i get the following

WayneFlix Database Update. Retrieving list of genres from server... Found genres. Updating Database... Warning: Invalid argument supplied for foreach() in /hermes/bosnaweb03b/b1360/ipg.awelswynolcouk/MB3flix-master/scripts/cachemovies.php on line 254 Retrieving list of movies from server... Found movies. Warning: Invalid argument supplied for foreach() in /hermes/bosnaweb03b/b1360/ipg.awelswynolcouk/MB3flix-master/scripts/cachemovies.php on line 269 Total Movies Processed: 0

running the cacheseries i get 

WayneFlix Database Update. Retrieving list of genres from server... Found genres. Updating Database... Retrieving list of Episodes from server... Found Episodes. Retrieving list of seasons from server... Found seasons. Retrieving list of series from server... Found Series. Total series Processed: 0 Total seasons Processed: 0 Total episodes Processed: 0
Link to comment
Share on other sites

candyman

@ Don't quote me but i believe that error is because the is having problems connecting to the MB3Flix database. Did you import the MB3Flix.sql ??

Link to comment
Share on other sites

Swynol

thanks, ye i had overlooked that. now imported but i still get the same errors. it could be because I'm trying to access my MBS remotely. will set it up locally using xmapp later to see what happens.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...