The O-MEGA Project

Questions and comments specific to a particular plugin should go here.
User avatar
kgschlosser
Site Admin
Posts: 5508
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: The O-MEGA Project

Post by kgschlosser » Fri May 29, 2020 4:13 am

Now is always a good time to be making the change. It doesn't have to be something that gets done all at once. it can be done a little at a time. It would be a whole heck of a lot easier to use instead of the webserver plugin.

The thing I like best about flask is that with some back door trickery you can create virtual dynamic pages or paths. I use this mechanism for security purposes. If you have a site where the path is not constant it makes it very hard to attempt to breech.

Say you click on an OK button and it opens a new page at \temp1\index.html. you can click on the exact same OK button except this time it links to \temp2\index.html. the index.html file doesn't really exist. it gets handed back by flask. This is an oversimplification as I use GUID's with the {}'s and -'s removed as the path and i generate the guid at the time the button gets clicked.

Flask does not provide a way to remove routes once they have been added. so in order to not have a memory leak I had to figure out how to go in and remove the routes that would no longer be used. Maybe I should modify the code and do a PR for it. It is a super useful security feature to have.
If you like the work I have been doing then feel free to Image

User avatar
Sem;colon
Plugin Developer
Posts: 813
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: The O-MEGA Project

Post by Sem;colon » Fri May 29, 2020 6:33 am

kgschlosser wrote:
Fri May 29, 2020 4:13 am
Now is always a good time to be making the change. It doesn't have to be something that gets done all at once.
Once you take a look at this you will understand that it would have to be done all at once. The current design is not exactly "flask compatible".
The O-MEGA project is completely built on iFrames to be able to dynamically use html templates or even external content. And also in other terms It's not built like a "normal" website at all.
It would really mean a complete redesign and rewrite from scratch, everything else doesn't make sense. :|
I mean, I could maybe replace the webserver with flask and have it done the exact same thing a webserver does, but I don't see much sense in doing this, as the strength of flask could not be used.
If you like my work, Image me a drink :wink:

User avatar
kgschlosser
Site Admin
Posts: 5508
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: The O-MEGA Project

Post by kgschlosser » Sat May 30, 2020 12:48 am

It would remove the potential issues that can arise because of the webserver being installed 2 times. and one of those times being not being added to the tree so it wouldn't be running in the context in which it was designed to run. Removes a possible problem point for you.

As far as iframes is concerned that shouldn't be to much of an issue either I would imagine. the base page would contain the frames and each frame would point to a path and that path would be set as a flask route.
If you like the work I have been doing then feel free to Image

User avatar
Sem;colon
Plugin Developer
Posts: 813
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: The O-MEGA Project

Post by Sem;colon » Sat May 30, 2020 7:20 am

It would, because the frame structure is dynamically created by JavaScript in the frontend :?
I don't say it's not possible, it just doesn't make sense for this project and the webserver is not working so bad anyway.

However, I do think about shipping a small webserver along with the plugin instead of using the existing webserver plugin. This would not only eliminate potential issues with multiple instances, but also increase performance and security (I would remove the eval() function and everything that's not required for this project - like websockets)
If you like my work, Image me a drink :wink:

steve@rpad
Posts: 48
Joined: Sat May 25, 2013 12:10 pm
Location: Toronto, Canada

Re: The O-MEGA Project

Post by steve@rpad » Thu Jun 04, 2020 6:43 pm

OK Brother, I have my Dunce Cap on, I hope you have on your Patience Hat.

All my posts from here on out....EventGhost Version: 0.5.0-rc6
Win10 Pro, 64-bit (build 18363)
Chrome Version: 83.0.4103.61 (64-bit)

01) Can't seem to close the Dashboard while in fullscreen mode. The red cancel button flashes when clicked or touched but no action. This happens Chrome for Windows and Android 11. Android 5.0.2, Chrome Version 83+ works from fullscreen just fine.

02) Ok, so, I just wanna add a button to a new page I created called MB. I have added a button and I want to send to EG an event "MB.SCREEN.POWER" Before I lose the last bit of my hair, how in the world do I do that?

OK, I think I figured out......Configuration, Add Page, add button to execute within EG on Server.

03) What is HIFI Input? How would I change that? Why would I change that?

04) How can I send different events to eg using your MediaControl template. Where can I go to hook up different events to different buttons? How could I change the text or button layout?

05) I'm a moron. I'm just not understanding it. Read your tutorial many times and still head against wall.
Thanx,

Steve

Win10 Pro - 2004 - 64bit i7-4771 3.50GHz 32GB RAM 60TB Storage
EG - 0.5.0rc6, FileBot - 4.9.1.0, VidCoder 5.21
USBIRT, O-MEGA, DirWatcher, Keyboard, VLC
MediaPortal ...et al.

User avatar
Sem;colon
Plugin Developer
Posts: 813
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: The O-MEGA Project

Post by Sem;colon » Thu Jun 04, 2020 9:46 pm

Hi Steve!
steve@rpad wrote:
Thu Jun 04, 2020 6:43 pm
OK Brother, I have my Dunce Cap on, I hope you have on your Patience Hat.
No worries mate, don't hesitate to ask your questions :D
steve@rpad wrote:
Thu Jun 04, 2020 6:43 pm
01) Can't seem to close the Dashboard while in fullscreen mode. The red cancel button flashes when clicked or touched but no action. This happens Chrome for Windows and Android 11. Android 5.0.2, Chrome Version 83+ works from fullscreen just fine.
I know about that one, seems to be a bug in Chrome's fullscreen API. It was working at some point in the past.. Wouldn't be the first time I found a bug in Chrome :lol:
I didn't do a lot of troubleshooting on this though, but the code doesn't change when you go fullscreen and it works fine when you're not fullscreen :/
For now I recommend you to turn off the "use fullscreen API" setting in the O-MEGA settings menu.
steve@rpad wrote:
Thu Jun 04, 2020 6:43 pm
02) Ok, so, I just wanna add a button to a new page I created called MB. I have added a button and I want to send to EG an event "MB.SCREEN.POWER" Before I lose the last bit of my hair, how in the world do I do that?
Thank you for that question! That's really important to understand. I could imagine that you're struggling with where to find the TriggerEvent feature (it's a function of a PC device) but let me put together a little tutorial where I go into details what all the different settings in that button menu are for and how to use them. (I'll try to create it tomorrow)
steve@rpad wrote:
Thu Jun 04, 2020 6:43 pm
03) What is HIFI Input? How would I change that? Why would I change that?
In the pages configuration menu I guess?
The whole webinterface is a little more multimedia focused than other home automation interfaces and that's one of the multimedia features. First of all you need a device that classifies as AV receiver (I called that HiFi for some.. or no reason), this receiver would need an extension that configures the device specific input variable. The value of that variable you can assign to a page (let's say your page resembles a blue ray player).
Doing this does not only give you the possibility to check and select the appropriate input for your blue ray player from the left hand page selection menu in the web interface, it also would help to determine the active multimedia source (the "actually playing title" in the top menu, active media control) and is required for the "resolve audio dependencies" function you could add in Eventghost to, for example, automatically switch on your AV receiver and select the input for your PC as soon as you hit the play button in VLC.
Sounds complex? Well, as soon as there is an extension for the AV receiver you are using, it's pretty easy to use actually, but you need that extension to use this feature.
Let me know when you plan on creating an extension for your AV ;)
steve@rpad wrote:
Thu Jun 04, 2020 6:43 pm
04) How can I send different events to eg using your MediaControl template. Where can I go to hook up different events to different buttons? How could I change the text or button layout?
The active media control template was designed to use the active media control feature from the O-MEGA system over the webinterface.
All templates that doesn't allow you to edit buttons via the page configuration page are designed for one specific purpose - in the case the use of that feature.
However, you could of course copy and of modify the template to use it with a different extension (e.g. vlc)
steve@rpad wrote:
Thu Jun 04, 2020 6:43 pm
05) I'm a moron. I'm just not understanding it. Read your tutorial many times and still head against wall.
No worries, I know this is a lot to dig through - let's start with buttons and go from there.
I'm sure at some point the whole thing about extensions, templates, devices, programs and interfaces will clear up :)
If you like my work, Image me a drink :wink:

steve@rpad
Posts: 48
Joined: Sat May 25, 2013 12:10 pm
Location: Toronto, Canada

Re: The O-MEGA Project

Post by steve@rpad » Thu Jun 04, 2020 10:55 pm

Nice Thanks Sem; Right after I posted I discovered the trigger event input. I wasn't changing the target I guess. I stumbled into it. lol.

I look forward to whatever you can put together for tutorials. I'm busy with a thousand different things so take your time. I got the button thing working barely. I believe the Dunce Cap was blocking my view.

Also, if your tutorial on adding buttons could include how to change their location on the screen?

Maybe a favor? I know your a kodi user, I'm now using VLC and in order to have the VLC plugin actually work, I need to start VLC with the following additional executable options in order to be able to control the program. If I was within the file browser in O-MEGA and started a video file the VLC plugin would not have any control. Is there anyway to start a video file within O-MEGA file browser using the below command within O-MEGA?

"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --extraintf=rc --rc-host=SERVER:#### --rc-quiet --rc-show-pos
Thanx,

Steve

Win10 Pro - 2004 - 64bit i7-4771 3.50GHz 32GB RAM 60TB Storage
EG - 0.5.0rc6, FileBot - 4.9.1.0, VidCoder 5.21
USBIRT, O-MEGA, DirWatcher, Keyboard, VLC
MediaPortal ...et al.

User avatar
Sem;colon
Plugin Developer
Posts: 813
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: The O-MEGA Project

Post by Sem;colon » Sat Jun 06, 2020 10:39 am

Hey Steve!

Here is the "small" tutorial I put together for creating a button:
viewtopic.php?f=13&t=10502

As for your file browser request - yes, it's possible! You would do it via the "Open with..." button in the browser. But it requires to have an O-MEGA extension for (in your case) VLC in which you need to define some not very obvious settings.
Here is an example about the extension settings of the AIMP extension:
Screenshot_20200606-113742_Chrome.jpg
The important ones for you are "mediaPlayer" and "browserPlaySuffix".
This would list VLC in the "open with" dialog and when you choose to open it with VLC, it would trigger an event including the path to the file as payload. For this event you need to create a macro in EventGhost that opens VLC with the parameters you like (including the file path in the event payload, of course)
If you like my work, Image me a drink :wink:

steve@rpad
Posts: 48
Joined: Sat May 25, 2013 12:10 pm
Location: Toronto, Canada

Re: The O-MEGA Project

Post by steve@rpad » Sat Jun 06, 2020 2:11 pm

Geez, Thanks Sem; You thought of everything. I will get started on a VLC Extension later this week and post my questions. Thanks for your time!
Thanx,

Steve

Win10 Pro - 2004 - 64bit i7-4771 3.50GHz 32GB RAM 60TB Storage
EG - 0.5.0rc6, FileBot - 4.9.1.0, VidCoder 5.21
USBIRT, O-MEGA, DirWatcher, Keyboard, VLC
MediaPortal ...et al.

steve@rpad
Posts: 48
Joined: Sat May 25, 2013 12:10 pm
Location: Toronto, Canada

Re: The O-MEGA Project

Post by steve@rpad » Wed Jun 10, 2020 1:59 pm

Hey Sem;. Gonna start on the Extension and Template for VLC soon. Got sidetracked with my first python script that does more than say "Hello World". I'm using a DirectoryWatcher Event for ePub renaming. I figured out the XML schema of the ePub and can get all my info I need from the OPF details page of the file. Everytime someone buys a book it gets put into certain directory. I then clean, rename, move and add the metadata to an XML file so that I will be able to view it from within your plugin exactly like your API document within the configuration pages. I can also extract the book cover and description, ISBN, yada, yada. Then a new page will be created within OMEGA that give the visual layout of the book. How can I do that?

I'm thinking it's a template again?

I've done my fair share of Excel spreadsheet creations and also have several spreadsheets with my Home info on it. i.e. maintenance schedules, vendor contacts, budgets, equipment specs, parts inventory I wanna put all online as well. 1 stop shop for information for my kids.

I'm preferring the info be embedded rather than popping out like your API Document. I wanna get the basics working, then I can start working JavaScript to change appearances.
Thanx,

Steve

Win10 Pro - 2004 - 64bit i7-4771 3.50GHz 32GB RAM 60TB Storage
EG - 0.5.0rc6, FileBot - 4.9.1.0, VidCoder 5.21
USBIRT, O-MEGA, DirWatcher, Keyboard, VLC
MediaPortal ...et al.

steve@rpad
Posts: 48
Joined: Sat May 25, 2013 12:10 pm
Location: Toronto, Canada

Re: The O-MEGA Project

Post by steve@rpad » Wed Jun 10, 2020 2:01 pm

Hey Sem;. Gonna start on the Extension and Template for VLC soon. Got sidetracked with my first python script that does more than say "Hello World". I'm using a DirectoryWatcher Event for ePub renaming. I figured out the XML schema of the ePub and can get all my info I need from the OPF details page of the file. Everytime someone buys a book it gets put into certain directory. I then clean, rename, move and add the metadata to an XML file so that I will be able to view it from within your plugin exactly like your API document within the configuration pages. I can also extract the book cover and description, ISBN, yada, yada. Then a new page will be created within OMEGA that give the visual layout of the book. sorta like Calibre an ebook management program but much scaled back. How can I do that?

I'm thinking it's a template again?

I've done my fair share of Excel spreadsheet creations and also have several spreadsheets with my Home info on it. i.e. maintenance schedules, vendor contacts, budgets, equipment specs, parts inventory I wanna put all online as well. 1 stop shop for information for my kids.

I'm preferring the info be embedded rather than popping out like your API Document. I wanna get the basics working, then I can start working JavaScript to change appearances. Just need a little push in the right direction.
Thanx,

Steve

Win10 Pro - 2004 - 64bit i7-4771 3.50GHz 32GB RAM 60TB Storage
EG - 0.5.0rc6, FileBot - 4.9.1.0, VidCoder 5.21
USBIRT, O-MEGA, DirWatcher, Keyboard, VLC
MediaPortal ...et al.

User avatar
kgschlosser
Site Admin
Posts: 5508
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: The O-MEGA Project

Post by kgschlosser » Wed Jun 10, 2020 6:18 pm

@steve..

Now this is going to really blow your mind..

we can access that excel spreadsheet from inside of EG :shock: 8)

I do not know of the abilities of this plugin but if I know sem;colon I am pretty sure he has built in a way to populate a page with data from inside of EG. all we would need to do is to collect the data from the spreadsheet and set it to the variables that would be used to "fill in the blanks" on the page.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5508
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: The O-MEGA Project

Post by kgschlosser » Wed Jun 10, 2020 7:01 pm

as far as what you are trying to do with the E books. I can help out with the back end. The front end is something that you would need assistance from sem;colon with. I do not know if there is already a library template built into this plugin or not. If it is it almost entierly has to be handled in python code. This is because javascript is client side. it has no direct access to server files. You would have to use something like PHP to be able to access the server side files or you could use python to do it. If using javascript and python to achieve the goal it would be best to use a websocket connection to handle the transferring of data. This is because the constant opening and closing of a connection does take time. it is really fast only having to do that a single time. But if you have multiple clients requesting data like that and it's massive amounts of data like movie metadata there will be a fairly substantial performance hit.

Now depending on the size of the library the information can be cached to help speed things up. This would require a good amount of ram. that amount could be minimized if only caching the text and not image files. if it is really large you may consider using MySQL to store the textual data, you can either store the image data in the database or you can store it on the file system with the location to it in the database.

you can store the data in a flat file as well if wanted. something like a csv file. It all depends on the side of the library or potentially how large the library can become.

With my HA I have a large amount of data > 10TB. and because I have 5 HTPC's that can access it along with mobile phones, remote connections and touch panels I elected to do a RAID 6 setup and leave everything as files. I get a really high read/write speed from the array. Typically you will not see write speeds as high as read speeds. This is because there is no write caching, or it's not turned on. In most cases the user cannot turn it on. It requires a special HDD controller that allows you to turn it on. It should only be turned on if you have a battery backup for both the raid controller and also the whole computer. and the one for the whole computer has to be large enough so the system can shutdown gracefully and still have about 1/2 of the battery life remaining. On that same server I have 4 SSD's in a RAID 0 array. so striping with no parity. I set up a ram disk and tested the speed and then tested the speed of the raid 0. and the raid 0 was faster. The raid 0 maxed out the bandwidth of the PCIe X8 slot right about 1000MB/s. Ever wonder why when transferring a large file from computer to computer you can never max out the network. wll the network is not what is limiting the transfer speed. It's either the source or destination HDD

My point to this is how you store the data is also going to depend on what your machine is capable of doing. what the Disk technology is and how the drive(s) are set up (single disk, raid, jbod, etc...). how much free ram is available. How large the data set is and what makes up the data set are also extremely important. Nothing is more annoying then having to wait for information to populate because of some kind of a bottleneck somewhere. You also MUST look into your crystal ball and determine how much this data set may grow. This is extremely important because no one likes having to tear the whole thing down and start from scratch. I am not a huge fan of XML. this is because it is a file and that file has to be parsed to collect the data you need. It has a HUGE amount of tags in it. it is extremely complex to deal with and inherently will have a large amount of overhead needed to parse it. with XML it is not something you want to do "on the fly" it is something that you will want to load beforehand and cache. This is going to gobble up memory to achieve that.

Take the time to come up with a solid game plan, one that is going to keep things running for the years to comes. a good plan is always going to provide the best results. Try to think of everything and make the system flexible so any additions or changes can be done with minimal effort. Design it so it makes sense!!!! and keep the Voo Doo magics** to a minimum or not at all.

**Voo Doo magics = operations that are not easily seen or determined making debugging difficult to do.
If you like the work I have been doing then feel free to Image

steve@rpad
Posts: 48
Joined: Sat May 25, 2013 12:10 pm
Location: Toronto, Canada

Re: The O-MEGA Project

Post by steve@rpad » Wed Jun 10, 2020 9:41 pm

hmmm, Ok then, Sem; kg, lol, Not sure of the future, but let us say yeah,..I upgrade to an SQL Database that I populated with my Python code retrieved metadata and at some point some Excel Objects, I write a template for SQL? So let me get this straight...The template is actually HTML/JavaScript/CSS. So as long as I can get the metadata to the front door of your webpage, i.e. The Template? or Extension?, I then am just using the JavaScript/CSS/HTML skills on the web page of particular device for display and formatting of information? Kinda like Classes from C++? Still trying to conceptualize the top line process.

Is the metadata from a epub or MP3/FLAC that large? Literally like what, 10 strings in python plus like an 8kb jpg. I guess times a thousand if the future is the thing, then 1000 x 10 kb over wifi. Ok kg, I see your point.

So if I'ma gonna prep for the future, guess i'ma off to learn some MySQL. geez, never ends. :D

Both you guys are amazingly helpful btw! I'm trying to keep busy in retirement you two are giving me the bug to program again.

Thanks so much!
Thanx,

Steve

Win10 Pro - 2004 - 64bit i7-4771 3.50GHz 32GB RAM 60TB Storage
EG - 0.5.0rc6, FileBot - 4.9.1.0, VidCoder 5.21
USBIRT, O-MEGA, DirWatcher, Keyboard, VLC
MediaPortal ...et al.

User avatar
kgschlosser
Site Admin
Posts: 5508
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: The O-MEGA Project

Post by kgschlosser » Wed Jun 10, 2020 11:13 pm

the SQL query language is pretty simple and not something that I would say you need to "learn" It's not like Python or C/CPP. It is simple

SELECT * FROM SomeTable WHERE SomeColumn LIKE "blah blah"

and in English.

Get all records from SomeTable that have "blah blah" in the entry for column SomeColumn.

It's pretty simple actually.
This is the majority of what you would be doing when querying for information. SQL databases are also nice when backing up data or having multiple users query for the same data.


And what is retirement for?? to do the things you enjoy doing... So on some level you do enjoy programming.
If you like the work I have been doing then feel free to Image

Post Reply