Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
Show OSD plugin variables?
Show OSD plugin variables?
I wish to show filename playing on screen. But I could find nothing for variables for Show OSD is their no variables for items like filename, time, ect?
Re: Show OSD plugin variables?
You can show whatever you want with python. Just put the code you want inside a curly brace {} pair, whatever is in there is interpreted by python.
So, the most common use is with the event variables, like {eg.event.string} or {eg.event.payload}.. Just as an example you could have a plugin that stores the current filename from your media player in a variable and then show it with ShowOSD {eg.myplugin.fileplaying}. It's really upto you how you use it.
-jinxdone
So, the most common use is with the event variables, like {eg.event.string} or {eg.event.payload}.. Just as an example you could have a plugin that stores the current filename from your media player in a variable and then show it with ShowOSD {eg.myplugin.fileplaying}. It's really upto you how you use it.
-jinxdone
Re: Show OSD plugin variables?
Ok so the Show OSD plugin does not have default variables than? Other remote management software If I wanted current time I would use a show OSD and have a variable like %time% and time would be what displayed. So ShowOSD plugin is useless for my needs than.. so how would I show the filename than? Really be nice if someone did create a OSD plugin with common variable types that make it quick to show something like filename, time, ect. One thing uICE did very well.jinxdone wrote:You can show whatever you want with python. Just put the code you want inside a curly brace {} pair, whatever is in there is interpreted by python.
So, the most common use is with the event variables, like {eg.event.string} or {eg.event.payload}.. Just as an example you could have a plugin that stores the current filename from your media player in a variable and then show it with ShowOSD {eg.myplugin.fileplaying}. It's really upto you how you use it.
-jinxdone
Re: Show OSD plugin variables?
No no. In fact ShowOSD is far more flexible than that. When you put code inside the curly braces {} you are infact evaluating Python code with the eval() statement. (through eg\Utils.py ParseString function). Essentially the user is free to run whatever code he wants to, there is no artificial limit imposed by %% tags. If we used that approach the user would be restricted to whatever tag functions the plugin author has coded. Probably there would never be enough of them, right?
For example:
- To show current date, try ShowOSD with something like; "The current date is: {eg.Utils.time.strftime('%Y-%m-%d')}"
- To get the current playing song from winamp with the winamp plugin; {eg.plugins.Winamp.GetPlayingSongTitle()}
Alternatively:
Instead of executing the code directly in ShowOSD, you can run an action just before the ShowOSD, which will return some data and put it in the eg.result variable, which you can then show with {eg.result}. Simple.
OR
Instead of running a ready made action, you could just as well run a python script just before your ShowOSD action. In this script you can do whatever you like and put the result for example in the eg.result (or any other) variable. Example script
OR
You can skip using the ShowOSD action entirely and just call it from a Python Script instead. like so..
OR
Use the EG event system (with eg.TriggerEvent) to pass some data to the ShowOSD action. This would be accessible with {eg.event.*}
I hope this explained a bit the possibilities there are for passing data between the EG actions. What is actually needed is some better documentation, tutorials and use case examples for the most common commands. My advice is to use the PyCrust shell (in EG window's help -> Python Shell) and browse the eg NameSpace to see what is available.
If these concepts are unfathomable I recommend first reading a programming book about any programming language. Preferrably a Python book.
----
The real question is; do we want to make EG easy enough for the average joe who has 0 programming ability to use? Sort of one click deal with a GUI for everything? This would bloat the program really fast and I think it's not easily archieved with such a small developer and userbase. It's especially pointless since I think EG appeals to exactly the kind of tech savvy users who have atleast a general idea what programming is.
If something should be improved, it's the way EG passes data between events and actions. This would make building complex configurations even easier and more powerful using only the config tree, which is already EG's strong point. For example it would be great to be able to get the eg.result value from a number of past actions, not just the latest one that finished.
These are just my thoughts on it and may not be what BitMonster or other people have planned for EG.
-jinxdone
For example:
- To show current date, try ShowOSD with something like; "The current date is: {eg.Utils.time.strftime('%Y-%m-%d')}"
- To get the current playing song from winamp with the winamp plugin; {eg.plugins.Winamp.GetPlayingSongTitle()}
Alternatively:
Instead of executing the code directly in ShowOSD, you can run an action just before the ShowOSD, which will return some data and put it in the eg.result variable, which you can then show with {eg.result}. Simple.
OR
Instead of running a ready made action, you could just as well run a python script just before your ShowOSD action. In this script you can do whatever you like and put the result for example in the eg.result (or any other) variable. Example script
Code: Select all
import time
eg.result = time.time()You can skip using the ShowOSD action entirely and just call it from a Python Script instead. like so..
Code: Select all
import time
eg.plugins.EventGhost.ShowOSD(
u'TEST: ' + str(time.time()), # This line is the text of the ShowOSD command..
u'0;-24;0;0;0;700;0;0;0;1;0;0;2;32;Arial',
(255, 255, 255),
(0, 0, 0),
0,
(0, 0),
0,
3.0,
False
)Use the EG event system (with eg.TriggerEvent) to pass some data to the ShowOSD action. This would be accessible with {eg.event.*}
I hope this explained a bit the possibilities there are for passing data between the EG actions. What is actually needed is some better documentation, tutorials and use case examples for the most common commands. My advice is to use the PyCrust shell (in EG window's help -> Python Shell) and browse the eg NameSpace to see what is available.
If these concepts are unfathomable I recommend first reading a programming book about any programming language. Preferrably a Python book.
----
The real question is; do we want to make EG easy enough for the average joe who has 0 programming ability to use? Sort of one click deal with a GUI for everything? This would bloat the program really fast and I think it's not easily archieved with such a small developer and userbase. It's especially pointless since I think EG appeals to exactly the kind of tech savvy users who have atleast a general idea what programming is.
If something should be improved, it's the way EG passes data between events and actions. This would make building complex configurations even easier and more powerful using only the config tree, which is already EG's strong point. For example it would be great to be able to get the eg.result value from a number of past actions, not just the latest one that finished.
These are just my thoughts on it and may not be what BitMonster or other people have planned for EG.
-jinxdone
Re: Show OSD plugin variables?
Jinx, thanks for the explanation.. I see how to make items like time and date show now.. but what class or winapi do I need to find the command to get the current filename? I wish to display with playtime in MPC-Home the filename while looking inside of MediaPlayerClassic plugin their is none for calling the current playing file.
Re: Show OSD plugin variables?
Well.. It looks like the MPC plugin actions simply send a windows message to the MPC window, so it can't be used to retrieve data. Looks like you could check what file is playing either from the MPC's webinterface or maybe grab the filename from the title of the MPC window.
Re: Show OSD plugin variables?
Ok that is what I have done.. now I have a serious problem with my OSD display though.. The display doesn't come out right it messes up my playtime bar and the text is too large for the filename. Is their perhaps a method to show more than one line of OSD at a time so I can have a different font size for it?jinxdone wrote:Well.. It looks like the MPC plugin actions simply send a windows message to the MPC window, so it can't be used to retrieve data. Looks like you could check what file is playing either from the MPC's webinterface or maybe grab the filename from the title of the MPC window.
Code: Select all
Find_MPC_Time=eg.WindowMatcher(u'mpc-hc.exe', u'{*}Media Player Classic{*}', u'MediaPlayerClassicW', None, u'Static', 2, True, 0.0, 0)
hwnd = Find_MPC_Time()
if len(hwnd) > 0:
if eg.globals.WindowsState == "Fullscreen": howManyBars = 60
if eg.globals.WindowsState != "Fullscreen": howManyBars = 80
timeE,timeR = eg.WinApi.GetWindowText(hwnd[0]).split(' / ')
secArray = timeE.split(':')
secArrayTotal = timeR.split(':')
secondsTotal = int(secArrayTotal[0])*(60)+int(secArrayTotal[1])
secondsElapsed = int(secArray[0])*(60)+int(secArray[1])
percent = (secondsElapsed*howManyBars)/secondsTotal
text = eg.globals.grabbedText
osd = "[" + "|"*(percent) + " "*(howManyBars-percent) + "]" + "\n" + " "*30 + timeE + " / " + timeR
osd2 = text + "\n" + osd
if eg.globals.WindowsState != "Fullscreen":
eg.plugins.EventGhost.ShowOSD(osd2, u'0;-64;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (0, 255, 255), (0, 0, 0), 4, (0, 0), 0, 1.0, False)
else:
eg.plugins.EventGhost.ShowOSD(osd, u'0;-64;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (0, 255, 255), (0, 0, 0), 4, (0, 0), 1, 1.0, False)
Re: Show OSD plugin variables?
is it possible to use something from the network event reciever to display with the OSD. I am sending the current song in winamp to a computer to show what song is playing, but would like it to show up on the OSD. I am using a wild card for the action trigger, but need to figure out how to catch the event from the network event reciever.
thanks for the assistance!
Drabert
thanks for the assistance!
Drabert