[PHP] [LibraryBox] Mediacenter mod (like Kodi)

Posted by ninjaw 
[PHP] [LibraryBox] Mediacenter mod (like Kodi)
March 04, 2016 04:57PM
Update 0.2 finnished the movie detail page, now it starts to look like something, looks like I cannot really open PDF files without ghostscript, so I worked out the "companion jpg file" for the brand new magazine page but also on movies and "shows", a new categorie I made for comedy and music shows. Next : TV shows, and comic books (they will be automated)

Hi, this is one more Mediacenter for LibraryBox, but this one is fully automated, and quite simple to install. So it is ugly as hell, I am not designer, but it works.
What we call a Media Center is just media files with full detailled infos and screenshots. Here's where I am so far, Movies, mp3, and ebooks (Yes this is in french, my code however is noted in english) Note that I tried to stay into the LibrayBox2 style and just added a Media Center link in the current 2.1 menu, no fancy player here, this is still links to files, and they will be continue to be in the download stats :


Movies are basically just posters :
[ninjaw.free.fr]

When you'll click on a poster, you'll find lots of details about the movie before launching it: Plot, several pictures (poster and fullscreen art), file codecs, size and audio, runtime, rating, genres... you can add lots more if wanted :


Shows are a category that works like exactly Movies, it is for Comedy and Music shows

Music works the same, but cover is square, and there is no details (yet) just direct links.
[ninjaw.free.fr]

Ebooks works the same, except I created a fully automated cover extractor, if no cover found into the ebook file, or beside a companion jpg file, right now you'll have just links.


Magazines are pdf files, unfortunally it looks like i cannot open PDF files withou Ghostscript, so right now it's using jpg companion files


So how does it work ? Famous mediacenters like Kodi are getting infos from the web, here you'll have to put them yourself in a way it will be detected: folders. The idea is that a mp3 album is obviously already in a folder, you will have to put all movies in their own private folders too, because they'll have more files for infos. Basically, movies are using the classic XBMC folder structure (ex-Kodi).

Folder.jpg ! Windows invented it: a file called folder.jpg inside a folder will become the main picture for the folder.
You don't like folder for movies ? not an issue : you can simply put the movie as it is, and add a poster with the same name.

It's a lot of work ? not ! Tinymediamanager will do all the movie work and more directly on the usb key. Same thing for mp3, Tag&Rename can handle folder.jpg as many other things, or you can also use that impressive script pack for filebot that will do the same : rename and create a xbmc folder structure for movies :
[www.filebot.net]

Here's a screenshot showing lot of infos that Tinymediamanager can grab for your movie on the usb key, all details are packed into movie.nfo, including file&codec details


Install the mod is easy : it's just a mediacenter folder to add into 'content', to call the mediacenter, just add mediacenter on the url... that means you just have to add a "mediacenter" link on the main page. Here are my files:
[ninjaw.free.fr]

Remember, I suck big time at responsive design, or even design, feel free to help.

Bonus: all your screenshots will be showed automatically by DLNA !



Edited 7 time(s). Last edit at 03/07/2016 07:34AM by ninjaw.
Re: [PHP] [LibraryBox] Mediacenter mod (like Kodi)
March 05, 2016 11:23AM
Update 0.1 with new automated Ebook cover finder, and really better design, next : create tools to show covers for comic books, and magazines.
Re: [PHP] [LibraryBox] Mediacenter mod (like Kodi)
March 06, 2016 04:50PM
Update 0.2 finnished the movie detail page, now it starts to look like something, looks like I cannot really open PDF files without ghostscript, so I worked out the "companion jpg file" for the brand new magazine page but also on movies and "shows", a new categorie I made for comedy and music shows. Next : TV shows, and comic books (they will be automated)
Re: [PHP] [LibraryBox] Mediacenter mod (like Kodi)
April 03, 2016 07:36AM
My mod is still in developpement, and for now on hold : I found a way to auto extract pictures from PDF files without all missing php addons, unfortunally it works with 30% of pdf only, and it's very frustrative for me, however, I updated the ebook picture extractor and is now very powerfull as it will grab any picture inside whatever it is.

Also I started to rethink the whole think, that's why it takes time:
-added translations
-i will get rid of forced sections, I want it to be so powerfull it will be able to show any type of combined files in any numbers of folders. Sections will still be there but with a lot of customizing.
-Scanning 100MB magazines is not the same speed as scanning 0.3MB ebooks, so I started to show working statuts info, and will add a "delete cover" option... That means first time you access webpage it will heavily work on grabing multimedia infos, and showing things like "Picture found ! delete it ?" but second time it will be just ready.
Re: [PHP] [LibraryBox] Mediacenter mod (like Kodi)
April 06, 2016 05:03PM
First of all... I LOVE what you've done with this... I "americanized" it for myself while traveling last week and worked great. Was just curious if you can put it on github since you've been making changes? I'd love to contribute too
Re: [PHP] [LibraryBox] Mediacenter mod (like Kodi)
April 07, 2016 04:16AM
Hey, thank you for showing love. This was my first idea, to do like other ppl here, however I didn't really understood it, but I can try again. I think my core extractor code (at least) will interess other coders, I'm very surprised nobody ever did anything like that ? I mean without all the addons and libraries.. all PDF, CBZ, Ebook format are sharing the same basic structure that you can work directly with php.
PDF is the real challenge here, because unfortunally ppl love to read comics or book in pdf, even if it's far from being relevant (always use cbz). I googled a lot about it and nobody knows how to get rid of Ghostscript, except me ?
-----
I'll just detail where I am, and why it's frustrating : First thing, I worked hard on pdf, because I knew from ComicRack shareware tool it was possible: That tool is converting perfectly PDF into CBZ (that means jpg without loss in a zip), but I already know from it, some PDF are really badly written and handling lots of small pictures parts. For those ridiculous pdf, ComicRack is asking ... GhostScript !
So I knew somehow you could extract pictures from 90% of PDF files internally, I started to look at PDF structure, it's just a simple XML lookalike with binary files inside, very similar to ebook and cbz... Exept they are real XML+jpg into a zip and PDF is binary.
And that's why it's harder: PHP got several tools to read binary files, and even use them as regular ASCII files, and i did succesfully browsed tags until discovering JPG and extract them !
So why It only works with 30% of pdf ? grrrr because pdf is very versatile: tags can be on the same line or not, it's not really an issue... but the main issue are EoL chars that can be both windows or linux ... I cannot find any php command that can browse binary files with both style, worst : I couldn't even browse binary using one of the two EoL chars !
----
So here's where I am : It looks like I will have to recreate a full binary read function, because PHP is too poor at it, not mentionning internal PDF functions really too poor and not included on librarybox anyway: I'm really starting to be bored to recreate everything from scratch: It's a media center for god sake, nobody ever did one ?
Also some code cleaning: Move all text into the config.php for translation and isolate every picture extractor (heavy code) in their own php files, my idea to allow only one type of files by sections was ridiculous.

Not sure you can help on such internal heavy code, but that's ok, I'm better at this than design.

PS: Please note that I only speak for PDF 100% made of jpg, Txt PDF are doomed anyway



Edited 1 time(s). Last edit at 04/07/2016 04:22AM by ninjaw.
Re: [PHP] [LibraryBox] Mediacenter mod (like Kodi)
April 12, 2016 02:33AM
I love this! Will it work on PB as well or does it need to be ported?
Re: [PHP] [LibraryBox] Mediacenter mod (like Kodi)
April 12, 2016 03:39AM
damavox Wrote:
-------------------------------------------------------
> I love this! Will it work on PB as well or does it
> need to be ported?

Unfortunaly it requires two advanced features from LibraryBox : Files on Usb & Php
Re: [PHP] [LibraryBox] Mediacenter mod (like Kodi)
April 16, 2016 11:21PM
Ah, well lucky for me the raspberry pi zero version has these features, file on USB is on PB and PHP can be added (and will become default in the next release) hot smiley

So I guess from here i will start adding the features and adjusting the design for the PB webpage. smiling smiley
Re: [PHP] [LibraryBox] Mediacenter mod (like Kodi)
April 17, 2016 12:12AM
Well, I uploaded but for some reason, I keep getting a redirect back to home page when I click on my link.
This is a new "event" for me, as the same thing happened when I attempt to upload the calibre' ebook server.
So I must ask, has this happened to anyone else? and what did you do to solve it?

I have mentioned this a couple of times in the forums but have not figured out or found a solution.

Here are the steps I took:

uploaded the media center folder to my USB drive under the /share directory.
created a link in the index.html file located in /opt/piratebox/www/.
Link created was pointed to /mnt/usbshare/share/mediacenter/

Note: not sure if this is the same across all devices but on the Rpi version of PB the share directory and shared directory are different. Content is uploaded to /mnt/usbshare/share/Shared/
Re: [PHP] [LibraryBox] Mediacenter mod (like Kodi)
April 20, 2016 02:27AM
Ok I seem to finally be getting somewhere with this.
PirateBox is seems to handle PHP different than libarybox by default.
PirateBox's UI is also setup alot differently than Library box as well.
soooooo.... This might take a while smiling smiley

I have not figured out why the redirect happens yet but I seem to be able to surpass it by editing the lighttpd.conf file and adding this line at the bottom:
$HTTP["url"] =~ "^/gallery/" { 
cgi.assign = ( ".php" => "/usr/bin/php-cgi" , )
}

I discovered it after checking out the mod page out here

Can you verify how LibrayBox handles this activity by any chance? I do not want to have to add the code multiple time for the various directories involved.

I am going to try adding some "cover all" code to lighttpd.conf and see if that works by changing the above code to

$HTTP["url"] =~ "^/*/" { 
cgi.assign = ( ".php" => "/usr/bin/php-cgi" , )
}

I'll let you know the result
Re: [PHP] [LibraryBox] Mediacenter mod (like Kodi)
September 26, 2016 07:44AM
I've been doing some stuff on this using your original code... was wondering your thoughts. I've made the layout all display into one page, as well as doing some bootstrap to make it more mobile friendly. I decided to put this all on one page because the users I have use it much more for movies than anything else but would still like to see the rest.

FYI I'll be moving my install to PirateBox on rpi3 now since it will support php, because openwrt simply can't handle the amount of php to read the images from each movie... connecting 500GB worth of movies killed openwrt (rather, not KILLED, but took close to a minute to display)

Hello,

It is possible have this for Series ?

Thanks for your works.
It's great
Re: [PHP] [LibraryBox] Mediacenter mod (like Kodi)
January 14, 2017 11:58PM
Hello,

Is there an update for this?

Thanks

Snipy
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically.
 **     **  **     **  **     **   ******    ******  
 ***   ***  **     **  **     **  **    **  **    ** 
 **** ****  **     **  **     **  **        **       
 ** *** **  **     **  **     **  **        **       
 **     **   **   **   **     **  **        **       
 **     **    ** **    **     **  **    **  **    ** 
 **     **     ***      *******    ******    ******  
Message: