MattsShack / Plex-Movie-Poster-Display

Scraps the Plex sessions page to display the current playing movie or TV show poster on a screen.
https://www.mattsshack.com
GNU General Public License v3.0
129 stars 30 forks source link

Font Enhancements #44

Open ZeroCoolGOS opened 3 years ago

ZeroCoolGOS commented 3 years ago

Due to the growing popularity to the font system. there are a few enhancements I would like to make to the system.

  1. Add "Clear Fonts" to clear out all custom uploaded fonts.

  2. Add a check to see if a font file is supported within a zip file

  3. Add support for multiple font formats (eg. OTF)

  4. Update the "Unzip" to not unzip to the root of the fonts folder but to unzip to its "Zip File Name" for better organization

  5. Using the "Zip File Name" folder method, append the name to the actual name of the font file when displaying in the lists. Currently it only uses the name of the font file itself and and can become a bit harder to identify the type we require.

  6. When unzipping the fonts, only unzip the font files supported and ignore all other files and folders. This will allow for a cleaner storage and organization.

  7. Remove _MACOSX folder when unzipping.

EDIT 2021-03-24:

titelies commented 3 years ago

Not sure how to get my custom font working again after updating 2.10. Left fonts folder alone, ran update, when rebooted fonts on MPD showed as generic in sample on page and also on Poster TV. Deleted all font folders within /var/www/html/cache/fonts, used the Browse and Upload of my saved Bundle but it's still generic font type. Any advice would be appreciated.

ZeroCoolGOS commented 3 years ago

How did you run your update?

Can you check to see what is now in the fonts folder and let me know if it unpacked correctly via the Browser?

ZeroCoolGOS commented 3 years ago

I think I see the issue your seeing. I'm digging into it now.

titelies commented 3 years ago

After doing the update, the fonts weren't working so I went into the cache/fonts folder and removed each of the font folders and just left the fonts_custom.css file. I then used the Browse and Upload of my downloaded bundle and the font folders will all put back into the cache/fonts folder but it still has a generic font and not the one selected from the dropdown menu.

ZeroCoolGOS commented 3 years ago

Ya, im now seeing that too. I'm working on tracking down the bug.

ZeroCoolGOS commented 3 years ago

I have submitted a PR for @MattsShack to approve that contains the font display fix. It will be in build 2.10.1

titelies commented 3 years ago

Outstanding! Do I need to empty the fonts folder or leave the way it is now with all of the font folders and the fonts_custom.css file? Will I need to do a Browse & Upload of the font bundle again?

ZeroCoolGOS commented 3 years ago

No. You should not need to empty and re-upload your font folder.

The fonts_custom.css gets regenerated when you hit the fonts page so just navigate to that and it should refresh.

I am also experimenting with a "FULL BACKUP" to also backup the fonts and the config files. So in future that will be easier to move around and update.

ZeroCoolGOS commented 3 years ago

@titelies v2.10.1 should now be ready and should fix your font problem.

titelies commented 3 years ago

Spectacular! Thanks again Geoff... once the top text vertical alignment is resolved... Coming Soon will be perfect! Thank you sir!

ZeroCoolGOS commented 3 years ago

No problem.

What font and font size are you using so I can try and us that to test against for the Now Showing?

Also are you having the issue with Coming Soon?

I will try and get to this issue this week and have a PR for Matt next week as he mentioned to me that he is out of town this week, so I don't want to bother him too much and just stack up the fixes.

titelies commented 3 years ago

I edited my comment, I meant the Coming Soon but obviously I use the same font and size for the Now Showing as well. I am using the Avengers font: https://famfonts.com/avengers-movie/ After adjusting overscan in /boot/config.txt it got better but I just have to use a smaller font than I would like. Currently, using size 100 but I think if the alignment were in the center and not at the top, I believe 130 or 140 might fit. And the specific custom font is called AVENGEANCE HEROIC AVENGER BI With the larger top font: https://i.imgur.com/NABadBM.jpg with the 100 font: https://i.imgur.com/5W47eni.jpg (and it's right at the edge of the top of the screen)

ZeroCoolGOS commented 3 years ago

Cool.

I will give it a try. I am not currently working with the RPi at this time, so I have not been playing with the boot/config file so I will see when it comes to at the code level vs hardware level

ZeroCoolGOS commented 3 years ago

@titelies

After further investigation I have determined that the font is actually centered. The issue is the field that the text in is set to 10% of the display so with such a large font size it exceeds the 10% threshold.

I am looking at different options for workarounds.

Keeping the 10/80/10 ratio is the most ideal. If I was to scale up the title, then I would have to scale down the poster itself and I don't think that would be a look we are going for. So I think the best way would be to scale down if it exceeds the 10% threshold.

I have tested on 3 devices and get 3 different results so the font display is inconsistent anyways due to size.

Still more research is required.

titelies commented 3 years ago

I completely agree with the 10/80/10 but that's still strange, only cause I am running the same font and size on the top and bottom and the bottom one looks perfect but the top text is right on the edge of the top of the screen (left edge, if TV were mounted horizontally). The bottom text size 100 has more words and perfectly centered horizontally and vertically while the top isn't. Weird! Thanks for looking into it.

