You are not logged in.
if weatherbuttonbutton==1 and videobutton==1 thenis that a typo?
in the above you would need the video button outside of the control of the weather button, if you wanted the video to play on launching the weather section
here you would need to click the weatherbutton to open the section then click the videobutton to launch the video
or is this what you had in mind?
but either way, this method should prevent multiple instances of the movie from launching
Last edited by mrpeachy (2012-08-23 19:18:13)
Offline

Yea a typo in the script.. Thats why I stick to art!! 
Peachy's Wun Lua / Peachy's v9000 / Conky PitStop / My DA Page
........
Offline
I am thinking that the button should only be available
if the weatherbutton is active as it is a sub-section of the weatherbutton.
On the other hand I could make it a standalone button.
Peachy's Wun Lua / Peachy's v9000 / Conky PitStop / My DA Page
........
Offline
Yea a typo in the script.. Thats why I stick to art!!
And why I stick to watching both 'script work' and 'art'.
Offline
--videobutton button
local videobuttonx=105
local videobuttony=wthb
local videobuttonw=45
local videobuttonh=45
--calculate if click was inside box
if localx>=videobuttonx and localx<=videobuttonx+videobuttonw and localy>=videobuttony and localy<=videobuttony+videobuttonh and videobutton~=1 then
videobutton=1
elseif localx>=videobuttonx and localx<=videobuttonx+videobuttonw and localy>=videobuttony and localy<=videobuttony+videobuttonh and videobutton==1 then
videobutton=0
end
if weatherbutton==1 and videobutton==1 then
os.execute("~/lua/conky_video &")
elseif videobutton==0 then--turn videobutton off
end --videobutton functionOk Peachy these adjustments work super except clicking the videobutton does not kill the video.
I can kill it by closing out the mplayer in my taskbar that the script opens.
My cpu stays at about 15% which is acceptable considering what we just accomplished. 
Perhaps a killall can be added somewhere after
elseif videobutton==0 then--turn videobutton off??
Scratch that.. It still opens multiple instances of mplayer.
Perhaps a function that tells it to only have one running..
Last edited by falldown (2012-08-23 20:26:34)
Peachy's Wun Lua / Peachy's v9000 / Conky PitStop / My DA Page
........
Offline
wonder if you can change your bash script to play video then turn off
like
# open playlist and play
mplayer -geometry 25%:35% -xy $percentpx -fixed-vo /home/falldown/test-0000.mpeg && pkill -nf 'test-0000'Offline
^ I don't think that will work unless mplayer closes when the video ends.
It also won't stop mplayer if he collapses the weather section before the video has finished playing.
Offline

