Shutdown/Suspend function

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
MacUsers Offline
Fan
Posts: 407
Joined: Jun 2009
Reputation: 0
Location: London, UK
Post: #1
Dear developers,

First off, thanks very much for bringing in this skin to us; I see a lot of potentials. Just started using this, so bear with me with my silly question.

First thing I noticed, this skin follows the "default behavior" for the shutdown function (just like the others), which defined in the "Settings", i.e. either shutdown or suspend at any given time. What I was trying to do is to put XBMC/HTPC in the sleep/suspend mode after a certain amount of inactivity and when I press "Shutdown" button in the the shutdown menu (s on keyboard), I'd like to do a proper shutdown of the machine, like when I go to bed at night. To do that, I looked in the "DialogButtonMenu.xml" and found that 4 times XBMC.ShutDown() have been called as "Shutdown Button".
Code:
xbmc@asus: PAL16x9$ grep -n ">XBMC.ShutDown()<" DialogButtonMenu.xml
271:            <onclick>XBMC.ShutDown()</onclick>
617:            <onclick>XBMC.ShutDown()</onclick>
998:            <onclick>XBMC.ShutDown()</onclick>
1429:           <onclick>XBMC.ShutDown()</onclick>
1728:           <onclick>XBMC.ShutDown()</onclick>
Why we need the very same function four times?. What I'm trying to do is replace this line: <onclick>XBMC.ShutDown()</onclick> by <onclick>System.Exec(/usr/bin/sudo /sbin/shutdown -h now) to get a proper shutdown, whilst "idle" would trigger the "suspend". Is it possible with your skin?

My second question is: How can I add/delete item to/from the individual sub-menu on the Home screen? e.g.when on the homescreen, if I select "Music" and then pres "down arrow" on the remote, a little submenu slides down. What is the file that makes that submenu? Cheers!!

MONEUAL 320B | ASUS P5Q-VM | Core2Duo E6320 | GeForce GT220 | Kingston KVR 800Mz HyperX DDR2 4GB (2 x 2GB) | UJ-120 BD-ROM | Pioneer VSX-920-K | KEF KHT3005SE-W | Panasonic TH-37PV500B | Ubuntu 10.04 | XBMCbuntu [ v10.0, r35648 ]
find quote
topfs2 Offline
Team-XBMC Developer
Posts: 3,962
Joined: Dec 2007
Reputation: 9
Post: #2
There exist a XBMC.Powerdown which will turn off the computer no matter what the default action is set.

However I definatly think that there should be a powerdown button in the shutdowndialog

If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
djdafreund Offline
Skilled Skinner
Posts: 562
Joined: Dec 2005
Reputation: 0
Location: Atlanta
Post: #3
This will be looked into. Wink
find quote
Sharpe Offline
Skilled Skinner
Posts: 1,014
Joined: Jul 2006
Reputation: 12
Location: North West England
Post: #4
Hi MacUsers - let's see then..

MacUsers Wrote:...Why we need the very same function four times?. What I'm trying to do is replace this line: <onclick>XBMC.ShutDown()</onclick> by <onclick>System.Exec(/usr/bin/sudo /sbin/shutdown -h now) to get a proper shutdown, whilst "idle" would trigger the "suspend". Is it possible with your skin?

It's there 4 times for 4 different possible conditions you may have - involving the use of profiles or using the master lock. I'm sorry I'm not quite getting what it is you would like to do (it's early and my head hurts!) - Are you saying you can't currently shutdown the computer whilst it's idle? And that you would like an independent of settings power switch - as topfs2 has suggested?

MacUsers Wrote:My second question is: How can I add/delete item to/from the individual sub-menu on the Home screen? e.g.when on the homescreen, if I select "Music" and then pres "down arrow" on the remote, a little submenu slides down. What is the file that makes that submenu? Cheers!!

The sub-menu items are located in the Home.xml (they are at the bottom of the code within <content>...</content>)
find quote
MacUsers Offline
Fan
Posts: 407
Joined: Jun 2009
Reputation: 0
Location: London, UK
Post: #5
Thanks to both of you - XBMC.Powerdown worked just fine. Now I've started getting a really functioning system - proper PowerDown from the Shutdowm menu and system go to Suspend after a certain amount of inactivity.

Anyone care about replying to me second question - How can I modify the sub-menu to add/delete some item? Or maybe what file I need to edit? Really appreciate any input. cheers!!

MONEUAL 320B | ASUS P5Q-VM | Core2Duo E6320 | GeForce GT220 | Kingston KVR 800Mz HyperX DDR2 4GB (2 x 2GB) | UJ-120 BD-ROM | Pioneer VSX-920-K | KEF KHT3005SE-W | Panasonic TH-37PV500B | Ubuntu 10.04 | XBMCbuntu [ v10.0, r35648 ]
find quote
MacUsers Offline
Fan
Posts: 407
Joined: Jun 2009
Reputation: 0
Location: London, UK
Post: #6
MacUsers Wrote:Anyone care about replying to me second question - How can I modify the sub-menu to add/delete some item? Or maybe what file I need to edit? Really appreciate any input. cheers!!
Well, I've figured out by myself - it's Home.xml in the 720p directory. Looking at the file structure, it seems to me that the files are are all over the places, e.g. "Shutdown Menu" is in the PAL16x9 but home screen in 720p directory, etc. Does it have to be like this way? Cheers!!

MONEUAL 320B | ASUS P5Q-VM | Core2Duo E6320 | GeForce GT220 | Kingston KVR 800Mz HyperX DDR2 4GB (2 x 2GB) | UJ-120 BD-ROM | Pioneer VSX-920-K | KEF KHT3005SE-W | Panasonic TH-37PV500B | Ubuntu 10.04 | XBMCbuntu [ v10.0, r35648 ]
find quote
MacUsers Offline
Fan
Posts: 407
Joined: Jun 2009
Reputation: 0
Location: London, UK
Post: #7
Sharpe Wrote:Are you saying you can't currently shutdown the computer whilst it's idle? And that you would like an independent of settings power switch - as topfs2 has suggested?
Not exactly. what I mean is: presently the Shutdown button just follows what specifies in the System > Power Saving option for the Shutdown Function - if it's "Suspend" in there, then pressing the "Shutdown Button" (in the Shutdown Menu), just puts the computer in sleep, rather proper system shutdown. If "Shutdown" is specified instead, only then the Shutdown Button will shutdown the computer. As far as I understand, that's the default behavior of XBMC.Shutdown() function, which is actually used in the skin. Now, for example, if you you like to put your HTPC in sleep automatically after 10 mins. (or so) inactivity during the day time and want to shutdown the computer properly at night, when you go to bed, with the default/standard coding that doesn't work - the "Shutdown Button" either works as "Shutdown" or "Suspend". Using XBMC.Powerdown() function solves this issue.

Sharpe Wrote:The sub-menu items are located in the Home.xml (they are at the bottom of the code within <content>...</content>)
I haven't noticed that you already answered about Home.xml, sorry about that. But again, I see there three sets of <content>...</content> and only the last one has effects on the sub-menu. What are the other two for? Another thing, the Home.xml is the 720p directory while rest of the stuff in the PAL16x9 directory. Does it have to be like this? Cheers!!

MONEUAL 320B | ASUS P5Q-VM | Core2Duo E6320 | GeForce GT220 | Kingston KVR 800Mz HyperX DDR2 4GB (2 x 2GB) | UJ-120 BD-ROM | Pioneer VSX-920-K | KEF KHT3005SE-W | Panasonic TH-37PV500B | Ubuntu 10.04 | XBMCbuntu [ v10.0, r35648 ]
find quote
Sharpe Offline
Skilled Skinner
Posts: 1,014
Joined: Jul 2006
Reputation: 12
Location: North West England
Post: #8
MacUsers Wrote:I haven't noticed that you already answered about Home.xml, sorry about that. But again, I see there three sets of <content>...</content> and only the last one has effects on the sub-menu. What are the other two for? Another thing, the Home.xml is the 720p directory while rest of the stuff in the PAL16x9 directory. Does it have to be like this? Cheers!!

The other <content> controls either relate to the film strip items (for the small and default size controls) or a different set of submenu controls for the different film strip options.

Re the 720p thing - It doesn't have to be like that - it just is for now. Eventually it will all be in the 720p folder when I get the time to scale everything up.

Cheers
find quote
MacUsers Offline
Fan
Posts: 407
Joined: Jun 2009
Reputation: 0
Location: London, UK
Post: #9
Sharpe Wrote:The sub-menu items are located in the Home.xml (they are at the bottom of the code within <content>...</content>)
I think I need some help here: I started editing the Music sub-menu to put my selected streaming radio stations in there. So, I added my "Streaming Radio" directory to the Music source; this is the sources.xml after that:
Code:
<music>
        <default pathversion="1"></default>
        <source>
            <name>Music</name>
            <path pathversion="1">/home/xbmc/Music/iTunes/iTunes Music/</path>
        </source>
        <source>
            <name>Streaming Radio</name>
            <path pathversion="1">/home/xbmc/Music/Streaming Radio/</path>
        </source>
</music>

Then I added these to the Home.xml
Code:
<item id="25">
    <description>Internet Streaming Radio</description>
    <label>Web Radio</label>
    <onclick>SetFocus(21)</onclick>                                          
    <onclick>xbmc.ActivateWindow([color=blue]MusicFiles[/color],Streaming Radio,Return)</onclick>
    <visible>Container(11).HasFocus(7)</visible>
</item>
to get one like this:

[Image: 5033167611_7c72e1ce73_z.jpg]

Now the problem is: with this "Web Radio" opens/works just fine but if I click on Music itself (*not* the sub-menu elements) I get the very same screen in stead of my music library.

If I change it to [INDENT]<onclick>xbmc.ActivateWindow(MusicLibrary,Streaming Radio,Return)</onclick>[/INDENT] then Music works fine but I get a nothing for "Web Radio". Any idea what am I missing? I did that very same thing in Rapier and that worked but not working for Back Row. Could you please tell me what am I doing wrong? cheers!!

MONEUAL 320B | ASUS P5Q-VM | Core2Duo E6320 | GeForce GT220 | Kingston KVR 800Mz HyperX DDR2 4GB (2 x 2GB) | UJ-120 BD-ROM | Pioneer VSX-920-K | KEF KHT3005SE-W | Panasonic TH-37PV500B | Ubuntu 10.04 | XBMCbuntu [ v10.0, r35648 ]
find quote
Sharpe Offline
Skilled Skinner
Posts: 1,014
Joined: Jul 2006
Reputation: 12
Location: North West England
Post: #10
Sure - it's because currently the main music control content says this:

Code:
<item id="7">
    <label>2</label>
    <icon>Listen Music.png</icon>
    <thumb>Listen Music.png</thumb>
    <onclick>SetFocus(21)</onclick>
    <onclick>XBMC.ActivateWindow(MyMusic)</onclick>
    <visible>!Skin.HasSetting(Music)</visible>
</item>

It just opens up what you were last looking at - to default it to the music library you would need change the XBMC.ActivateWindow(MyMusic) line.
find quote
MacUsers Offline
Fan
Posts: 407
Joined: Jun 2009
Reputation: 0
Location: London, UK
Post: #11
Sharpe Wrote:It just opens up what you were last looking at - to default it to the music library you would need change the XBMC.ActivateWindow(MyMusic) line.
Thanks Sharpe for your [Live] support; you rock!!
So, what should I change it to? Like this?
[INDENT]xbmc.ActivateWindow(MusicLibrary,Music,Return)[/INDENT]
Or is there any thing (env_variable??) already defined for "Music Library", other than fixing static route? Cheers!!

MONEUAL 320B | ASUS P5Q-VM | Core2Duo E6320 | GeForce GT220 | Kingston KVR 800Mz HyperX DDR2 4GB (2 x 2GB) | UJ-120 BD-ROM | Pioneer VSX-920-K | KEF KHT3005SE-W | Panasonic TH-37PV500B | Ubuntu 10.04 | XBMCbuntu [ v10.0, r35648 ]
find quote
Sharpe Offline
Skilled Skinner
Posts: 1,014
Joined: Jul 2006
Reputation: 12
Location: North West England
Post: #12
Other than, like you say, specifying where in the library the control will take you to, there aren't any other variables I can think of. eg - this takes you to albums etc...

Code:
<onclick>xbmc.activatewindow(musiclibrary,Albums,return)</onclick>
find quote
MacUsers Offline
Fan
Posts: 407
Joined: Jun 2009
Reputation: 0
Location: London, UK
Post: #13
Sharpe Wrote:Other than, like you say, specifying where in the library the control will take you to, there aren't any other variables I can think of. eg - this takes you to albums etc...
hummm.........
How can I always bring up this page/menu

[Image: 5036074866_123ea0d03f_z.jpg]

regardless of where I were last time? Is it possible? Cheers!!

MONEUAL 320B | ASUS P5Q-VM | Core2Duo E6320 | GeForce GT220 | Kingston KVR 800Mz HyperX DDR2 4GB (2 x 2GB) | UJ-120 BD-ROM | Pioneer VSX-920-K | KEF KHT3005SE-W | Panasonic TH-37PV500B | Ubuntu 10.04 | XBMCbuntu [ v10.0, r35648 ]
find quote
MacUsers Offline
Fan
Posts: 407
Joined: Jun 2009
Reputation: 0
Location: London, UK
Post: #14
Just ignore my previous question; figured out by myself: XBMC.ActivateWindow(MusicLbrary)
Cheers!!

EDIT: sorry, I was wrong; that didn't answer my previous question. So, my question is still valid.

MONEUAL 320B | ASUS P5Q-VM | Core2Duo E6320 | GeForce GT220 | Kingston KVR 800Mz HyperX DDR2 4GB (2 x 2GB) | UJ-120 BD-ROM | Pioneer VSX-920-K | KEF KHT3005SE-W | Panasonic TH-37PV500B | Ubuntu 10.04 | XBMCbuntu [ v10.0, r35648 ]
(This post was last modified: 2010-09-29 15:16 by MacUsers.)
find quote
Sharpe Offline
Skilled Skinner
Posts: 1,014
Joined: Jul 2006
Reputation: 12
Location: North West England
Post: #15
MacUsers Wrote:hummm.........
How can I always bring up this page/menu

regardless of where I were last time? Is it possible? Cheers!!

This should do it -

Code:
<onclick>xbmc.activatewindow(musiclibrary,root)</onclick>
find quote