ZeroCoolGOS commented 3 years ago

@titelies I am still working on the font "center" issue

But with this build (2.10.2) you will now be able to use the Mr Robot font and other fonts that are otf files.

The file upload will not (yet) allow you to upload the file individually but you will be able to use the zip file.

Also just as a note: You can always export your uploaded fonts into a single zip file for a later restore so you dont have to add one at a time.

Use the "Download Bundle" option.

Since its also a zip file you can fully modify that zip and create your own bundle and restore that.

titelies commented 3 years ago

@ZeroCoolGOS Sounds good Geoff. Looking forward to the alignment fix at some point :100: I like the generate bundle feature for the Fonts, just as a backup and restore. When version 3 becomes available it's going to be outstanding! I unfortunately don't have the skills to do what you do but testing and quality assurance I can handle. :1st_place_medal:

ZeroCoolGOS commented 3 years ago

I'm just learning as I go.

But ya, the more people test helps us fix bugs we may miss.

I don't know how the v3 thing is working as this is referring v3 but it's been versioned as v2.

I just keep processing and trying to make things better for everyone.

titelies commented 3 years ago

@ZeroCoolGOS Noticed that the Movie Poster Display Footer link to the Github page was mixed in with my Installed fonts and samples instead of at the bottom of the page. https://i.imgur.com/sgBq9Gk.png

ZeroCoolGOS commented 3 years ago

Yup. I saw that too and will be fixed in the next push.

titelies commented 3 years ago

Seem to still have issues with the Custom Fonts... Blade Runner, Terminator, Tron which are .TTF fonts still shows up as generic fonts. Mr. Robot .OTF caused the Nginx Bad Gateway error again until I removed the folder and rebooted. I'm assuming 'Clear Fonts' you mentioned in the updates refers to the Clear Cache button for fonts, not sure when to use that exactly or if I need to...

ZeroCoolGOS commented 3 years ago

Ok. I will try those fonts for testing.

I used the mr robot font and it was working so I am not sure why your getting the bad gateway. I will have to do more investigation. I am not currently testing on an RPi directly so I wonder if it's a direct hardware issue.

Also sometimes it helps to clear the browser cache for the fonts to show up.

As for the clear fonts button, yes it's the "clear cache" for the fonts. I am not sure when someone might need it but it could come in handy. I used it for testing as I ran into a glitch and it helped me identify the glitch. Better to have it and not need it and need it and not have it.

Also depending on the implementation you may not have direct access to the files so this is another option.

ZeroCoolGOS commented 3 years ago

It looks like the MACOSX folder is extracting. I thought that would be addressed when I am only pulling the font files. I guess it is not. Can you try and remove the MACOSX again and see if it fixes the gateway problem?

I will make sure to remove that explicitly this time.

I am digging into why Tron, Terminator and Blade Runner fonts are not showing. I believe they where working in the past so I am not sure why the could be broken.

Edit

I know what the issue is with the other fonts. The file ext is uppercase where the CSS is lower case so I will look at how to address this issue.

titelies commented 3 years ago

I wondered if the issue was the CAPS, I should've mentioned it. So, if I manually change the name to lowercase, it will fix the issue? Going to give it a try and remove the MACOSX folder to see what occurs.

ZeroCoolGOS commented 3 years ago

yes. If you lowercase the extension then that should fix it.

titelies commented 3 years ago

Tron and Mr Robot keep causing a Bad Gateway when trying to go back to the General page, even after removing the MACOSX folder. Removing those fonts after adding them gets rid of the Bad Gateway issue on the General page.

ZeroCoolGOS commented 3 years ago

Interesting.

Sorry that it's  causing you issues. I will try and see what I can do and how I can get it fixed.

ZeroCoolGOS commented 3 years ago

I am now seeing the bad gateway issues and I am trying to chip away at them. Hope to have a fix by the end of the weekend.

titelies commented 3 years ago

Font issues and Bad Gateway seemed to be solved. As always, thank you for the updates @ZeroCoolGOS !

titelies commented 3 years ago

So, I am able to upload new fonts using the Font Config without Bad Gateway error. However, it looks like any of the new fonts I test, no matter what filetype, will produce a generic font. Terminator, Tron, Mr. Robot, Ghostbusters, Knight Rider, Godzilla, Friday the 13th, The Crow, etc. Should I Clear Font Cache and try again?

Also, when I first uploaded them on Font Config page the Samples were previewing correctly with the desired font, now the new fonts have all changed to generic font sample previews. https://i.imgur.com/ADL20Ex.png

ZeroCoolGOS commented 3 years ago

That is odd.

I know that some fonts don't show up as nice as they should for some text. I would try a Ctrl+F5 to see if it clears the preview up.

If that does not work, try and clear the fonts and re add them.

And if that still does not work. please provide the font_custom.css so I can review how its generating for you to make sure that its coming out correctly.

I just uploaded a few of the fonts mentioned and most seemed to work for me. image

titelies commented 3 years ago

The Font Clear Cache and Import worked!

ZeroCoolGOS commented 3 years ago

Good.

You should not need to do that but its good that that worked.

ZeroCoolGOS commented 3 years ago

ToDo: