Sign up here and you can log into the forum!

SheetMaker for Linux

Everything (else) to do with Movie Sheets and homebrew firmware on the WDTV(s), including how the %*#^ do I get them working?

Re: SheetMaker for Linux   

Postby bunyip1 » Wed Jul 27, 2016 12:30 am

mad_ady wrote:@bunnyip: I think you're overcomplicating things :) Here's something new to try - how about windows 10 new "linux shell" feature? You could install perl, modules and everything and use an Xserver for display and have a single code. True, not all windows versions are supported, but at least it will be futureproof.
http://www.howtogeek.com/261575/how-to- ... ash-shell/

Hi mad_ady,

Anything to do with MS is over-complicated.

Yes, I have been reading about this with much scepticism. If only life were that simple. It could be a long time before you can run Graphical Linux apps seamlessly this way. And how long before MS start patenting bits of Linux and licensing raises its ugly head.

I'll stick to the real Linux thanks.

BTW: I'm going to have to ban you if you don't start getting my name right :P . I'm not a cute furry animal I'm much more savage (see https://en.wikipedia.org/wiki/Bunyip).
SheetMaker Web: http://bunyipawonga.org
User avatar
bunyip1
DLX'er
 
Posts: 95
Joined: Sat Sep 10, 2011 10:14 pm
Location: Australia

Re: SheetMaker for Linux   

Postby mad_ady » Wed Jul 27, 2016 1:51 am

Yikes, my bad... I remember the "boogie man" reference, but I still read it "BunnyIP" in my head, sorry... :D
User avatar
mad_ady
Developer
 
Posts: 4513
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: SheetMaker for Linux   

Postby mad_ady » Sat Dec 10, 2016 12:28 pm

@bunyip1: I'd like to ask you for your advice. I want to make a script to generate an image (periodically) containing some elements at various offsets. Very much like a moviesheet based on an xml (or some other datatype) template, but the data is arbitrary - (eg. weather, current time, current playing song, etc).
I know your engine already does this, but:
1. Have you encountered/can you recommend a piece of software that already does what I need?
2. If I were to reuse your work, could I:
2.1 Run non-interactivelly and
2.2 Use different tags than moviesheets, but the same general structure
2.3 Feed my data in instead of what got scraped from imdb/etc
2.4 Generate an image of arbitrary dimensions?

If #2 is a viable option can you point me to the relevant blocks of code (I'm fluent in perl)?
Thanks.

PS. Is it possible to use relative positioning in the template? I need to accomodate several resolutions (480x360, 1024x600, 1024x768, 1080p). But I guess one template won't look good...
User avatar
mad_ady
Developer
 
Posts: 4513
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: SheetMaker for Linux   

Postby bunyip1 » Sun Dec 11, 2016 2:13 am

Hi mad_ady,

I don't know of any tools that would do this, but then I never searched for one. Generally find it easier to create my own tools to suit whatever task I need to perform.

The option to re-use SML (now called SMK) code should be relatively easy. Particularly now that I have version 2 almost ready for release.
In version 2, I have separated all functional code groups into individual Perl Packages, so now there is a package called 'SMK_Magick.pm' which houses all the graphical stuff and can be called by any perl script.
If we strip out the SMK stuff (which isn't much) and modify the inputs slightly, then we have a pretty good start on a general image creator.

In the Package there are only three functions you need to consider -
'Canvas' - start a new image of any specified size, either blank or using an existing image.
'Add Text' - add text to the existing canvas - using specified attributes.
'Add Image' - add an external image - using specified attributes.

The simplest approach would be to have your script call these functions and pass a relevant 'XML' data string similar to that used by the moviesheet templates containing all the required attributes for the text or image.

For example to add a bit of text, pass a string like this..
Code: Select all
<TextElement Name="Text" X="38" Y="69" Width="1100" Height="20" AutoSize="False" Multiline="False" Font="Helvetica,10,True,False,False,False,Point,,0" ForeColor="-2500135" StrokeColor="-16777216" StrokeWidth="0" Text="Text I want to appear" TextAlignment="TopLeft" TextQuality="AntiAlias" TGD_IsLocked="False" TGD_IsVisible="True">
<Actions>
<DropShadow Angle="320" Color="-16777216" Distance="3" Opacity="100" Softness="2" TGD_IsVisible="True" />
</Actions>
</TextElement>


The more long-term approach would be to modify the SMK_Magick package inputs to take say an attribute hash from your script.
e.g.
$text_attributes->{width}
$text_attributes->{height}
$text_attributes->{forecolor} .. etc.

As for Documentation, the SMK_Magick.pm code is fairly self explanatory, particularly if you read it in conjunction with one of the templates.
You can also refer to the 'Perl-Magick API' documentation to get a more technical understanding.

The positioning of elements in ImageMagick are absolute x/y pixel co-ordinates from the top left corner of the canvas, but it's easy enough to calculate absolute from relative, since you will know the canvas size and position of each element you have already placed on the canvas.

Let me know what you think - I can provide the 'SMK_Magick.pm' for you to play with.
SheetMaker Web: http://bunyipawonga.org
User avatar
bunyip1
DLX'er
 
Posts: 95
Joined: Sat Sep 10, 2011 10:14 pm
Location: Australia

Re: SheetMaker for Linux   

Postby mad_ady » Sun Dec 11, 2016 12:59 pm

Sounds great! I'd like to play with it (although I'm not sure I'll have time till february, so if you're reworking stuff I can wait).

Regarding the xml structure - is there any formal definition? Did it originate from wdtv's format or is it closer to imagemagik? Also, can you recommend a template editor/previewer?
User avatar
mad_ady
Developer
 
Posts: 4513
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: SheetMaker for Linux   

Postby bunyip1 » Sun Dec 11, 2016 3:46 pm

You have given me something to think about, I'm intrigued by the thought of making a generic version of SMK_Magick.pm. I'm going to do some toying myself.

You can pick up a unaltered version => here if you want to have a look yourself.

You may recall that SheetMaker was born out of need for Linux users to have a tool for their WDTV devices like the popular 'ThumbGen' for windows which had already set data and template standards. So SML was designed to be able to use this data (TGMD files) and existing available templates. So the template documentation came from ThumbGen and he also created a windows-based template editor. You should try and track down his docs and software (they are now open-source).

I'll let you know when I have a 'generic' version of SMK_Magick.pm available, but feel free to experiment on the current one.

Cheers,
bunyip.

(Edited: Spelling)
Last edited by bunyip1 on Mon Dec 12, 2016 3:32 am, edited 1 time in total.
SheetMaker Web: http://bunyipawonga.org
User avatar
bunyip1
DLX'er
 
Posts: 95
Joined: Sat Sep 10, 2011 10:14 pm
Location: Australia

Re: SheetMaker for Linux   

Postby mad_ady » Sun Dec 11, 2016 10:37 pm

I've looked over your code and looks "generic" enough. I don't think you need to modify it much. I was worried that the actual tags (director, plot, synopsis) were somehow hardcoded in the generation process.

I see that the constructor process takes a template or a type (which is not used) and a data reference. Care to share what the data structures you're passing are? I'm not really sure how one passes the actual values. Or are they merged with the template before passing (e.g. the template has the internal variables already replaced)?

Also, I could probably use Common::SMK_Common, since it's referenced.

Thanks!
User avatar
mad_ady
Developer
 
Posts: 4513
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: SheetMaker for Linux   

Postby bunyip1 » Mon Dec 12, 2016 3:37 am

Hi mad_ady,

You can delete the following - they are SMK specific..
use Common::SMK_Common; - (Only needed to link back to the data substitution routines that you wont need).
my $type = shift; - (no longer used and will be dropped in the new version).
remove the whole subroutines "BuildThumbnail" and "GetTrickleCovers".
remove all lines containing reference to 'SMK_Window_GTK' or 'SMK_Common' - (Data substitution again)
You can drop out the section that deals with displaying 'RATINGSTARS'.

One new feature in Version 2 will be the option to generate a sheet using only a Background image and not apply a template (similar to the generation of a Cover). So the '$data' input is optional and is used to specify the path to the 'Background' image.

The SMK method is to build the whole image is one call - all instructions being in the template, so if you want to do this then your script would create it's own run-time template and pass it to the SMK_Magick package.

But if you want to build up an image step by step from your own script you will want to do separate calls for each text or image element you want to add to base image. For this you will need to pass the working image back to SMK_Magick each time you want to add something (similar to the $data input variable mentioned previously).

HOWEVER to make things simpler I have created a modified version of SMK_Magick.pm (with the above changes) to be more generic, and included a test script to illustrate how you might use it.
Get these examples => here.
Last edited by bunyip1 on Mon Dec 12, 2016 3:59 am, edited 1 time in total.
SheetMaker Web: http://bunyipawonga.org
User avatar
bunyip1
DLX'er
 
Posts: 95
Joined: Sat Sep 10, 2011 10:14 pm
Location: Australia

Re: SheetMaker for Linux   

Postby mad_ady » Mon Dec 12, 2016 3:59 am

Thank you for your help.
But your link was wrong. This is the correct link (for posterity): http://bunyipawonga.org/files/imagetest.zip

Your example works correctly. It will be a good base to start off. I'll show off the results once I'm done. The plan is to display date/weather/alarm information on this display: http://www.hardkernel.com/main/products ... 7435282441
User avatar
mad_ady
Developer
 
Posts: 4513
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: SheetMaker for Linux   

Postby bunyip1 » Mon Dec 12, 2016 4:06 am

Yeah I fixed the link - too many http:// leaders.
Sounds good - you could probably cull the bits you dont use out of the final product too.

Cheers,
bunyip.
SheetMaker Web: http://bunyipawonga.org
User avatar
bunyip1
DLX'er
 
Posts: 95
Joined: Sat Sep 10, 2011 10:14 pm
Location: Australia

Previous

Return to Movie Sheet Support & Discussion

Who is online

Users browsing this forum: No registered users and 1 guest