Wednesday, March 23, 2011

More laziness with the XBMC Remote Android App

The XBMC android app is great. I mean really really great. It might just be the best android app on my shiny new Atrix. There is/was one problem though. While the wake on LAN properly wakes my box up, the app has no suspend feature.

Hmm... eerily similar to the situation I ran into a few weeks ago. Luckily the app is GPL and I can have a go at fixing things.

XBMC has a secure auth http port exposed and a second unauthed raw command port for LAN only use. The patch below adds a suspend function that sends json to the raw port, and adds a button on the home screen to call the new function. For now this is just a simple get it done hack (hardcoded hostname/port, not following the code style/convention), but it would be cool to build a nice full featured "Shutdown" menu that enables exit, shutdown, suspend, etc. functionality.

Maybe later. Need sleep now... Self.Suspend()

$ svn di src/org/xbmc/android/remote/presentation/controller/
Index: src/org/xbmc/android/remote/presentation/controller/
--- src/org/xbmc/android/remote/presentation/controller/ (revision 759)
+++ src/org/xbmc/android/remote/presentation/controller/ (working copy)
@@ -21,6 +21,11 @@


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Observable;
@@ -103,8 +108,8 @@
private static final int HOME_ACTION_RECONNECT = 5;
private static final int HOME_ACTION_WOL = 6;
private static final int HOME_ACTION_TVSHOWS = 7;
+ private static final int HOME_ACTION_SUSPEND = 8;

private IInfoManager mInfoManager;

private static final String TAG = "HomeController";
@@ -229,6 +234,7 @@
homeItems.add(new HomeItem(HOME_ACTION_NOWPLAYING, R.drawable.icon_home_playing, "Now Playing", "See what's"));
+ homeItems.add(new HomeItem(HOME_ACTION_SUSPEND, R.drawable.icon_home_power, "Suspend", "Invoke"));

final ArrayList offlineItems = new ArrayList();
@@ -310,6 +316,9 @@
+ doSuspend();
+ break;
if (intent != null) {
@@ -318,6 +327,18 @@

+ private void doSuspend() {
+ try {
+ final Socket mySocket = new Socket("myth.lan", 9090);
+ final PrintWriter out = new PrintWriter(mySocket.getOutputStream(), true);
+ out.println("{\"jsonrpc\": \"2.0\", \"method\": \"System.Suspend\", \"id\": \"1\"}'jsonrpc': \"2.0\", 'method': \"VideoLibrary.ScanForContent\", 'id': \"1\"");
+ out.close();
+ mySocket.close();
+ } catch (IOException e) {
+ }
public void update(Observable observable, Object data) {
if (data instanceof BroadcastListener.Event) {
BroadcastListener.Event event = (BroadcastListener.Event)data;


At December 31, 2021 at 10:56 PM , Blogger unknown said...

Thankyou for sharing.
Universal remote codes

At January 1, 2022 at 12:28 AM , Blogger unknown said...

visit eagleapk and download gloud games mod apk for free. you can also download other mod apks and games

At January 1, 2022 at 1:06 AM , Blogger unknown said...

visit our website fromscratchmag and read guides online and magazines

At January 3, 2022 at 6:38 AM , Blogger unknown said...

visit site and download letspush plugin. Web Push Notification plugin for Wordpress, Woocommerece and BuddyPress.

At January 3, 2022 at 6:39 AM , Blogger unknown said...

Free download ThopTV Pro APK file latest version v45.9.0 for Android and watch live TV channels, movies, series, radio, TV shows

At January 3, 2022 at 6:39 AM , Blogger unknown said...

Thankyou for your kind information.

At January 24, 2022 at 11:42 AM , Blogger kalbbachmeier said...

Casinos with real money - XN - OXN -
Real Money Casinos with 코인카지노 Real Money · The best casino games, 10cric live dealer casino games, 카지노 roulette tables, video poker. · Online Casino with real money.


Post a Comment

Subscribe to Post Comments [Atom]

<< Home