From: <kro...@us...> - 2010-12-19 21:16:13
|
Revision: 4048 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4048&view=rev Author: kroko_koenig Date: 2010-12-19 21:16:06 +0000 (Sun, 19 Dec 2010) Log Message: ----------- so far for this week Modified Paths: -------------- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/gen/mediaportal/remote/R.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/picturesfullscreen.xml trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote03.xml trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MusicDir.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/PostWebserver.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_02.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_03.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaying.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylist.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/pictures.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/picturesfullscreen.java trunk/plugins/AndroidRemote/Release/AndroidRemote.mpe1 trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs trunk/plugins/AndroidRemote/Server/AndroidRemote.suo Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/gen/mediaportal/remote/R.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/gen/mediaportal/remote/R.java 2010-12-19 16:43:47 UTC (rev 4047) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/gen/mediaportal/remote/R.java 2010-12-19 21:16:06 UTC (rev 4048) @@ -85,6 +85,8 @@ public static final int LinearLayout01=0x7f06001a; public static final int LinearLayout02=0x7f060055; public static final int LinearLayout03=0x7f06005f; + public static final int LinearLayout04=0x7f060069; + public static final int LinearLayout05=0x7f06006f; public static final int ListView01=0x7f060028; public static final int TableLayout01=0x7f060005; public static final int TableRow01=0x7f060006; @@ -154,12 +156,22 @@ public static final int btnkey26=0x7f060066; public static final int btnkey27=0x7f060067; public static final int btnkey28=0x7f060068; - public static final int btnkey29=0x7f060069; - public static final int btnkey30=0x7f06006a; - public static final int btnkey31=0x7f06006b; - public static final int btnkey32=0x7f06006c; - public static final int btnkey33=0x7f06006d; - public static final int clearplaylist=0x7f060074; + public static final int btnkey29=0x7f06006a; + public static final int btnkey30=0x7f06006b; + public static final int btnkey31=0x7f06006c; + public static final int btnkey32=0x7f06006d; + public static final int btnkey33=0x7f06006e; + public static final int btnkey41=0x7f060070; + public static final int btnkey42=0x7f060071; + public static final int btnkey43=0x7f060072; + public static final int btnkey44=0x7f060073; + public static final int btnkey45=0x7f060074; + public static final int btnkey46=0x7f060075; + public static final int btnkey47=0x7f060076; + public static final int btnkey48=0x7f060077; + public static final int btnkey49=0x7f060078; + public static final int btnkey50=0x7f060079; + public static final int clearplaylist=0x7f060080; public static final int full_text=0x7f060018; public static final int icon_image=0x7f060001; public static final int icon_text=0x7f060002; @@ -183,18 +195,18 @@ public static final int now_progress=0x7f06001e; public static final int now_stop=0x7f060024; public static final int now_title=0x7f060021; - public static final int open=0x7f060077; - public static final int playlist=0x7f060073; - public static final int rslide=0x7f06007a; - public static final int save=0x7f060076; - public static final int sdcard=0x7f060075; - public static final int send=0x7f060078; - public static final int server_ip=0x7f06006e; - public static final int server_macid=0x7f060070; - public static final int server_port=0x7f06006f; - public static final int slide=0x7f060079; - public static final int title=0x7f060072; - public static final int vibration=0x7f060071; + public static final int open=0x7f060083; + public static final int playlist=0x7f06007f; + public static final int rslide=0x7f060086; + public static final int save=0x7f060082; + public static final int sdcard=0x7f060081; + public static final int send=0x7f060084; + public static final int server_ip=0x7f06007a; + public static final int server_macid=0x7f06007c; + public static final int server_port=0x7f06007b; + public static final int slide=0x7f060085; + public static final int title=0x7f06007e; + public static final int vibration=0x7f06007d; public static final int widget0=0x7f060011; public static final int widget00=0x7f06002a; public static final int widget01=0x7f06002e; Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/picturesfullscreen.xml =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/picturesfullscreen.xml 2010-12-19 16:43:47 UTC (rev 4047) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/picturesfullscreen.xml 2010-12-19 21:16:06 UTC (rev 4048) @@ -2,7 +2,7 @@ android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:id="@+id/full_text" android:layout_width="fill_parent" - android:layout_height="wrap_content" android:text="name" + android:layout_height="wrap_content" android:text="Loading..." android:gravity="center_horizontal" android:background="#FFFFFFFF" android:textSize="20dip" android:textColor="#FF000000" android:textColorHighlight="#FFFFFFFF"> Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote03.xml =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote03.xml 2010-12-19 16:43:47 UTC (rev 4047) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote03.xml 2010-12-19 21:16:06 UTC (rev 4048) @@ -119,15 +119,14 @@ </Button> </LinearLayout> - <LinearLayout android:id="@+id/LinearLayout03" - android:layout_height="wrap_content" + <LinearLayout android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_gravity="center_horizontal" android:layout_width="wrap_content" - android:paddingBottom="5dip"> + android:paddingBottom="5dip" android:id="@+id/LinearLayout04"> <Button android:id="@+id/btnkey29" android:padding="0dip" - android:text=".?123" android:layout_width="64dip" android:layout_height="48dip"> + android:layout_width="64dip" android:layout_height="48dip" android:text="ENTER"> </Button> <Button android:id="@+id/btnkey30" android:padding="0dip" android:layout_height="48dip" android:layout_width="32dip" android:text="/"> @@ -143,5 +142,41 @@ </Button> </LinearLayout> + + <LinearLayout android:layout_height="wrap_content" + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" android:paddingBottom="5dip" android:paddingTop="5dip" android:layout_marginTop="20dip" android:id="@+id/LinearLayout05"> + + <Button android:id="@+id/btnkey41" android:padding="0dip" + android:text="1" android:layout_width="32dip" android:layout_height="48dip"> + </Button> + <Button android:id="@+id/btnkey42" android:padding="0dip" + android:text="2" android:layout_height="48dip" android:layout_width="32dip"> + </Button> + <Button android:id="@+id/btnkey43" android:padding="0dip" + android:text="3" android:layout_width="32dip" android:layout_height="48dip"> + </Button> + <Button android:id="@+id/btnkey44" android:padding="0dip" + android:text="4" android:layout_width="32dip" android:layout_height="48dip"> + </Button> + <Button android:id="@+id/btnkey45" android:padding="0dip" + android:text="5" android:layout_height="48dip" android:layout_width="32dip"> + </Button> + <Button android:id="@+id/btnkey46" android:padding="0dip" + android:text="6" android:layout_width="32dip" android:layout_height="48dip"> + </Button> + <Button android:id="@+id/btnkey47" android:padding="0dip" + android:text="7" android:layout_width="32dip" android:layout_height="48dip"> + </Button> + <Button android:id="@+id/btnkey48" android:padding="0dip" + android:text="8" android:layout_height="48dip" android:layout_width="32dip"> + </Button> + <Button android:id="@+id/btnkey49" android:padding="0dip" + android:text="9" android:layout_width="32dip" android:layout_height="48dip"> + </Button> + <Button android:id="@+id/btnkey50" android:padding="0dip" + android:text="0" android:layout_width="32dip" android:layout_height="48dip"> + </Button> + </LinearLayout> </LinearLayout> Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MusicDir.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MusicDir.java 2010-12-19 16:43:47 UTC (rev 4047) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MusicDir.java 2010-12-19 21:16:06 UTC (rev 4048) @@ -217,7 +217,7 @@ this.dialog.dismiss(); } - if (musicList.size() == 0) { + if (musicList == null) { Toast.makeText(musicDir.this, "TIME OUT SERVER", Toast.LENGTH_SHORT).show(); } else { Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/PostWebserver.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/PostWebserver.java 2010-12-19 16:43:47 UTC (rev 4047) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/PostWebserver.java 2010-12-19 21:16:06 UTC (rev 4048) @@ -74,6 +74,7 @@ // Get response BufferedReader rd = new BufferedReader(new InputStreamReader( socket.getInputStream())); + String line; while ((line = rd.readLine()) != null) { // Process line... Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_02.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_02.java 2010-12-19 16:43:47 UTC (rev 4047) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_02.java 2010-12-19 21:16:06 UTC (rev 4048) @@ -35,6 +35,7 @@ import android.view.View; import android.view.GestureDetector.OnGestureListener; import android.widget.Button; +import android.widget.Toast; public class Remote_02 extends Activity implements OnGestureListener { @@ -119,7 +120,8 @@ Button btnWakeOnLan = (Button) findViewById(R.id.btnWakeOnLan); btnWakeOnLan.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { - PostCommand("wakeonlan"); + Toast.makeText(Remote_02.this, "not implemneted yet. Sorry", + Toast.LENGTH_SHORT).show(); } }); } Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_03.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_03.java 2010-12-19 16:43:47 UTC (rev 4047) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_03.java 2010-12-19 21:16:06 UTC (rev 4048) @@ -123,6 +123,22 @@ Button btn27 = (Button) findViewById(R.id.btnkey27); btn27.setOnClickListener(mClickListener); + // del + Button btn28 = (Button) findViewById(R.id.btnkey28); + btn28.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + PostKey("{BKSP}"); + } + }); + + // enter + Button btn29 = (Button) findViewById(R.id.btnkey29); + btn29.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + PostKey("{ENTER}"); + } + }); + Button btn30 = (Button) findViewById(R.id.btnkey30); btn30.setOnClickListener(mClickListener); @@ -130,7 +146,7 @@ Button btn31 = (Button) findViewById(R.id.btnkey31); btn31.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { - PostKey(" "); + PostKey("{ }"); } }); @@ -138,6 +154,27 @@ btn32.setOnClickListener(mClickListener); Button btn33 = (Button) findViewById(R.id.btnkey33); btn33.setOnClickListener(mClickListener); + + Button btn41 = (Button) findViewById(R.id.btnkey41); + btn41.setOnClickListener(mClickListener); + Button btn42 = (Button) findViewById(R.id.btnkey42); + btn42.setOnClickListener(mClickListener); + Button btn43 = (Button) findViewById(R.id.btnkey43); + btn43.setOnClickListener(mClickListener); + Button btn44 = (Button) findViewById(R.id.btnkey44); + btn44.setOnClickListener(mClickListener); + Button btn45 = (Button) findViewById(R.id.btnkey45); + btn45.setOnClickListener(mClickListener); + Button btn46 = (Button) findViewById(R.id.btnkey46); + btn46.setOnClickListener(mClickListener); + Button btn47 = (Button) findViewById(R.id.btnkey47); + btn47.setOnClickListener(mClickListener); + Button btn48 = (Button) findViewById(R.id.btnkey48); + btn48.setOnClickListener(mClickListener); + Button btn49 = (Button) findViewById(R.id.btnkey49); + btn49.setOnClickListener(mClickListener); + Button btn50 = (Button) findViewById(R.id.btnkey50); + btn50.setOnClickListener(mClickListener); } private void PostKey(String Key) { Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java 2010-12-19 16:43:47 UTC (rev 4047) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java 2010-12-19 21:16:06 UTC (rev 4048) @@ -45,9 +45,11 @@ public class main extends Activity { private static final String PREFS_PRIVATE = "PREFS_MP_REMOTE"; + private Handler mHandler = new Handler(); private static String display = "nothing playing"; private static String state = ""; + private static boolean doUpdate; @Override public void onCreate(Bundle savedInstanceState) { @@ -75,7 +77,7 @@ } - Thread.setDefaultUncaughtExceptionHandler(new TopExceptionHandler(this)); + Thread.setDefaultUncaughtExceptionHandler(new TopExceptionHandler(this)); chkStatus(); SharedPreferences settings = getSharedPreferences(PREFS_PRIVATE, @@ -226,8 +228,8 @@ final android.net.NetworkInfo wifi = connMgr .getNetworkInfo(ConnectivityManager.TYPE_WIFI); - //final android.net.NetworkInfo mobile = connMgr - // .getNetworkInfo(ConnectivityManager.TYPE_MOBILE); + // final android.net.NetworkInfo mobile = connMgr + // .getNetworkInfo(ConnectivityManager.TYPE_MOBILE); if (!wifi.isAvailable()) { Toast.makeText(this, "Warning : Wifi is not available !", @@ -278,12 +280,15 @@ mHandler.removeCallbacks(mUpdateTimeTask); mHandler.postDelayed(mUpdateTimeTask, 1000); + + doUpdate = true; } - + @Override public void onPause() { super.onPause(); + doUpdate = false; mHandler.removeCallbacks(mUpdateTimeTask); } @@ -300,12 +305,10 @@ // automatically done on worker thread (separate from UI thread) protected Void doInBackground(final String... args) { - SharedPreferences settings = getSharedPreferences(PREFS_PRIVATE, - MODE_PRIVATE); + + String HttpServer = Settings.Server; + String HttpPort = Settings.Port; - String HttpServer = settings.getString("Server", "192.168.0.30"); - String HttpPort = settings.getString("Port", "8200"); - nowplayinghandler handler = nowplayinghandler.getinstance(); handler.setconnection(HttpServer, HttpPort); handler.fetchdata(); @@ -314,10 +317,14 @@ && (!nowplayinghandler.PlayerState .equals("no player active"))) { display = nowplayinghandler.Artist + " - " - + nowplayinghandler.Title + - " (" + nowplayinghandler.Actual + ")"; + + nowplayinghandler.Title + " (" + + nowplayinghandler.Actual + ")"; state = nowplayinghandler.PlayerState; } + else + { + display = "nothing playing"; + } return null; } @@ -327,20 +334,18 @@ TextView txt0 = (TextView) findViewById(R.id.main_now_playing); txt0.setText(display); - + ImageButton play = (ImageButton) findViewById(R.id.btn_main_play); - if(state.equals("playing")) - { - play.setImageDrawable(getResources() - .getDrawable(R.drawable.pause)); + if (state.equals("playing")) { + play.setImageDrawable(getResources().getDrawable( + R.drawable.pause)); + } else { + play.setImageDrawable(getResources().getDrawable( + R.drawable.right)); } - else - { - play.setImageDrawable(getResources() - .getDrawable(R.drawable.right)); - } - - mHandler.postDelayed(mUpdateTimeTask, 1000); + + if (doUpdate) + mHandler.postDelayed(mUpdateTimeTask, 1000); } } Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaying.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaying.java 2010-12-19 16:43:47 UTC (rev 4047) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaying.java 2010-12-19 21:16:06 UTC (rev 4048) @@ -13,7 +13,6 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; -import android.content.SharedPreferences; import android.content.res.AssetManager; import android.graphics.Bitmap; import android.os.Bundle; Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylist.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylist.java 2010-12-19 16:43:47 UTC (rev 4047) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylist.java 2010-12-19 21:16:06 UTC (rev 4048) @@ -89,8 +89,9 @@ private Handler mHandler = new Handler(); private static Vibrator vibrate; - final CharSequence[] items = { "Delete item", "Clear playlist", "Cancel" }; + final CharSequence[] items = { "Play item", "Delete item", "Clear playlist", "Cancel" }; private nowplaylisthandler.PlayListItem selectedItem; + private int selectedNo; /** Called when the activity is first created. */ @Override @@ -109,20 +110,27 @@ long arg3) { selectedItem = nowplaylisthandler.PlayList.get(arg2); - + selectedNo = arg2; + AlertDialog.Builder builder = new AlertDialog.Builder(arg0 .getContext()); builder.setTitle(selectedItem.Title); builder.setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { switch (item) { - case 0: + case 0: + PostSelectItem(selectedNo); + mHandler.postDelayed(mUpdateTimeTask, 100); + Toast.makeText(nowplaylist.this, + selectedItem.Title + " has been selected", Toast.LENGTH_SHORT).show(); + break; + case 1: PostDeleteItem(selectedItem.Filename); mHandler.postDelayed(mUpdateTimeTask, 100); Toast.makeText(nowplaylist.this, selectedItem.Title + " has been deleted", Toast.LENGTH_SHORT).show(); break; - case 1: + case 2: PostClear(); mHandler.postDelayed(mUpdateTimeTask, 100); Toast.makeText(nowplaylist.this, "Playlist has been cleared", Toast.LENGTH_SHORT).show(); @@ -171,7 +179,22 @@ post.Post(xml); } + + public void PostSelectItem(int Number) { + PostWebserver post = new PostWebserver(Settings.Server, Settings.Port); + + String xml = ""; + + xml += "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; + xml += "<message>"; + xml += "<command>SELECT_ITEM</command>"; + xml += "<itemNo>" + Number + "</itemNo>"; + xml += "</message>"; + + post.Post(xml); + } + @Override public void onStart() { super.onStart(); Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/pictures.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/pictures.java 2010-12-19 16:43:47 UTC (rev 4047) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/pictures.java 2010-12-19 21:16:06 UTC (rev 4048) @@ -58,14 +58,13 @@ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.pictures); - + mHandler.removeCallbacks(mUpdateTimeTask); mHandler.postDelayed(mUpdateTimeTask, 100); vibrate = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); GridView gridview = (GridView) findViewById(R.id.GridView01); - gridview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { @@ -139,7 +138,7 @@ this.dialog.dismiss(); } - if (pictureList.size() == 0) { + if (pictureList == null) { Toast.makeText(pictures.this, "TIME OUT SERVER", Toast.LENGTH_SHORT).show(); } else { Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/picturesfullscreen.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/picturesfullscreen.java 2010-12-19 16:43:47 UTC (rev 4047) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/picturesfullscreen.java 2010-12-19 21:16:06 UTC (rev 4048) @@ -59,7 +59,7 @@ private boolean slideShow; private boolean randomShow; public static boolean SlideshowPaused = false; - private static long SlideInterval = 6000; + private static long SlideInterval = 5000; /** Called when the activity is first created. */ @Override @@ -73,7 +73,6 @@ gestureScanner = new GestureDetector(picturesfullscreen.this); new setPicture().execute(); - } private class setPicture extends AsyncTask<String, Void, Void> { Modified: trunk/plugins/AndroidRemote/Release/AndroidRemote.mpe1 =================================================================== (Binary files differ) Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs =================================================================== --- trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-12-19 16:43:47 UTC (rev 4047) +++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-12-19 21:16:06 UTC (rev 4048) @@ -123,11 +123,12 @@ // GET int index1 = clientmessage.IndexOf(' '); int index2 = clientmessage.IndexOf(' ', index1 + 1); - string req = clientmessage.Substring(index1 + 1, index2 - index1).Trim().ToLower(); + string req = clientmessage.Substring(index1 + 1, index2 - index1).Trim(); req = HttpUtility.UrlDecode(req); AndroidServer.logDebug("receive HTTP GET : " + req); + System.Diagnostics.Debug.WriteLine("receive HTTP GET : " + req); if (req.StartsWith("/info")) { @@ -148,14 +149,14 @@ } else { - req = req.Replace("/", "\\"); - - if (req.EndsWith(".jpg")) + if (req.ToLower().EndsWith(".jpg")) { + req = req.Replace("/", "\\"); ReplyPictureFile(req); } - else if (req.EndsWith(".thb")) + else if (req.ToLower().EndsWith(".thb")) { + req = req.Replace("/", "\\"); ReplyPictureThumbFile(req); } else @@ -247,10 +248,9 @@ } else { - req = req.Replace("/", "\\"); - - if (req.EndsWith(".mp3")) + if (req.ToLower().EndsWith(".mp3")) { + req = req.Replace("/", "\\"); ReplyMusicFile(req, msgTyp); } else @@ -369,7 +369,7 @@ private void ExceuteCommand(string Message) { AndroidServer.logDebug("execute command"); - System.Diagnostics.Debug.WriteLine(Message); + //System.Diagnostics.Debug.WriteLine(Message); int x = Message.IndexOf("\r\n\r\n"); if ((x > 0) && (x < Message.Length)) @@ -683,7 +683,7 @@ } #endregion - #region clear playlist + #region playlist if (data["command"] == ("REMOVE_PLAYLIST")) { AndroidServer.logDebug("remove from playlist : " + data["filename"]); @@ -710,6 +710,30 @@ playList.Clear(); } + + if (data["command"] == ("SELECT_ITEM")) + { + AndroidServer.logDebug("select playlist : " + data["itemNo"]); + // parameter = itemNo + + PlayListPlayer playlistPlayer = PlayListPlayer.SingletonPlayer; + if (playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_MUSIC) + { + if (playlistPlayer.g_Player.Playing) + { + int sel = Convert.ToInt32(data["itemNo"]); + + PlayList playList = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC); + if (sel < playList.Count) + playlistPlayer.Play(sel); + + } + } + + + + + } #endregion #endregion @@ -720,7 +744,12 @@ IntPtr handle = GUIGraphicsContext.form.Handle; SetForegroundWindow(handle); - SendKeys.SendWait(data["key"]); + if (data["key"] != "{ }") + SendKeys.SendWait(data["key"]); + else + SendKeys.SendWait(" "); + + } #endregion } @@ -822,7 +851,22 @@ else { // dir does not exist - SendErrorURL(Request); + //SendErrorURL(Request); + + string msg = string.Empty; + // header + msg += "HTTP/1.0 200 Ok\r\n"; + msg += "Content-Type: application/xml; charset=utf-8; filename=info.xml" + "\r\n"; + msg += "Proxy-Connection: close" + "\r\n"; + msg += "\r\n"; + // content + msg += "<?xml version=\"1.0\"?>\r\n"; + msg += "<Directory>\r\n"; + msg += "</Directory>\r\n"; + // send + sendMessage(socket, msg); + AndroidServer.logDebug("Reply empty picture dir"); + } #endregion @@ -1208,7 +1252,22 @@ else { // dir does not exist - SendErrorURL(Request); + //SendErrorURL(Request); + + string msg = string.Empty; + // header + msg += "HTTP/1.0 200 Ok\r\n"; + msg += "Content-Type: application/xml; charset=utf-8; filename=info.xml" + "\r\n"; + msg += "Proxy-Connection: close" + "\r\n"; + msg += "\r\n"; + // content + msg += "<?xml version=\"1.0\"?>\r\n"; + msg += "<Directory>\r\n"; + msg += "</Directory>\r\n"; + // send + sendMessage(socket, msg); + AndroidServer.logDebug("Reply empty music dir"); + } #endregion @@ -1964,6 +2023,7 @@ { if (!share.IsFtpShare) { + share.Name = share.Name.Replace("/", "_"); list.Add(share.Name, share.Path); } } @@ -1980,26 +2040,13 @@ } private string GetLocalDir(string Request, Dictionary<string, string> List) { - string folder = string.Empty; - string baseFolder = string.Empty; + string dir = string.Empty; - int x = Request.IndexOf("\\"); - if (x == -1) - { - baseFolder = Request; - } - else - { - baseFolder = Request.Substring(0, x); - folder = Request.Substring(x); - } - - string dir = string.Empty; foreach (KeyValuePair<string, string> pair in List) { - if (pair.Key.ToLower() == (baseFolder.ToLower())) + if (Request.StartsWith(pair.Key)) { - dir = pair.Value + folder; + dir = Request.Replace(pair.Key, pair.Value); return dir; } } Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |