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

Posted by ninjaw 
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Now, this forum is in read-only mode. You find details Details hereContinue on /r/PirateBox
[PHP] [LibraryBox] Mediacenter mod (like Kodi)
March 04, 2016 10: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 01:34PM by ninjaw.
Re: [PHP] [LibraryBox] Mediacenter mod (like Kodi)
March 05, 2016 05:23PM
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 10: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 12:36PM
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 10: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 09: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 09:22AM by ninjaw.
Re: [PHP] [LibraryBox] Mediacenter mod (like Kodi)
April 12, 2016 07: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 08: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 17, 2016 04:21AM
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 05: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 07: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 12:44PM
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 15, 2017 05:58AM
Hello,

Is there an update for this?

Thanks

Snipy
Good day friend
Forgive my bad English.

In fact, I have no experience in programming, however I think I learn to create a project that I have in mind.
I am Mexican, I live in a small town where we live less than 1000 people. Very few we have Internet, so I would like to make a PirateBox to share cultural content. I really like your project The design of the original PirateBox is good, but I would like a more friendly and intuitive interface for the people of my town. I would like to put a PirateBox and connect an antenna in the LAN connection so that the signal reaches many people; I hope it is possible to do that.

I really like your project, I'm a graphic designer, has helped with the graphic resources, what do you think?

I would like to make the PirateBox for my town so that there is a digital library since we do not have a physical. I would like the possibility of placing a flag or an image in the home to put an advertisement, for example to recommend a good book, or to notify the news on the PirateBox. Maybe it can serve to give a warning to the people about some socio cultural event or news. I probably keep the chat, and of course, I love the Media Center it has generated. I would like to see what my PirateBox had. You could help me with this as well as for the buyer of the TP-Link Router. I hope you can also connect an access point (for example the Tl-wa7210n of TP-Link) so that the signal reaches the majority of the inhabitants at home.


Thank you very much for your kind attention.

Erik Gonzalez
@erikgc7
Re: [PHP] [LibraryBox] Mediacenter mod (like Kodi)
April 16, 2017 05:58AM
damavox Wrote:
-------------------------------------------------------
> created a link in the index.html file located in
> /opt/piratebox/www/.
> Link created was pointed to
> /mnt/usbshare/share/mediacenter/

Hey I just realised it, link only have to point to 'mediacenter' (or ..\mediacenter) use non-direct link, this is www
Re: [PHP] [LibraryBox] Mediacenter mod (like Kodi)
April 16, 2017 06:49AM
Hi guys, this project is still on hold, got less time, now that piratebox updated with good stuff, I should try on it too.
If you think of it, this was mainly for me reading XBMC structure, JPG companion files, decrypting CBZ, CBR, PDF, MP3, and Ebook. With that challenge that I was missing all the multimedia libs, I had the knowledge to enter and manipulate those formats from scratch, but i am stuck on pdf, and this is the biggest part, cause it's a bin file.
-Ebook : 100% done, just put an ebook and you'll get automaticaly cover
-XBMC/jpg companion : 80% done, depending how much you're lazy, you can add any jpg OR a full XBMC folder, however I still have to do the TV series pages, that is basically just a little more complex copy of movies
-CBZ/CBR : 0% done, but it's just zipped jpg, no challenge here.
-MP3 : 10% done, right now it works just with folder.jpg in a square shape, I tought it's enough and it didn't need to enter the file for Tags.
-PDF : 30% done that's the number of PDF I could decrypt from Librarybox, unfortunally I cannot go further for now.

Project was left in restructuration as I mentionned, next step, if i find time is to make separate php for languages and extracting formats. And to be more versatile with number of categories.

However, since then I had a kid, a job, and I just turned off my big wired librarybox since it didn't have any connections in a year. Also, since I turned on the "splashdog" mod on my both pirate/librarybox, lots of stuff went down like ftp, making it really harder to code. Basicaly I have to recreate/update boxes before working on it again, but I do still think the splashdog should be included, that's the missing option you get from all free wifi spot.

And for all graphic ajustments, I don't feel really involved, it's good that you all change it the way you want, because it's what it's made for, that's the main reason I was focusing on separate extracting core code and languages. Maybe next challenge would include multiple designs ?

Sorry for still keeping this unfinnished.
Do not worry friend. The time will come when you finish it. Congratulations on your son.
I will try to do something with LibraryBox. I hope to customize the homepage.
Greetings and thanks