SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#726 2012-08-23 19:16:54

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: interactive conky

if weatherbuttonbutton==1 and videobutton==1 then

is 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

Be excellent to each other!

#727 2012-08-23 19:21:18

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,726

Re: interactive conky

lol
Yea a typo in the script.. Thats why I stick to art!! lol

Offline

#728 2012-08-23 19:25:53

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,726

Re: interactive conky

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.

Offline

#729 2012-08-23 19:26:50

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 13,408
Website

Re: interactive conky

falldown wrote:

lol
Yea a typo in the script.. Thats why I stick to art!! lol

And why I stick to watching both 'script work' and 'art'.

Offline

#730 2012-08-23 19:33:19

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,726

Re: interactive conky

--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 function

Ok 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. big_smile

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)

Offline

#731 2012-08-23 20:25:34

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: interactive conky

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

#732 2012-08-23 20:28:12

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 935

Re: interactive conky

^ 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

#733 2012-08-23 20:39:09

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,726

Re: interactive conky

lol
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?

Offline

#734 2012-08-23 20:42:56

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,726

Re: interactive conky

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

??

Offline

#735 2012-08-23 21:17:16

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,726

Re: interactive conky

I thought that I was on to something.

Offline

#736 2012-08-23 21:20:52

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: interactive conky

so what is the issue that needs to be resolved?

Offline

#737 2012-08-23 21:35:49

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,726

Re: interactive conky

Multiple instances of the video start.. my cpu shots up to 100% and my system freezes.
I can not turn the button off.

Offline

#738 2012-08-23 21:37:03

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: interactive conky

arclance wrote:

^ 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' ")
end

OR don't close the weather section before the movie finishes big_smile

Last edited by mrpeachy (2012-08-23 21:39:08)

Offline

#739 2012-08-23 21:37:58

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 13,408
Website

Re: interactive conky

Yea, me too I added:

${execp conky -c ~/conky/test261b.cpu1.conky}

to

~/conky/test261a.cpu1.conky

The results required a [AltGr]+[PetSys]+[k] to clear up the mess.  sad

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} MHz

except for:

gap_x 25
gap_y 25

and

gap_x 300
gap_y 25

What a mess!!!!!

Offline

#740 2012-08-23 21:38:43

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: interactive conky

falldown wrote:

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

#741 2012-08-23 21:41:32

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 935

Re: interactive conky

mrpeachy wrote:

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' ")
end

OR don't close the weather section before the movie finishes big_smile

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

#742 2012-08-23 21:41:54

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,726

Re: interactive conky

my plan was to have the video play in the planet sensor section..
trekv9000opened7.jpg
when the weather button is open.

Offline

#743 2012-08-23 21:49:54

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: interactive conky

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? big_smile

Offline

#744 2012-08-23 22:03:32

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 935

Re: interactive conky

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
end

When 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

#745 2012-08-23 23:21:32

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,726

Re: interactive conky

Sorry guys, but I was making a video to show how it was reacting I had to do a hard reset.. mad
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)

Offline

#746 2012-08-23 23:23:03

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 935

Re: interactive conky

^ See my previous post, I figured out how to make it work.

Offline

#747 2012-08-23 23:39:39

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,726

Re: interactive conky

arclance wrote:

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
end

When 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.

Offline

#748 2012-08-23 23:45:31

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 935

Re: interactive conky

^ 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

#749 2012-08-23 23:46:20

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,726

Re: interactive conky

Ok so I had to move

mplayer_running = false

above

click_start=1

It appears to work, but I will test some more.


Thanks everyone for your help! big_smile

Last edited by falldown (2012-08-23 23:49:07)

Offline

Be excellent to each other!

#750 2012-08-23 23:52:34

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 935

Re: interactive conky

^ 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

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo