Simple EG Database

Do you have questions about writing plugins or scripts in Python? Meet the coders here.

Simple EG Database

Postby kgschlosser » Fri Sep 11, 2015 3:17 am

I have made a kind of database for EG, I used and modified a MySQL plugin I found here on the forums but every query took exactly 2.7 seconds far to slow for storing things like remote codes and what have you.

so what I have done is created a kind of database that will save and load to/from a file.

and it removes the complications of having to learn the different standard python data types.

it is not yet finished but I am stuck with trying to make the actions appear properly in EG.

attached is the plugin. and there are things that still have yet to be finished buy any ideas and or suggestions would be really appreciated.

and how and what exactly I am doing wrong when using the AddAction.

Thanks again
Attachments
__init__.py
(19.92 KiB) Downloaded 88 times
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
 
Posts: 2515
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Simple EG Database

Postby kgschlosser » Tue Sep 15, 2015 2:52 am

ok problem sorted with the Action name and descriptions. still a work in progress. but here is the newest version.



K
Attachments
__init__.py
(19.58 KiB) Downloaded 83 times
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
 
Posts: 2515
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Simple EG Database

Postby kgschlosser » Thu Sep 17, 2015 2:33 am

Added a transfer Action.

Completed the delete Action.

Refined the load and save Actions.

To Do -
Checking for directory existence on the load and save.
Load and Save to MySQL Database.
Load and Save to MSSQL Database.

Timer feature for automatic save (gonna need some help with that one I think)

Any Suggestions and or Errors please let me know.

Thanks

K
Attachments
__init__.py
(22.6 KiB) Downloaded 77 times
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
 
Posts: 2515
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Simple EG Database

Postby kgschlosser » Sun Sep 27, 2015 2:27 am

I have attached a more updated version. and is actually working properly. LOL

if you happen across any notifications that have swears in them let me know as sometimes i do that because i get aggravated when trying to get something to run right.

It has been about a week or so since i modified the plugin last so i don't remember exactly what changes i made but I know i did make a lot this time around.

if you move the plugin the the Autostart tree to the top it will load first.

one major modification i added was an event is triggered as soon as the plugin is done loading. since eventghost all plugins first before it registers an init command i found this useful as a true Eventghost just started Event and not one that runs after all plugins have loaded first. Purpose for that is if you have script errors on occasion from something that you have happening using the main.init event that's because one of your plugins events is dependant on say a variable that needs to be set when EG loads. problem is if the plugin loads before the variable is set and error will occur. this is a solution to that problem.

I just found it useful

just remember you have to move the plugin to the top of the Autostart tree. that way the event will trigger before any other plugin loads.

what I have personally done since I have a highly modified version of the HarmanKardon plugin running (to be honest i don't think there is much original code left) and that plugin contains over 600 line items as well as all the serial commands is i have moved all of these items into a common location. as well as my smart TV It centralizes management a lot.
Attachments
__init__.py
(23.7 KiB) Downloaded 91 times
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
 
Posts: 2515
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Simple EG Database

Postby pearbear » Wed Nov 09, 2016 7:46 am

This plugin was causing the translation editor(eventghost -translate command line option) to not load. The problem was caused by the line:
Code: Select all
text = Text

in the action classes. I have managed to fix this issue while still allowing the issues to share the strings from the Text class. The updated plugin is attached.
Attachments
__init__.py
SystemDatabase plugin patched for translation editor compatibility.
(23.75 KiB) Downloaded 56 times
pearbear
Experienced User
 
Posts: 150
Joined: Mon Apr 02, 2012 10:28 pm

Re: Simple EG Database

Postby kgschlosser » Thu Nov 10, 2016 7:54 am

ok i re wrote the thing. chopped it down to about 500 lines or so. and the horrible thing is that 60-70% of those lines are for backwards compatibility so it will function as it does now. otherwise it would have been maybe 200 lines.

but i do need someone's save file to test the thing with. the version i am running on my setup has a lot of alterations and causes problems during conversion. so i would like to use someone's save file for a more "real world" testing
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
 
Posts: 2515
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA


Return to Coding Corner

Who is online

Users browsing this forum: No registered users and 1 guest