Jump to content

Recommended Posts

Posted

Is there a way to export media browser library information into a spreadsheet? I’m looking to put together and maintain a spreadsheet for my movie/TV collection. The information I want to compile is Name, Year, Season (for TV shows) and Resolution from the library. Then I can add a few fields of my own in the spreadsheet. I want to be able to sort through the movies I want to keep, upgrade the resolution where possible and be able to determine if there are any other related movies I would like to acquire.

 

This isn’t a big deal. It will only take a few evenings to build the spreadsheet manually but if I could automate it using the library database, why not.

 

Thanks

 

Posted

Have you read this ??

Posted

Thanks for the link CBers.

 

I'll go through it tonight when I get home. Work computer blocks a lot of stuff. Geez, and here I thought I had an original idea. Ahh well, should've known better. You folks forgot more about HTPC's than I will ever learn.

  • Like 1
Posted

Just lots of same-minded people here ;)

Koleckai Silvestri
Posted (edited)

I am using JSON calls to the server to pull information. I can then manipulate this to do what I want. Currently using PHP for this. Going to put it in a MySQL database this week. Just need more reporting than is available in the system currently.

 

If you have the server in developer mode, you can use the swagger API to build the links you need. Once you have the JSON result, you can use an online tool to convert it to an Excel file. Just google for JSON to Excel.

Edited by Wayne Luke
Koleckai Silvestri
Posted

So far my son and I have added television reports for missing episodes by series and missing subtitles by series then episode. For movies the only thing we search for currently is .disc stubs and mp4 stubs less than 2 megabytes.

Posted

Wayne can you keep us posted on what you add? More features can be added to the core reporting.

Happy2Play
Posted

Since the Server already creates reports (libraryreport.html) is there a way to export those?

Koleckai Silvestri
Posted

Here is some of my very dirty code to pull the data out of MediaBrowser:

 

<?php
 
// Set some variables.
$userHash = "UUUUUUUUUUUUUUUUUUUUUU";
$serverURL = "http://XXX.XXX.XXX.XXX:8096/mediabrowser/";
$movieList = "Users/" . $userHash . "/Items?Recursive=true&IncludeItemTypes=Movie&SortBy=SortName";
$latestList = "Users/". $userHash . "/Items?Recursive=true&IncludeItemTypes=Movie&limit=21&SortBy=DateCreated&SortOrder=Descending";
$json_fields ="Budget,Chapters,CriticRatingSummary,DateCreated,Genres,HomePageUrl,IndexOptions,MediaStreams,Overview,OverviewHtml,ParentId,Path,People,ProviderIds,PrimaryImageAspectRatio,Revenue,SortName,Studios,Taglines,TrailerUrl";
$image_path = ".\\images\\movies";
$data_path = ".\\data";
 
 
 
function writeFile($file, $local_path, $newfilename, $getJSON) { 
    $err_msg = ''; 
    $out = fopen($local_path. DIRECTORY_SEPARATOR . $newfilename,"wb");
 
    $ch = curl_init(); 
 
    curl_setopt($ch, CURLOPT_FILE, $out); 
    curl_setopt($ch, CURLOPT_HEADER, 0); 
if ($getJSON == true) {
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json'));
}
    curl_setopt($ch, CURLOPT_URL, $file); 
 
    curl_exec($ch); 
 
    curl_close($ch); 
}
 
function getMovies($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$url);
$result=curl_exec($ch);
 
return $result;
}
 
// Get Movies from MediaBrowser Server.
$movies = getMovies($serverURL . $movieList);
file_put_contents($data_path. DIRECTORY_SEPARATOR . 'movies.js', $movies); 
 
// Get Latest Movies from MediaBrowser Server.
$latest = getMovies ($serverURL . $latestList);
file_put_contents($data_path. DIRECTORY_SEPARATOR . 'latest.js', $latest); 
 
// Parse the Master Movie JSON into an Object Array.
$movies = json_decode($movies, true);
 
// Output JSON and Images for each movie.
foreach ($movies['Items'] as $movie) {
print "Processing " . $movie['Name'] . "(ID:" . $movie['Id'] .").\n";
 
// Write Individual Movie JSON
print "\tWriting JSON...\n";
$movieData = $serverURL . "Items?Ids=" . $movie['Id'] . "&Fields=" . $json_fields;
$moviename = $movie['Id'] . "data.js";
writeFile($movieData, $data_path . DIRECTORY_SEPARATOR . 'movies', $moviename, true);
 
// Get and store poster.
print "\tWriting poster...\n";
$poster = $serverURL . "Items/" . $movie['Id'] . "/Images/Primary";
$posterfilename= $movie['Id'] . '.poster.jpg';
writeFile($poster, $image_path . DIRECTORY_SEPARATOR . 'posters', $posterfilename, false);
 
// Get and store poster thumbnail
print "\tWriting poster thumbnail...\n";
$poster = $serverURL . "Items/" . $movie['Id'] . "/Images/Primary/?Width=134&Height=200";
$posterfilename= $movie['Id'] . '.poster.jpg';
writeFile($poster, $image_path . DIRECTORY_SEPARATOR . 'thumbs', $posterfilename, false);
 
// Get and store Backdrop
print "\tWriting backdrop...\n";
$backdrop = $serverURL . "Items/" . $movie['Id'] . "/Images/Backdrop";
$backdropfilename= $movie['Id'] . '.backdrop.jpg';
writeFile($backdrop, $image_path . DIRECTORY_SEPARATOR . 'backdrops', $backdropfilename, false);
 
}
?>

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