Crazy suggestion, but
Could a function be called from one conky to start and stop a separate conky?
That separate conky could execute the video without needing to update..
does that make sense?
Peachy's Wun Lua / Peachy's v9000 / Conky PitStop / My DA Page
........
Offline
if button==1 then
-execute bash with the conky -c path/to/file-
end
if button==0 then
-execute bash with kill conky -c path/to/file-
end??
Peachy's Wun Lua / Peachy's v9000 / Conky PitStop / My DA Page
........
Offline
I thought that I was on to something.
Peachy's Wun Lua / Peachy's v9000 / Conky PitStop / My DA Page
........
Offline
so what is the issue that needs to be resolved?
Offline
Multiple instances of the video start.. my cpu shots up to 100% and my system freezes.
I can not turn the button off.
Peachy's Wun Lua / Peachy's v9000 / Conky PitStop / My DA Page
........
Offline
^ I don't think that will work unless mplayer closes when the video ends.
when falldown was running mplayer without & conky started to reposnd again after the movie finished, so i would guess && would work to activate pkill after the video plays
It also won't stop mplayer if he collapses the weather section before the video has finished playing.
this could be overcome by something like...
if weatherbutton==0 then
local f=io.popen("pgrep -nf 'test-0000'")
mrun=f:read("*a")
close ()
end
if tonumber(mrun)~=nil then
os.execute("pkill -nf 'test-0000' ")
endOR don't close the weather section before the movie finishes 
Last edited by mrpeachy (2012-08-23 21:39:08)
Offline
Yea, me too I added:
${execp conky -c ~/conky/test261b.cpu1.conky}to
~/conky/test261a.cpu1.conkyThe results required a [AltGr]+[PetSys]+[k] to clear up the mess. 
The conkys were the same:
TEXT
${lua conky_draw_bg 15 0 0 0 0 0x000000 0.5}
GPU: ${nvidia gpufreq} MHz
Video: ${nvidia memfreq} MHzexcept for:
gap_x 25
gap_y 25and
gap_x 300
gap_y 25What a mess!!!!!
Offline
Multiple instances of the video start.. my cpu shots up to 100% and my system freezes.
I can not turn the button off.
multiple instances and high cpu are solved here http://crunchbanglinux.org/forums/post/254060/#p254060 correct?
so just need a way to have mplayer shutdown once the movie finishes?
or an execute type button to stop mplayer
set up the button just like videobutton
then
if stopbutton==1 then
kill mplayer
stopbutton=0
end
Last edited by mrpeachy (2012-08-23 21:40:49)
Offline
this could be overcome by something like...
if weatherbutton==0 then local f=io.popen("pgrep -nf 'test-0000'") mrun=f:read("*a") close () end if tonumber(mrun)~=nil then os.execute("pkill -nf 'test-0000' ") endOR don't close the weather section before the movie finishes
Yes I was trying to get something like that setup for him before but he decided to try something else (buttons).
I was still trying to work out how to detect what was running on his system, it's hard to do remotely.
I had not figured out if ${if_running} worked on command lines or not yet.
Last edited by arclance (2012-08-23 21:43:20)
Offline
Peachy's Wun Lua / Peachy's v9000 / Conky PitStop / My DA Page
........
Offline
i think this is a case of having to try it out myself
but that wont be today unfortunately... or tomorrow for that matter
but congratulations falldown on the progress so far... who needs conky 2.0? 
Offline
Here is something that will work I was trying to make this more complicated than it needed to be.
mplayer_running = false --# this goes where you set global variables when your script is loaded
--#### This is added to you existing toggle button ####
if button_state == 1 then
if mplayer_running == false then
os.execute("~/lua/conky_video &")
mplayer_running = true
end
else
if mplayer_running == true then
os.execute('pkill -f ".*mplayer.*/test-0000.mpeg"')
os.execute('pkill -f ".*/lua/conky_video"')
mplayer_running = false
end
endWhen the button is activated (open) if the global variable "mplayer_running" is "false" your bash script is started and "mplayer_running" is set to "true".
When the button is closed if the global variable "mplayer_running" is "true" the mplayer process and bash script are killed and "mplayer_running" is set to "false".
Last edited by arclance (2012-08-23 22:09:35)
Offline
Sorry guys, but I was making a video to show how it was reacting I had to do a hard reset.. 
All I can say is that when I run the bash from terminal everything runs smooth, but once I start it from conky with
os.execute("~/lua/conky_video &")All H*LL breaks loose!!
The cpu and ram% spike to max and I have about 100 mplayer instances running.
Also on another note when I first started this video project I was using..
out({,a=1,txt=conky_parse"${exe /home/falldown/lua/conky_video}"})which ran well excluding the fact that the conky wouldn't respond.
Last edited by falldown (2012-08-23 23:22:02)
Peachy's Wun Lua / Peachy's v9000 / Conky PitStop / My DA Page
........
Offline
^ See my previous post, I figured out how to make it work.
Offline
Here is something that will work I was trying to make this more complicated than it needed to be.
mplayer_running = false --# this goes where you set global variables when your script is loaded --#### This is added to you existing toggle button #### if button_state == 1 then if mplayer_running == false then os.execute("~/lua/conky_video &") mplayer_running = true end else if mplayer_running == true then os.execute('pkill -f ".*mplayer.*/test-0000.mpeg"') os.execute('pkill -f ".*/lua/conky_video"') mplayer_running = false end endWhen the button is activated (open) if the global variable "mplayer_running" is "false" your bash script is started and "mplayer_running" is set to "true".
When the button is closed if the global variable "mplayer_running" is "true" the mplayer process and bash script are killed and "mplayer_running" is set to "false".
Well the video starts but quickly opens another instance.. then another before I have a chance to kill it.
Peachy's Wun Lua / Peachy's v9000 / Conky PitStop / My DA Page
........
Offline
^ Post the code for your whole weather button so I can see if you integrated it correctly.
It is easy to setup it up wrong.
I know it works I use a similar setup here to only start a script once.
Offline
Ok so I had to move
mplayer_running = falseabove
click_start=1It appears to work, but I will test some more.
Thanks everyone for your help! 
Last edited by falldown (2012-08-23 23:49:07)
Peachy's Wun Lua / Peachy's v9000 / Conky PitStop / My DA Page
........
Offline
^ You have not posted your script yet so I don't know where "click_start=1" is so could you clarify something for me.
Assuming this is not he "mplayer_running = false" in the button code, where does that put "mplayer_running = false" in your script?
It should not be inside any functions, but be at the top below the "require" lines.
Last edited by arclance (2012-08-23 23:54:06)
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.