|
From: <kro...@us...> - 2010-11-22 21:52:57
|
Revision: 3967
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3967&view=rev
Author: kroko_koenig
Date: 2010-11-22 21:52:51 +0000 (Mon, 22 Nov 2010)
Log Message:
-----------
use port 8200 as default, add copyright
Modified Paths:
--------------
trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidServer.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote/Setup.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote.suo
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidServer.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidServer.cs 2010-11-22 21:47:27 UTC (rev 3966)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidServer.cs 2010-11-22 21:52:51 UTC (rev 3967)
@@ -1,4 +1,28 @@
-using System;
+#region Copyright (C) 2005-2010 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2010 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+#endregion
+
+using System;
using System.Collections.Generic;
using System.Text;
@@ -48,7 +72,7 @@
using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(dir + "\\MediaPortal.xml"))
{
server= xmlreader.GetValueAsString("android", "server", "192.168.0.30");
- port = xmlreader.GetValueAsString("android", "port", "5050");
+ port = xmlreader.GetValueAsString("android", "port", "8200");
PicturePath = xmlreader.GetValueAsString("android", "pictures",
Environment.GetFolderPath(Environment.SpecialFolder.MyPictures));
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-11-22 21:47:27 UTC (rev 3966)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-11-22 21:52:51 UTC (rev 3967)
@@ -1,4 +1,28 @@
-using System;
+#region Copyright (C) 2005-2010 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2010 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+#endregion
+
+using System;
using System.Collections.Generic;
using System.Text;
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Setup.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/Setup.cs 2010-11-22 21:47:27 UTC (rev 3966)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Setup.cs 2010-11-22 21:52:51 UTC (rev 3967)
@@ -1,4 +1,28 @@
-using System;
+#region Copyright (C) 2005-2010 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2010 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+#endregion
+
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@@ -29,7 +53,7 @@
using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(dir + "\\MediaPortal.xml"))
{
txtServer.Text = xmlreader.GetValueAsString("android", "server", "192.168.0.30");
- txtPort.Text = xmlreader.GetValueAsString("android", "port", "5050");
+ txtPort.Text = xmlreader.GetValueAsString("android", "port", "8200");
txtPic.Text = xmlreader.GetValueAsString("android", "pictures",
Environment.GetFolderPath(Environment.SpecialFolder.MyPictures));
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.
|
|
From: <kro...@us...> - 2010-11-23 13:07:30
|
Revision: 3968
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3968&view=rev
Author: kroko_koenig
Date: 2010-11-23 13:07:24 +0000 (Tue, 23 Nov 2010)
Log Message:
-----------
little bit more comments and structure
Modified Paths:
--------------
trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidRemote.csproj
trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidServer.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote.suo
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidRemote.csproj
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidRemote.csproj 2010-11-22 21:52:51 UTC (rev 3967)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidRemote.csproj 2010-11-23 13:07:24 UTC (rev 3968)
@@ -38,6 +38,7 @@
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
+ <Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Utils, Version=2.2.7.11849, Culture=neutral, processorArchitecture=x86">
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidServer.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidServer.cs 2010-11-22 21:52:51 UTC (rev 3967)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidServer.cs 2010-11-23 13:07:24 UTC (rev 3968)
@@ -41,8 +41,8 @@
public class AndroidServer : IPlugin, ISetupForm
{
private TcpListener myListener;
- private string server = string.Empty;
- private string port = string.Empty;
+ public static string Server = string.Empty;
+ public static string Port = string.Empty;
public static string PicturePath = string.Empty;
public static string MusicPath = string.Empty;
@@ -71,8 +71,8 @@
string dir = Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config);
using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(dir + "\\MediaPortal.xml"))
{
- server= xmlreader.GetValueAsString("android", "server", "192.168.0.30");
- port = xmlreader.GetValueAsString("android", "port", "8200");
+ Server= xmlreader.GetValueAsString("android", "server", "192.168.0.30");
+ Port = xmlreader.GetValueAsString("android", "port", "8200");
PicturePath = xmlreader.GetValueAsString("android", "pictures",
Environment.GetFolderPath(Environment.SpecialFolder.MyPictures));
@@ -87,17 +87,17 @@
{
try
{
- objServer_Log("Try to init command controler " + server + ":" + port);
+ objServer_Log("Try to init command controler " + Server + ":" + Port);
- myListener = new TcpListener(IPAddress.Parse(server), Convert.ToInt32(port));
+ myListener = new TcpListener(IPAddress.Parse(Server), Convert.ToInt32(Port));
myListener.Start();
myListener.BeginAcceptSocket(new AsyncCallback(DoAcceptSocketCallback), myListener);
- objServer_Log("Command controler " + server + ":" + port + " is running");
+ objServer_Log("Command controler " + Server + ":" + Port + " is running");
}
catch
{
- objServer_Log("Failed to init command controler " + server + ":" + port);
+ objServer_Log("Failed to init command controler " + Server + ":" + Port);
}
}
private static void DoAcceptSocketCallback(IAsyncResult ar)
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-11-22 21:52:51 UTC (rev 3967)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-11-23 13:07:24 UTC (rev 3968)
@@ -32,6 +32,7 @@
using System.IO;
using System.Xml;
using System.Drawing;
+using System.Web;
using MediaPortal.GUI.Library;
using MediaPortal.Utils;
@@ -44,8 +45,9 @@
private byte[] read;
private byte[] buffer;
- private static Dictionary<string, Bitmap> myList = new Dictionary<string, Bitmap>();
- private static Dictionary<string, Bitmap> myThumbList = new Dictionary<string, Bitmap>();
+ private static Dictionary<string, Bitmap> pictureList = new Dictionary<string, Bitmap>();
+ private static Dictionary<string, Bitmap> pictureThumbList = new Dictionary<string, Bitmap>();
+ private static Dictionary<string, string> musicList = new Dictionary<string, string>();
public Request(Socket Socket)
{
@@ -83,11 +85,12 @@
else
{
// GET
-
int index1 = clientmessage.IndexOf(' ');
int index2 = clientmessage.IndexOf(' ', index1 + 1);
string req = clientmessage.Substring(index1 + 1, index2 - index1).Trim().ToLower();
+ req = HttpUtility.UrlDecode(req);
+
#region pictures
if (req.StartsWith("/pictures"))
{
@@ -95,12 +98,10 @@
req = req.Replace("/pictures", "");
if (req.StartsWith("/")) req = req.Substring(1);
- req = req.Replace("%20", " ");
-
if (req == "")
{
// root
- SendDir(AndroidServer.PicturePath, "root");
+ ReplyPictureDir(AndroidServer.PicturePath, "root");
}
else
{
@@ -109,16 +110,16 @@
if (req.EndsWith(".jpg"))
{
string orgPath = AndroidServer.PicturePath + "\\" + req;
- SendFile(Path.GetFileName(orgPath));
+ ReplyPictureFile(Path.GetFileName(orgPath));
}
else if (req.EndsWith(".thb"))
{
string orgPath = AndroidServer.PicturePath + "\\" + req;
- SendFileThb(Path.GetFileName(orgPath));
+ ReplyPictureThumbFile(Path.GetFileName(orgPath));
}
else
{
- SendDir(AndroidServer.PicturePath + "\\" + req, req);
+ ReplyPictureDir(AndroidServer.PicturePath + "\\" + req, req);
}
}
}
@@ -131,12 +132,10 @@
req = req.Replace("/music", "");
if (req.StartsWith("/")) req = req.Substring(1);
- req = req.Replace("%20", " ");
-
if (req == "")
{
// root
- SendDirM(AndroidServer.MusicPath, "root");
+ ReplyMusicDir(AndroidServer.MusicPath, "root");
}
else
{
@@ -145,11 +144,11 @@
if (req.EndsWith(".mp3"))
{
string orgPath = AndroidServer.MusicPath + "\\" + req;
- SendFileM(Path.GetFileName(orgPath));
+ ReplyMusicFile(Path.GetFileName(orgPath));
}
else
{
- SendDirM(AndroidServer.MusicPath + "\\" + req, req);
+ ReplyMusicDir(AndroidServer.MusicPath + "\\" + req, req);
}
}
}
@@ -157,7 +156,7 @@
else
{
- SendErrorPage(req);
+ SendErrorURL(req);
}
}
@@ -207,176 +206,236 @@
}
}
- private void SendDir(string dir, string request)
+ private void ReplyPictureDir(string dir, string request)
{
if (Directory.Exists(dir))
{
- myList.Clear();
- myThumbList.Clear();
+ pictureList.Clear();
+ pictureThumbList.Clear();
- sendMessage(socket, "HTTP/1.0 200 Ok\r\n");
- sendMessage(socket, "Content-Type: application/xml; charset=utf-8; filename=info.xml" + "\r\n");
- sendMessage(socket, "Proxy-Connection: close" + "\r\n");
- sendMessage(socket, "\r\n");
-
- sendMessage(socket, "<?xml version=\"1.0\"?>\r\n");
- sendMessage(socket, "<Directory>\r\n");
-
+ 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";
+ // folder
string[] dirs = Directory.GetDirectories(dir, "*.*", SearchOption.TopDirectoryOnly);
foreach (string f in dirs)
{
- sendMessage(socket, "<Folder>" + Path.GetFileName(f) + "</Folder>\r\n");
+ msg += "<Folder>" + Path.GetFileName(f) + "</Folder>\r\n";
}
-
+ //files
string[] files = Directory.GetFiles(dir, "*.jpg", SearchOption.TopDirectoryOnly);
foreach (string f in files)
{
string name = Path.GetFileName(f).ToLower();
- Image img = Bitmap.FromFile(f);
-
- myList.Add(name, (Bitmap)img);
- Bitmap thumb = (Bitmap)img.Clone();
- thumb = MediaPortal.Util.BitmapResize.Resize(ref thumb, 85, 85, false, true);
- myThumbList.Add(name, thumb);
-
- sendMessage(socket, "<File>" + name + "</File>\r\n");
+ Image img = null;
+ try
+ {
+ img = Bitmap.FromFile(f);
+ }
+ catch { }
+ if (img != null)
+ {
+ pictureList.Add(name, (Bitmap)img);
+ Bitmap thumb = (Bitmap)img.Clone();
+ thumb = MediaPortal.Util.BitmapResize.Resize(ref thumb, 85, 85, false, true);
+ pictureThumbList.Add(name, thumb);
+ }
+ msg += "<File>" + name + "</File>\r\n";
}
-
- sendMessage(socket, "</Directory>\r\n");
+ msg += "</Directory>\r\n";
+ // send
+ sendMessage(socket, msg);
}
else
{
- SendErrorPage(request);
+ // dir does not exist
+ SendErrorURL(request);
}
}
- private void SendFile(string File)
+ private void ReplyPictureFile(string File)
{
- if (myThumbList.ContainsKey(File))
+ if (pictureThumbList.ContainsKey(File))
{
- Bitmap bit = myList[File];
+ Bitmap bit = pictureList[File];
byte[] b = BildToByteArray((Image)bit);
if (b != null)
{
- sendMessage(socket, "HTTP/1.0 200 Ok\r\n");
- sendMessage(socket, "Content-Type: image/jpeg" + "\r\n");
- sendMessage(socket, "Content-Length: " + b.Length + "\r\n");
- sendMessage(socket, "Proxy-Connection: close" + "\r\n");
- sendMessage(socket, "\r\n");
-
+ string msg = string.Empty;
+ // header
+ msg += "HTTP/1.0 200 Ok\r\n";
+ msg += "Content-Type: image/jpeg" + "\r\n";
+ msg += "Content-Length: " + b.Length + "\r\n";
+ msg += "Proxy-Connection: close" + "\r\n";
+ msg += "\r\n";
+ sendMessage(socket, msg);
+ // content
sendBytes(socket, b);
}
else
{
- SendErrorPage(File);
+ SendErrorFile(File);
}
}
else
{
- SendErrorPage(File);
+ SendErrorFile(File);
}
}
- private void SendFileThb(string File)
+ private void ReplyPictureThumbFile(string File)
{
- File = File.Replace(".thb", ".jpg");
- if (myThumbList.ContainsKey(File))
+ ///
+ /// we might do cache the thumb different later, right now you need to request the dir first
+ ///
+ File = File.Replace(".thb", "");
+ if (pictureThumbList.ContainsKey(File))
{
- Bitmap bit = myThumbList[File];
+ Bitmap bit = pictureThumbList[File];
byte[] b = BildToByteArray((Image)bit);
if (b != null)
{
- sendMessage(socket, "HTTP/1.0 200 Ok\r\n");
- sendMessage(socket, "Content-Type: image/jpeg" + "\r\n");
- sendMessage(socket, "Content-Length: " + b.Length + "\r\n");
- sendMessage(socket, "Proxy-Connection: close" + "\r\n");
- sendMessage(socket, "\r\n");
-
+ string msg = string.Empty;
+ // header
+ msg += "HTTP/1.0 200 Ok\r\n";
+ msg += "Content-Type: image/jpeg" + "\r\n";
+ msg += "Content-Length: " + b.Length + "\r\n";
+ msg += "Proxy-Connection: close" + "\r\n";
+ msg += "\r\n";
+ sendMessage(socket, msg);
+ // content
sendBytes(socket, b);
}
else
{
- SendErrorPage(File);
+ SendErrorFile(File);
}
}
else
{
- SendErrorPage(File);
+ SendErrorFile(File);
}
}
- private void SendDirM(string dir, string request)
+ private void ReplyMusicDir(string dir, string request)
{
if (Directory.Exists(dir))
{
- sendMessage(socket, "HTTP/1.0 200 Ok\r\n");
- sendMessage(socket, "Content-Type: application/xml; charset=utf-8; filename=info.xml" + "\r\n");
- sendMessage(socket, "Proxy-Connection: close" + "\r\n");
- sendMessage(socket, "\r\n");
+ musicList.Clear();
- sendMessage(socket, "<?xml version=\"1.0\"?>\r\n");
- sendMessage(socket, "<Directory>\r\n");
+ 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";
string[] dirs = Directory.GetDirectories(dir, "*.*", SearchOption.TopDirectoryOnly);
foreach (string f in dirs)
{
- sendMessage(socket, "<Folder>" + Path.GetFileName(f) + "</Folder>\r\n");
+ msg += "<Folder>" + Path.GetFileName(f) + "</Folder>\r\n";
}
string[] files = Directory.GetFiles(dir, "*.mp3", SearchOption.TopDirectoryOnly);
foreach (string f in files)
{
string name = Path.GetFileName(f).ToLower();
- sendMessage(socket, "<File>" + name + "</File>\r\n");
+ musicList.Add(name, f);
+
+ msg += "<File>" + name + "</File>\r\n";
}
-
- sendMessage(socket, "</Directory>\r\n");
+ msg += "</Directory>\r\n";
+ // send
+ sendMessage(socket, msg);
}
else
{
- SendErrorPage(request);
+ SendErrorURL(request);
}
}
- private void SendFileM(string Filename)
+ private void ReplyMusicFile(string Filename)
{
- string dirfFile = AndroidServer.MusicPath + "\\" + Filename;
-
- if (File.Exists(dirfFile))
+ if (musicList.ContainsKey(Filename))
{
- byte[] b = FileToByteArray(dirfFile);
+ string path = musicList[Filename];
- sendMessage(socket, "HTTP/1.0 200 Ok\r\n");
- sendMessage(socket, "Content-Type: audio/mpeg" + "\r\n");
- sendMessage(socket, "Content-Length: " + b.Length + "\r\n");
- sendMessage(socket, "Proxy-Connection: close" + "\r\n");
- sendMessage(socket, "\r\n");
+ if (File.Exists(path))
+ {
+ byte[] b = FileToByteArray(path);
- sendBytes(socket, b);
+ string msg = string.Empty;
+ // header
+ msg += "HTTP/1.0 200 Ok\r\n";
+ msg += "Content-Type: audio/mpeg" + "\r\n";
+ msg += "Content-Length: " + b.Length + "\r\n";
+ msg += "Proxy-Connection: close" + "\r\n";
+ msg += "\r\n";
+ sendMessage(socket, msg);
+ // content
+ sendBytes(socket, b);
+ }
+ else
+ {
+ SendErrorFile(Filename);
+ }
}
else
{
- SendErrorPage(Filename);
+ SendErrorFile(Filename);
}
}
- private void SendErrorPage(string Filename)
+ private void SendErrorURL(string Url)
{
- sendMessage(socket, "HTTP/1.0" + " " +
- "404" + " " + "Not Found" + "\r\n");
- sendMessage(socket, "Content-Type: text/html; charset=utf-8" + "\r\n");
- sendMessage(socket, "Proxy-Connection: close" + "\r\n");
- sendMessage(socket, "\r\n");
-
- sendMessage(socket, "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n");
- sendMessage(socket, "<html><head>" + "\r\n");
- sendMessage(socket, "<title>404 Not Found</title>" + "\r\n");
- sendMessage(socket, "</head><body>" + "\r\n");
- sendMessage(socket, "<h1>Not Found</h1>" + "\r\n");
- sendMessage(socket, "<p>The requested URL " + Filename + " was not found on this server.</p>" + "\r\n");
- sendMessage(socket, "<hr>" + "\r\n");
- sendMessage(socket, "<address>TeamMediaportal Server at 127.0.0.1 Port 5050</address>" + "\r\n");
- sendMessage(socket, "</body></html>" + "\r\n");
+ string msg = string.Empty;
+ // header
+ msg += "HTTP/1.0 404 Not Found\r\n";
+ msg += "Content-Type: text/html; charset=utf-8" + "\r\n";
+ msg += "Proxy-Connection: close" + "\r\n";
+ msg += "\r\n";
+ // message
+ msg += "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n";
+ msg += "<html><head>" + "\r\n";
+ msg += "<title>404 Not Found</title>" + "\r\n";
+ msg += "</head><body>" + "\r\n";
+ msg += "<h1>Not Found</h1>" + "\r\n";
+ msg += "<p>The requested URL " + Url + " was not found on this server.</p>" + "\r\n";
+ msg += "<hr>" + "\r\n";
+ msg += "<address>TeamMediaportal Server at 127.0.0.1 Port 5050</address>" + "\r\n";
+ msg += "</body></html>" + "\r\n";
+ // send
+ sendMessage(socket, msg);
}
+ private void SendErrorFile(string File)
+ {
+ string msg = string.Empty;
+ // header
+ msg += "HTTP/1.0 404 Not Found\r\n";
+ msg += "Content-Type: text/html; charset=utf-8" + "\r\n";
+ msg += "Proxy-Connection: close" + "\r\n";
+ msg += "\r\n";
+ // message
+ msg += "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n";
+ msg += "<html><head>" + "\r\n";
+ msg += "<title>404 Not Found</title>" + "\r\n";
+ msg += "</head><body>" + "\r\n";
+ msg += "<h1>Not Found</h1>" + "\r\n";
+ msg += "<p>The requested file " + File + " was not found on this server.</p>" + "\r\n";
+ msg += "<hr>" + "\r\n";
+ msg += "<address>TeamMediaportal Server at " + AndroidServer.Server + " Port " + AndroidServer.Port + "</address>" + "\r\n";
+ msg += "</body></html>" + "\r\n";
+ // send
+ sendMessage(socket, msg);
+ }
private int readmessage(byte[] ByteArray, ref Socket s, ref String clientmessage)
{
@@ -385,6 +444,7 @@
clientmessage = (String)messagefromclient;
return bytes;
}
+
private void sendMessage(Socket sock, string strMessage)
{
try
@@ -406,7 +466,8 @@
catch { }
}
- public byte[] FileToByteArray(string _FileName)
+
+ private byte[] FileToByteArray(string _FileName)
{
byte[] _Buffer = null;
@@ -437,7 +498,6 @@
return _Buffer;
}
-
private byte[] BildToByteArray(Image Bild)
{
MemoryStream IS = new MemoryStream();
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.
|
|
From: <kro...@us...> - 2010-11-27 16:22:58
|
Revision: 3983
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3983&view=rev
Author: kroko_koenig
Date: 2010-11-27 16:22:51 +0000 (Sat, 27 Nov 2010)
Log Message:
-----------
add database support
Modified Paths:
--------------
trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidRemote.csproj
trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote/Setup.Designer.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote/Setup.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote.suo
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidRemote.csproj
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidRemote.csproj 2010-11-26 12:55:30 UTC (rev 3982)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidRemote.csproj 2010-11-27 16:22:51 UTC (rev 3983)
@@ -35,6 +35,11 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Core.dll</HintPath>
</Reference>
+ <Reference Include="Databases, Version=1.1.1.11856, Culture=neutral, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Databases.dll</HintPath>
+ <Private>False</Private>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-11-26 12:55:30 UTC (rev 3982)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-11-27 16:22:51 UTC (rev 3983)
@@ -23,6 +23,7 @@
#endregion
using System;
+using System.Collections;
using System.Collections.Generic;
using System.Text;
@@ -36,6 +37,7 @@
using MediaPortal.GUI.Library;
using MediaPortal.Utils;
+using MediaPortal.Database;
namespace AndroidRemote
{
@@ -54,147 +56,177 @@
public void DoWork()
{
- string clientmessage = " ";
- string allMessage = string.Empty;
-
- while (socket.Connected)
+ try
{
- read = new byte[1024];
- int bytes = readmessage(read, ref socket, ref clientmessage);
+ string clientmessage = " ";
+ string allMessage = string.Empty;
- if (clientmessage.Contains("Continue"))
+ while (socket.Connected)
{
- AndroidServer.logDebug("receive HTTP Continue");
+ read = new byte[1024];
+ int bytes = readmessage(read, ref socket, ref clientmessage);
- allMessage = allMessage + clientmessage.Substring(0, bytes);
- sendMessage(socket, "HTTP/1.0 100 Continue\r\n");
- sendMessage(socket, "\r\n");
- }
- else
- {
- allMessage = allMessage + clientmessage.Substring(0, bytes);
-
- if (clientmessage.Contains("POST"))
+ if (clientmessage.Contains("Continue"))
{
- AndroidServer.logDebug("receive HTTP POST");
+ AndroidServer.logDebug("receive HTTP Continue");
- sendMessage(socket, "HTTP/1.0 200 OK\r\n");
+ allMessage = allMessage + clientmessage.Substring(0, bytes);
+ sendMessage(socket, "HTTP/1.0 100 Continue\r\n");
sendMessage(socket, "\r\n");
-
- ExceuteCommand(allMessage);
}
else
{
- // GET
- int index1 = clientmessage.IndexOf(' ');
- int index2 = clientmessage.IndexOf(' ', index1 + 1);
- string req = clientmessage.Substring(index1 + 1, index2 - index1).Trim().ToLower();
+ allMessage = allMessage + clientmessage.Substring(0, bytes);
- req = HttpUtility.UrlDecode(req);
+ if (clientmessage.Contains("POST"))
+ {
+ AndroidServer.logDebug("receive HTTP POST");
- AndroidServer.logDebug("receive HTTP GET : " + req);
+ sendMessage(socket, "HTTP/1.0 200 OK\r\n");
+ sendMessage(socket, "\r\n");
- #region pictures
- if (req.StartsWith("/pictures"))
+ ExceuteCommand(allMessage);
+ }
+ else
{
- // handle pictures
- req = req.Replace("/pictures", "");
- if (req.StartsWith("/")) req = req.Substring(1);
+ // GET
+ int index1 = clientmessage.IndexOf(' ');
+ int index2 = clientmessage.IndexOf(' ', index1 + 1);
+ string req = clientmessage.Substring(index1 + 1, index2 - index1).Trim().ToLower();
- if (req == "")
+ req = HttpUtility.UrlDecode(req);
+
+ AndroidServer.logDebug("receive HTTP GET : " + req);
+
+ #region pictures
+ if (req.StartsWith("/pictures"))
{
- // root
- ReplyPictureDir(AndroidServer.PicturePath, "root");
- }
- else
- {
- req = req.Replace("/", "\\");
+ // handle pictures
+ req = req.Replace("/pictures", "");
+ if (req.StartsWith("/")) req = req.Substring(1);
- if (req.EndsWith(".jpg"))
+ if (req == "")
{
- string orgPath = AndroidServer.PicturePath + "\\" + req;
- ReplyPictureFile(orgPath);
+ // root
+ ReplyPictureDir(AndroidServer.PicturePath, "root");
}
- else if (req.EndsWith(".thb"))
- {
- string orgPath = AndroidServer.PicturePath + "\\" + req;
- ReplyPictureThumbFile(orgPath);
- }
else
{
- ReplyPictureDir(AndroidServer.PicturePath + "\\" + req, req);
+ req = req.Replace("/", "\\");
+
+ if (req.EndsWith(".jpg"))
+ {
+ string orgPath = AndroidServer.PicturePath + "\\" + req;
+ ReplyPictureFile(orgPath);
+ }
+ else if (req.EndsWith(".thb"))
+ {
+ string orgPath = AndroidServer.PicturePath + "\\" + req;
+ ReplyPictureThumbFile(orgPath);
+ }
+ else
+ {
+ ReplyPictureDir(AndroidServer.PicturePath + "\\" + req, req);
+ }
}
}
- }
- #endregion
+ #endregion
- #region music
- else if (req.StartsWith("/music"))
- {
- // handle pictures
- req = req.Replace("/music", "");
- if (req.StartsWith("/")) req = req.Substring(1);
+ #region music
+ else if (req.StartsWith("/music"))
+ {
+ // handle pictures
+ req = req.Replace("/music", "");
+ if (req.StartsWith("/")) req = req.Substring(1);
- if (req == "")
- {
- // root
- ReplyMusicDir(AndroidServer.MusicPath, "root");
+ if (req == "")
+ {
+ // root
+ ReplyMusicDir(AndroidServer.MusicPath, "root");
+ }
+ else
+ {
+ req = req.Replace("/", "\\");
+
+ if (req.EndsWith(".mp3"))
+ {
+ string orgPath = AndroidServer.MusicPath + "\\" + req;
+ ReplyMusicFile(orgPath);
+ }
+ else
+ {
+ ReplyMusicDir(AndroidServer.MusicPath + "\\" + req, req);
+ }
+ }
}
- else
+ #endregion
+ else if (req.StartsWith("/db_music"))
{
- req = req.Replace("/", "\\");
+ // handle pictures
+ req = req.Replace("/db_music", "");
+ if (req.StartsWith("/")) req = req.Substring(1);
- if (req.EndsWith(".mp3"))
+ if (req == "artist.xml")
{
- string orgPath = AndroidServer.MusicPath + "\\" + req;
- ReplyMusicFile(orgPath);
+ ReplyMusicDbArtist();
}
- else
+ if (req == "album.xml")
{
- ReplyMusicDir(AndroidServer.MusicPath + "\\" + req, req);
+ ReplyMusicDbAlbum();
}
+ if (req == "song.xml")
+ {
+ ReplyMusicDbSongs();
+ }
}
- }
- #endregion
+ #region music datatbase
- #region nowplaying
- else if (req.StartsWith("/nowplaying/now.xml"))
- {
- ReplyNowPlaying();
- }
- else if (req.StartsWith("/nowplaying/list.xml"))
- {
- ReplyNowPlayingPlaylist();
- }
- else if (req.StartsWith("/nowplaying/cover"))
- {
- ReplyNowCover();
- }
- #endregion
+ #endregion
- #region favicon
- else if (req.StartsWith("/favicon.ico"))
- {
- ReplyFavIcon();
- }
- #endregion
+ #region nowplaying
+ else if (req.StartsWith("/nowplaying/now.xml"))
+ {
+ ReplyNowPlaying();
+ }
+ else if (req.StartsWith("/nowplaying/list.xml"))
+ {
+ ReplyNowPlayingPlaylist();
+ }
+ else if (req.StartsWith("/nowplaying/cover"))
+ {
+ ReplyNowCover();
+ }
+ #endregion
- else
- {
- SendErrorURL(req);
+ #region favicon
+ else if (req.StartsWith("/favicon.ico"))
+ {
+ ReplyFavIcon();
+ }
+ #endregion
+
+ else
+ {
+ SendErrorURL(req);
+ }
+
}
- }
-
- if (socket != null)
- {
- if (socket.Connected)
+ if (socket != null)
{
- socket.Close();
+ if (socket.Connected)
+ {
+ socket.Close();
+ }
}
}
}
}
+ catch (Exception ex)
+ {
+ AndroidServer.logInfo("Error on request : " + ex.Message);
+ AndroidServer.logInfo("Stacktrace : " + ex.StackTrace);
+ }
}
private void ExceuteCommand(string Message)
@@ -281,7 +313,9 @@
string[] files = Directory.GetFiles(dir, "*.jpg", SearchOption.TopDirectoryOnly);
foreach (string f in files)
{
- msg += "<File>" + HttpUtility.HtmlEncode(Path.GetFileName(f)) + "</File>\r\n";
+ string fName = Path.GetFileName(f);
+ if ((fName.ToLower() != "folder.jpg") && (fName.ToLower() != "folder.png"))
+ msg += "<File>" + HttpUtility.HtmlEncode(fName) + "</File>\r\n";
}
msg += "</Directory>\r\n";
// send
@@ -339,6 +373,7 @@
}
private void ReplyPictureThumbFile(string filePath)
{
+ filePath = filePath.Replace("thb", "");
if (File.Exists(filePath))
{
Bitmap bit = (Bitmap)Bitmap.FromFile(filePath);
@@ -397,7 +432,9 @@
string[] files = Directory.GetFiles(dir, "*.mp3", SearchOption.TopDirectoryOnly);
foreach (string f in files)
{
- msg += "<File>" + HttpUtility.HtmlEncode(Path.GetFileName(f)) + "</File>\r\n";
+ string fName = Path.GetFileName(f);
+ if ((fName.ToLower() != "folder.jpg") && (fName.ToLower() != "folder.png"))
+ msg += "<File>" + HttpUtility.HtmlEncode(fName) + "</File>\r\n";
}
msg += "</Directory>\r\n";
// send
@@ -433,6 +470,114 @@
}
}
+ private void ReplyMusicDbArtist()
+ {
+ 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 += "<Database>\r\n";
+
+ MediaPortal.Music.Database.MusicDatabase db = MediaPortal.Music.Database.MusicDatabase.Instance;
+ ArrayList list = new ArrayList();
+ db.GetAllArtists(ref list);
+
+ foreach (string artist in list)
+ {
+ if (artist != string.Empty)
+ {
+ msg += "<Item>\r\n";
+ msg += "<Artist>" + HttpUtility.HtmlEncode(artist) + "</Artist>\r\n";
+ msg += "</Item>\r\n";
+ }
+ }
+
+ msg += "</Database>\r\n\r\n";
+ // send
+ sendMessage(socket, msg);
+ AndroidServer.logDebug("Reply music db artist");
+
+ }
+ private void ReplyMusicDbAlbum()
+ {
+ 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 += "<Database>\r\n";
+
+
+ MediaPortal.Music.Database.MusicDatabase db = MediaPortal.Music.Database.MusicDatabase.Instance;
+ List<MediaPortal.Music.Database.AlbumInfo> list = new List<MediaPortal.Music.Database.AlbumInfo>();
+ db.GetAllAlbums(ref list);
+
+ foreach (MediaPortal.Music.Database.AlbumInfo album in list)
+ {
+ string name = album.Album.Replace("|", "").Trim();
+ if (name != string.Empty)
+ {
+ msg += "<Item>\r\n";
+
+ msg += "<Album>" + HttpUtility.HtmlEncode(album.Album.Replace("|", "").Trim()) + "</Album>\r\n";
+ msg += "<AlbumArtist>" + HttpUtility.HtmlEncode(album.AlbumArtist.Replace("|", "").Trim()) + "</AlbumArtist>\r\n";
+ msg += "<Artist>" + HttpUtility.HtmlEncode(album.Artist.Replace("|", "").Trim()) + "</Artist>\r\n";
+ msg += "<Genre>" + HttpUtility.HtmlEncode(album.Genre.Replace("|", "").Trim()) + "</Genre>\r\n";
+ msg += "<Rating>" + HttpUtility.HtmlEncode(album.Rating.ToString()) + "</Rating>\r\n";
+
+ msg += "</Item>\r\n";
+ }
+ }
+
+ msg += "</Database>\r\n\r\n";
+ // send
+ sendMessage(socket, msg);
+ AndroidServer.logDebug("Reply music db artist");
+
+ }
+ private void ReplyMusicDbSongs()
+ {
+ 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 += "<Database>\r\n";
+
+ MediaPortal.Music.Database.MusicDatabase db = MediaPortal.Music.Database.MusicDatabase.Instance;
+ List<MediaPortal.Music.Database.Song> list = new List<MediaPortal.Music.Database.Song>();
+ db.GetSongsByArtist("%", ref list);
+
+ foreach (MediaPortal.Music.Database.Song song in list)
+ {
+ msg += "<Item>\r\n";
+
+ msg += "<Title>" + HttpUtility.HtmlEncode(song.Title) + "</Title>\r\n";
+ msg += "<Artist>" + HttpUtility.HtmlEncode(song.Artist) + "</Artist>\r\n";
+ msg += "<Album>" + HttpUtility.HtmlEncode(song.Artist) + "</Album>\r\n";
+ msg += "<Genre>" + HttpUtility.HtmlEncode(song.Genre) + "</Genre>\r\n";
+ msg += "<Rating>" + HttpUtility.HtmlEncode(song.Rating.ToString()) + "</Rating>\r\n";
+
+ msg += "</Item>\r\n";
+ }
+
+ msg += "</Database>\r\n\r\n";
+ // send
+ sendMessage(socket, msg);
+ AndroidServer.logDebug("Reply music db artist");
+
+ }
+
private void ReplyNowPlaying()
{
string title = GUIPropertyManager.GetProperty("#Play.Current.Title");
@@ -608,7 +753,7 @@
msg += "<h1>Not Found</h1>" + "\r\n";
msg += "<p>The requested URL " + Url + " was not found on this server.</p>" + "\r\n";
msg += "<hr>" + "\r\n";
- msg += "<address>TeamMediaportal Server at 127.0.0.1 Port 5050</address>" + "\r\n";
+ msg += "<address>TeamMediaportal Server at " + AndroidServer.Server + " Port " + AndroidServer.Port + "</address>" + "\r\n";
msg += "</body></html>" + "\r\n";
// send
sendMessage(socket, msg);
@@ -685,10 +830,17 @@
private int readmessage(byte[] ByteArray, ref Socket s, ref String clientmessage)
{
- int bytes = s.Receive(ByteArray, 1024, 0);
- string messagefromclient = Encoding.ASCII.GetString(ByteArray);
- clientmessage = (String)messagefromclient;
- return bytes;
+ try
+ {
+ int bytes = s.Receive(ByteArray, 1024, 0);
+ string messagefromclient = Encoding.ASCII.GetString(ByteArray);
+ clientmessage = (String)messagefromclient;
+ return bytes;
+ }
+ catch { }
+ // if socket exception
+ clientmessage = "";
+ return 0;
}
private void sendMessage(Socket sock, string strMessage)
@@ -701,7 +853,6 @@
sock.Send(buffer, len, 0);
}
catch { }
-
}
private void sendBytes(Socket sock, byte[] Bytes)
{
@@ -710,7 +861,6 @@
sock.Send(Bytes, Bytes.Length, 0);
}
catch { }
-
}
private byte[] FileToByteArray(string _FileName)
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Setup.Designer.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/Setup.Designer.cs 2010-11-26 12:55:30 UTC (rev 3982)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Setup.Designer.cs 2010-11-27 16:22:51 UTC (rev 3983)
@@ -36,21 +36,27 @@
this.btnSave = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.btnVideos = new System.Windows.Forms.Button();
+ this.btnMusic = new System.Windows.Forms.Button();
+ this.btnPic = new System.Windows.Forms.Button();
+ this.txtVideos = new System.Windows.Forms.Label();
+ this.label7 = new System.Windows.Forms.Label();
+ this.txtMusic = new System.Windows.Forms.Label();
+ this.label5 = new System.Windows.Forms.Label();
+ this.txtPic = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
- this.txtPic = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.txtMusic = new System.Windows.Forms.Label();
- this.label7 = new System.Windows.Forms.Label();
- this.txtVideos = new System.Windows.Forms.Label();
- this.btnPic = new System.Windows.Forms.Button();
- this.btnMusic = new System.Windows.Forms.Button();
- this.btnVideos = new System.Windows.Forms.Button();
+ this.txtMyIP = new System.Windows.Forms.Label();
+ this.btnCopy = new System.Windows.Forms.Button();
+ this.label4 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
+ this.groupBox1.Controls.Add(this.label4);
+ this.groupBox1.Controls.Add(this.btnCopy);
+ this.groupBox1.Controls.Add(this.txtMyIP);
this.groupBox1.Controls.Add(this.txtPort);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.txtServer);
@@ -138,43 +144,44 @@
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Share";
//
- // label3
+ // btnVideos
//
- this.label3.AutoSize = true;
- this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label3.Location = new System.Drawing.Point(14, 16);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(56, 16);
- this.label3.TabIndex = 1;
- this.label3.Text = "Pictures";
+ this.btnVideos.Location = new System.Drawing.Point(445, 93);
+ this.btnVideos.Name = "btnVideos";
+ this.btnVideos.Size = new System.Drawing.Size(40, 23);
+ this.btnVideos.TabIndex = 9;
+ this.btnVideos.Text = "...";
+ this.btnVideos.UseVisualStyleBackColor = true;
+ this.btnVideos.Click += new System.EventHandler(this.btnVideos_Click);
//
- // txtPic
+ // btnMusic
//
- this.txtPic.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.txtPic.Location = new System.Drawing.Point(36, 32);
- this.txtPic.Name = "txtPic";
- this.txtPic.Size = new System.Drawing.Size(392, 16);
- this.txtPic.TabIndex = 2;
- this.txtPic.Text = "...";
+ this.btnMusic.Location = new System.Drawing.Point(445, 61);
+ this.btnMusic.Name = "btnMusic";
+ this.btnMusic.Size = new System.Drawing.Size(40, 23);
+ this.btnMusic.TabIndex = 8;
+ this.btnMusic.Text = "...";
+ this.btnMusic.UseVisualStyleBackColor = true;
+ this.btnMusic.Click += new System.EventHandler(this.btnMusic_Click);
//
- // label5
+ // btnPic
//
- this.label5.AutoSize = true;
- this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label5.Location = new System.Drawing.Point(14, 48);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(43, 16);
- this.label5.TabIndex = 3;
- this.label5.Text = "Music";
+ this.btnPic.Location = new System.Drawing.Point(445, 29);
+ this.btnPic.Name = "btnPic";
+ this.btnPic.Size = new System.Drawing.Size(40, 23);
+ this.btnPic.TabIndex = 7;
+ this.btnPic.Text = "...";
+ this.btnPic.UseVisualStyleBackColor = true;
+ this.btnPic.Click += new System.EventHandler(this.btnPic_Click);
//
- // txtMusic
+ // txtVideos
//
- this.txtMusic.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.txtMusic.Location = new System.Drawing.Point(36, 64);
- this.txtMusic.Name = "txtMusic";
- this.txtMusic.Size = new System.Drawing.Size(392, 16);
- this.txtMusic.TabIndex = 4;
- this.txtMusic.Text = "...";
+ this.txtVideos.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.txtVideos.Location = new System.Drawing.Point(36, 96);
+ this.txtVideos.Name = "txtVideos";
+ this.txtVideos.Size = new System.Drawing.Size(392, 16);
+ this.txtVideos.TabIndex = 6;
+ this.txtVideos.Text = "...";
//
// label7
//
@@ -186,45 +193,74 @@
this.label7.TabIndex = 5;
this.label7.Text = "Videos";
//
- // txtVideos
+ // txtMusic
//
- this.txtVideos.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.txtVideos.Location = new System.Drawing.Point(36, 96);
- this.txtVideos.Name = "txtVideos";
- this.txtVideos.Size = new System.Drawing.Size(392, 16);
- this.txtVideos.TabIndex = 6;
- this.txtVideos.Text = "...";
+ this.txtMusic.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.txtMusic.Location = new System.Drawing.Point(36, 64);
+ this.txtMusic.Name = "txtMusic";
+ this.txtMusic.Size = new System.Drawing.Size(392, 16);
+ this.txtMusic.TabIndex = 4;
+ this.txtMusic.Text = "...";
//
- // btnPic
+ // label5
//
- this.btnPic.Location = new System.Drawing.Point(445, 29);
- this.btnPic.Name = "btnPic";
- this.btnPic.Size = new System.Drawing.Size(40, 23);
- this.btnPic.TabIndex = 7;
- this.btnPic.Text = "...";
- this.btnPic.UseVisualStyleBackColor = true;
- this.btnPic.Click += new System.EventHandler(this.btnPic_Click);
+ this.label5.AutoSize = true;
+ this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label5.Location = new System.Drawing.Point(14, 48);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(43, 16);
+ this.label5.TabIndex = 3;
+ this.label5.Text = "Music";
//
- // btnMusic
+ // txtPic
//
- this.btnMusic.Location = new System.Drawing.Point(445, 61);
- this.btnMusic.Name = "btnMusic";
- this.btnMusic.Size = new System.Drawing.Size(40, 23);
- this.btnMusic.TabIndex = 8;
- this.btnMusic.Text = "...";
- this.btnMusic.UseVisualStyleBackColor = true;
- this.btnMusic.Click += new System.EventHandler(this.btnMusic_Click);
+ this.txtPic.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.txtPic.Location = new System.Drawing.Point(36, 32);
+ this.txtPic.Name = "txtPic";
+ this.txtPic.Size = new System.Drawing.Size(392, 16);
+ this.txtPic.TabIndex = 2;
+ this.txtPic.Text = "...";
//
- // btnVideos
+ // label3
//
- this.btnVideos.Location = new System.Drawing.Point(445, 93);
- this.btnVideos.Name = "btnVideos";
- this.btnVideos.Size = new System.Drawing.Size(40, 23);
- this.btnVideos.TabIndex = 9;
- this.btnVideos.Text = "...";
- this.btnVideos.UseVisualStyleBackColor = true;
- this.btnVideos.Click += new System.EventHandler(this.btnVideos_Click);
+ this.label3.AutoSize = true;
+ this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label3.Location = new System.Drawing.Point(14, 16);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(56, 16);
+ this.label3.TabIndex = 1;
+ this.label3.Text = "Pictures";
//
+ // txtMyIP
+ //
+ this.txtMyIP.AutoSize = true;
+ this.txtMyIP.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.txtMyIP.Location = new System.Drawing.Point(315, 32);
+ this.txtMyIP.Name = "txtMyIP";
+ this.txtMyIP.Size = new System.Drawing.Size(41, 16);
+ this.txtMyIP.TabIndex = 4;
+ this.txtMyIP.Text = "my IP";
+ //
+ // btnCopy
+ //
+ this.btnCopy.Location = new System.Drawing.Point(287, 54);
+ this.btnCopy.Name = "btnCopy";
+ this.btnCopy.Size = new System.Drawing.Size(75, 23);
+ this.btnCopy.TabIndex = 5;
+ this.btnCopy.Text = "use this IP";
+ this.btnCopy.UseVisualStyleBackColor = true;
+ this.btnCopy.Click += new System.EventHandler(this.btnCopy_Click);
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label4.Location = new System.Drawing.Point(286, 32);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(23, 16);
+ this.label4.TabIndex = 6;
+ this.label4.Text = "IP:";
+ //
// Setup
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -270,5 +306,8 @@
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label txtPic;
private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label txtMyIP;
+ private System.Windows.Forms.Button btnCopy;
+ private System.Windows.Forms.Label label4;
}
}
\ No newline at end of file
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Setup.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/Setup.cs 2010-11-26 12:55:30 UTC (rev 3982)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Setup.cs 2010-11-27 16:22:51 UTC (rev 3983)
@@ -30,6 +30,7 @@
using System.Text;
using System.Windows.Forms;
using System.IO;
+using System.Net;
using MediaPortal.Configuration;
@@ -45,6 +46,12 @@
private void Setup_Load(object sender, EventArgs e)
{
LoadSettings();
+
+ IPHostEntry IPHost = Dns.GetHostByName(Dns.GetHostName());
+ if (IPHost.AddressList.Length > 0)
+ txtMyIP.Text = IPHost.AddressList[0].ToString();
+ else
+ txtMyIP.Text = "no IP adress !";
}
private void LoadSettings()
@@ -120,7 +127,9 @@
txtVideos.Text = folder.SelectedPath;
}
}
-
-
+ private void btnCopy_Click(object sender, EventArgs e)
+ {
+ txtServer.Text = txtMyIP.Text;
+ }
}
}
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.
|
|
From: <kro...@us...> - 2010-11-28 20:12:39
|
Revision: 3985
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3985&view=rev
Author: kroko_koenig
Date: 2010-11-28 20:12:33 +0000 (Sun, 28 Nov 2010)
Log Message:
-----------
more remote control
Modified Paths:
--------------
trunk/plugins/AndroidRemote/Server/AndroidRemote/Properties/AssemblyInfo.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote.suo
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Properties/AssemblyInfo.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/Properties/AssemblyInfo.cs 2010-11-28 12:47:40 UTC (rev 3984)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Properties/AssemblyInfo.cs 2010-11-28 20:12:33 UTC (rev 3985)
@@ -32,5 +32,5 @@
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.1.0.0")]
+[assembly: AssemblyFileVersion("0.1.0.0")]
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-11-28 12:47:40 UTC (rev 3984)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-11-28 20:12:33 UTC (rev 3985)
@@ -98,8 +98,13 @@
AndroidServer.logDebug("receive HTTP GET : " + req);
+ if (req.StartsWith("/info"))
+ {
+ ReplyInfo();
+ }
+
#region pictures
- if (req.StartsWith("/pictures"))
+ else if (req.StartsWith("/pictures"))
{
// handle pictures
req = req.Replace("/pictures", "");
@@ -160,6 +165,9 @@
}
}
#endregion
+
+ #region music datatbase
+
else if (req.StartsWith("/db_music"))
{
// handle pictures
@@ -179,7 +187,6 @@
ReplyMusicDbSongs();
}
}
- #region music datatbase
#endregion
@@ -232,6 +239,9 @@
private void ExceuteCommand(string Message)
{
AndroidServer.logDebug("execute command");
+ System.Diagnostics.Debug.WriteLine(Message);
+
+ #region player
if (Message.Contains("ACTION_PLAY"))
{
Action action = new Action(Action.ActionType.ACTION_PLAY, 0, 0);
@@ -257,7 +267,19 @@
Action action = new Action(Action.ActionType.ACTION_PREV_ITEM, 0, 0);
GUIGraphicsContext.OnAction(action);
}
+ if (Message.Contains("ACTION_FORWARD"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_FORWARD, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (Message.Contains("ACTION_REWIND"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_REWIND, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ #endregion
+ #region navigate
if (Message.Contains("ACTION_MOVE_RIGHT"))
{
Action action = new Action(Action.ActionType.ACTION_MOVE_RIGHT, 0, 0);
@@ -283,13 +305,87 @@
Action action = new Action(Action.ActionType.ACTION_SELECT_ITEM, 0, 0);
GUIGraphicsContext.OnAction(action);
}
+ #endregion
+
+ #region menu
if (Message.Contains("ACTION_PREVIOUS_MENU"))
{
Action action = new Action(Action.ActionType.ACTION_PREVIOUS_MENU, 0, 0);
GUIGraphicsContext.OnAction(action);
}
+ if (Message.Contains("ACTION_PARENT_DIR"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_PARENT_DIR, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (Message.Contains("ACTION_SHOW_INFO"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_SHOW_INFO, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (Message.Contains("ACTION_CONTEXT_MENU"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_CONTEXT_MENU, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ #endregion
+
+ #region volume / programm
+ if (Message.Contains("ACTION_VOLUME_UP"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_VOLUME_UP, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (Message.Contains("ACTION_VOLUME_DOWN"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_VOLUME_DOWN, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (Message.Contains("ACTION_VOLUME_MUTE"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_VOLUME_MUTE, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (Message.Contains("ACTION_NEXT_CHANNEL"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_NEXT_CHANNEL, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (Message.Contains("ACTION_PREV_CHANNEL"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_PREV_CHANNEL, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+
+
+ #endregion
+
}
+ private void ReplyInfo()
+ {
+ 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 += "<Info>\r\n";
+
+ string strVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
+ msg += "<ServerVersion>" + strVersion + "</ServerVersion>";
+
+ string Computername = System.Windows.Forms.SystemInformation.ComputerName.ToString();
+ msg += "<ComputerName>" + Computername + "</ComputerName>";
+
+ msg += "</Info>\r\n";
+ // send
+ sendMessage(socket, msg);
+ AndroidServer.logDebug("Reply info server");
+ }
+
private void ReplyPictureDir(string dir, string request)
{
if (Directory.Exists(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.
|
|
From: <kro...@us...> - 2010-12-04 18:31:32
|
Revision: 4006
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4006&view=rev
Author: kroko_koenig
Date: 2010-12-04 18:31:25 +0000 (Sat, 04 Dec 2010)
Log Message:
-----------
add support for picture db
Modified Paths:
--------------
trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote.suo
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-12-04 17:50:02 UTC (rev 4005)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-12-04 18:31:25 UTC (rev 4006)
@@ -39,6 +39,9 @@
using MediaPortal.Utils;
using MediaPortal.Database;
+using MediaPortal.Player;
+using MediaPortal.Playlists;
+
namespace AndroidRemote
{
public class Request
@@ -147,6 +150,53 @@
}
#endregion
+ #region pictured datatbase
+
+ else if (req.StartsWith("/db_pictures"))
+ {
+ // handle pictures
+ req = req.Replace("/db_pictures", "");
+ if (req.StartsWith("/")) req = req.Substring(1);
+
+ if (req == "years.xml")
+ {
+ ReplyPicturesDbYears();
+ }
+ if (req.StartsWith("months.xml"))
+ {
+ int pos = req.IndexOf("?");
+ if (pos > 0)
+ {
+ string year = req.Substring(pos + 1);
+ ReplyPicturesDbMonths(year);
+ }
+ }
+ if (req.StartsWith("days.xml"))
+ {
+ int pos = req.IndexOf("?");
+ if (pos > 0)
+ {
+ string date = req.Substring(pos + 1);
+ string[] my = date.Split('&');
+ if (my.Length == 2)
+ {
+ ReplyPicturesDbDays(my[0], my[1]);
+ }
+ }
+ }
+ if (req.StartsWith("date.xml"))
+ {
+ int pos = req.IndexOf("?");
+ if (pos > 0)
+ {
+ string date = req.Substring(pos + 1);
+ ReplyPicturesDbByDate(date);
+ }
+ }
+ }
+
+ #endregion
+
#region music
else if (req.StartsWith("/music"))
{
@@ -272,159 +322,175 @@
data.Add(child.Name, child.InnerText);
}
- #region player
- if (Message.Contains("ACTION_PLAY"))
- {
- Action action = new Action(Action.ActionType.ACTION_PLAY, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_STOP"))
- {
- Action action = new Action(Action.ActionType.ACTION_STOP, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_PAUSE"))
- {
- Action action = new Action(Action.ActionType.ACTION_PAUSE, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_NEXT_ITEM"))
- {
- Action action = new Action(Action.ActionType.ACTION_NEXT_ITEM, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_PREV_ITEM"))
- {
- Action action = new Action(Action.ActionType.ACTION_PREV_ITEM, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_FORWARD"))
- {
- Action action = new Action(Action.ActionType.ACTION_FORWARD, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_REWIND"))
- {
- Action action = new Action(Action.ActionType.ACTION_REWIND, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- #endregion
+ //PlayListPlayer playlistPlayer = PlayListPlayer.SingletonPlayer;
+ //PlayList playList = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
- #region navigate
- if (Message.Contains("ACTION_MOVE_RIGHT"))
- {
- Action action = new Action(Action.ActionType.ACTION_MOVE_RIGHT, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_MOVE_LEFT"))
- {
- Action action = new Action(Action.ActionType.ACTION_MOVE_LEFT, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_MOVE_UP"))
- {
- Action action = new Action(Action.ActionType.ACTION_MOVE_UP, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_MOVE_DOWN"))
- {
- Action action = new Action(Action.ActionType.ACTION_MOVE_DOWN, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_SELECT_ITEM"))
- {
- Action action = new Action(Action.ActionType.ACTION_SELECT_ITEM, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- #endregion
+ //PlayListItem playlistItem = new PlayListItem();
+ //playlistItem.Type = PlayListItem.PlayListItemType.Audio;
+ //playlistItem.FileName = "c:\\mp3\\the-gossip-heavy-cross-full-length-hq--lyrics.mp3";
+ //playlistItem.Description = "My Desc";
+ //playlistItem.Duration = 1234;
- #region menu
- if (Message.Contains("ACTION_PREVIOUS_MENU"))
- {
- Action action = new Action(Action.ActionType.ACTION_PREVIOUS_MENU, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_PARENT_DIR"))
- {
- Action action = new Action(Action.ActionType.ACTION_PARENT_DIR, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_SHOW_INFO"))
- {
- Action action = new Action(Action.ActionType.ACTION_SHOW_INFO, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_CONTEXT_MENU"))
- {
- Action action = new Action(Action.ActionType.ACTION_CONTEXT_MENU, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- #endregion
+ //playlistItem.MusicTag = null;
+ //playList.Add(playlistItem);
- #region volume / programm
- if (Message.Contains("ACTION_VOLUME_UP"))
+ if (data.ContainsKey("command"))
{
- Action action = new Action(Action.ActionType.ACTION_VOLUME_UP, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_VOLUME_DOWN"))
- {
- Action action = new Action(Action.ActionType.ACTION_VOLUME_DOWN, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_VOLUME_MUTE"))
- {
- Action action = new Action(Action.ActionType.ACTION_VOLUME_MUTE, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_NEXT_CHANNEL"))
- {
- Action action = new Action(Action.ActionType.ACTION_NEXT_CHANNEL, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_PREV_CHANNEL"))
- {
- Action action = new Action(Action.ActionType.ACTION_PREV_CHANNEL, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_PREV_CHANNEL"))
- {
- Action action = new Action(Action.ActionType.ACTION_PREV_CHANNEL, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
+ #region player
+ if (data["command"] == "ACTION_PLAY")
+ {
+ Action action = new Action(Action.ActionType.ACTION_PLAY, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_STOP"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_STOP, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_PAUSE"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_PAUSE, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_NEXT_ITEM"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_NEXT_ITEM, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_PREV_ITEM"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_PREV_ITEM, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_FORWARD"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_FORWARD, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_REWIND"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_REWIND, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ #endregion
- #endregion
+ #region navigate
+ if (data["command"] == ("ACTION_MOVE_RIGHT"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_MOVE_RIGHT, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_MOVE_LEFT"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_MOVE_LEFT, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_MOVE_UP"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_MOVE_UP, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_MOVE_DOWN"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_MOVE_DOWN, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_SELECT_ITEM"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_SELECT_ITEM, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ #endregion
- #region power control
- if (Message.Contains("ACTION_EXIT"))
- {
- Action action = new Action(Action.ActionType.ACTION_EXIT, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
+ #region menu
+ if (data["command"] == ("ACTION_PREVIOUS_MENU"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_PREVIOUS_MENU, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_PARENT_DIR"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_PARENT_DIR, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_SHOW_INFO"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_SHOW_INFO, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_CONTEXT_MENU"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_CONTEXT_MENU, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ #endregion
- // TODO: these actions need confirmation so we need to do change it later....
- if (Message.Contains("ACTION_SUSPEND"))
- {
- Action action = new Action(Action.ActionType.ACTION_SUSPEND, 0, 0);
- GUIGraphicsContext.OnAction(action);
+ #region volume / programm
+ if (data["command"] == ("ACTION_VOLUME_UP"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_VOLUME_UP, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_VOLUME_DOWN"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_VOLUME_DOWN, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_VOLUME_MUTE"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_VOLUME_MUTE, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_NEXT_CHANNEL"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_NEXT_CHANNEL, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_PREV_CHANNEL"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_PREV_CHANNEL, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+
+ if (data["command"] == ("ACTION_PREV_CHANNEL"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_PREV_CHANNEL, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+
+ #endregion
+
+ #region power control
+ if (data["command"] == ("ACTION_EXIT"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_EXIT, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+
+ // TODO: these actions need confirmation so we need to do change it later....
+ if (data["command"] == ("ACTION_SUSPEND"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_SUSPEND, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_HIBERNATE"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_HIBERNATE, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_REBOOT"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_REBOOT, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ if (data["command"] == ("ACTION_POWER_OFF"))
+ {
+ Action action = new Action(Action.ActionType.ACTION_POWER_OFF, 0, 0);
+ GUIGraphicsContext.OnAction(action);
+ }
+ #endregion
}
- if (Message.Contains("ACTION_HIBERNATE"))
- {
- Action action = new Action(Action.ActionType.ACTION_HIBERNATE, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_REBOOT"))
- {
- Action action = new Action(Action.ActionType.ACTION_REBOOT, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- if (Message.Contains("ACTION_POWER_OFF"))
- {
- Action action = new Action(Action.ActionType.ACTION_POWER_OFF, 0, 0);
- GUIGraphicsContext.OnAction(action);
- }
- #endregion
}
}
@@ -571,6 +637,131 @@
}
}
+ private void ReplyPicturesDbYears()
+ {
+ 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 += "<Database>\r\n";
+
+ List<string> aList = new List<string>();
+ MediaPortal.Picture.Database.PictureDatabase.ListYears(ref aList);
+
+ foreach (string year in aList)
+ {
+ if (year != string.Empty)
+ {
+ msg += "<Item>\r\n";
+ msg += "<Year>" + HttpUtility.HtmlEncode(year) + "</Year>\r\n";
+ msg += "</Item>\r\n";
+ }
+ }
+
+ msg += "</Database>\r\n\r\n";
+ // send
+ sendMessage(socket, msg);
+ AndroidServer.logDebug("Reply db pictures years");
+ }
+ private void ReplyPicturesDbMonths(string Year)
+ {
+ 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 += "<Database>\r\n";
+ msg += "<Year>" + Year + "</Year>\r\n";
+
+ List<string> aList = new List<string>();
+ MediaPortal.Picture.Database.PictureDatabase.ListMonths(Year, ref aList);
+
+ foreach (string year in aList)
+ {
+ if (year != string.Empty)
+ {
+ msg += "<Item>\r\n";
+ msg += "<Month>" + HttpUtility.HtmlEncode(year) + "</Month>\r\n";
+ msg += "</Item>\r\n";
+ }
+ }
+
+ msg += "</Database>\r\n\r\n";
+ // send
+ sendMessage(socket, msg);
+ AndroidServer.logDebug("Reply db pictures month");
+ }
+ private void ReplyPicturesDbDays(string Month, string Year)
+ {
+ 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 += "<Database>\r\n";
+ msg += "<Month>" + Month + "</Month>\r\n";
+ msg += "<Year>" + Year + "</Year>\r\n";
+
+ List<string> aList = new List<string>();
+ MediaPortal.Picture.Database.PictureDatabase.ListDays(Month, Year, ref aList);
+
+ foreach (string year in aList)
+ {
+ if (year != string.Empty)
+ {
+ msg += "<Item>\r\n";
+ msg += "<Day>" + HttpUtility.HtmlEncode(year) + "</Day>\r\n";
+ msg += "</Item>\r\n";
+ }
+ }
+
+ msg += "</Database>\r\n\r\n";
+ // send
+ sendMessage(socket, msg);
+ AndroidServer.logDebug("Reply db pictures days");
+ }
+ private void ReplyPicturesDbByDate(string Date)
+ {
+ 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 += "<Database>\r\n";
+ msg += "<Date>" + Date + "</Date>\r\n";
+
+ List<string> aList = new List<string>();
+ MediaPortal.Picture.Database.PictureDatabase.ListPicsByDate(Date, ref aList);
+
+ foreach (string year in aList)
+ {
+ if (year != string.Empty)
+ {
+ msg += "<Item>\r\n";
+ msg += "<Picture>" + HttpUtility.HtmlEncode(year) + "</Picture>\r\n";
+ msg += "</Item>\r\n";
+ }
+ }
+
+ msg += "</Database>\r\n\r\n";
+ // send
+ sendMessage(socket, msg);
+ AndroidServer.logDebug("Reply db pictures date");
+ }
+
private void ReplyMusicDir(string dir, string request)
{
if (Directory.Exists(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.
|
|
From: <kro...@us...> - 2010-12-05 19:32:47
|
Revision: 4007
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4007&view=rev
Author: kroko_koenig
Date: 2010-12-05 19:32:41 +0000 (Sun, 05 Dec 2010)
Log Message:
-----------
add ids for pictures
Modified Paths:
--------------
trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote.suo
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-12-04 18:31:25 UTC (rev 4006)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-12-05 19:32:41 UTC (rev 4007)
@@ -38,10 +38,13 @@
using MediaPortal.GUI.Library;
using MediaPortal.Utils;
using MediaPortal.Database;
+using MediaPortal.Configuration;
using MediaPortal.Player;
using MediaPortal.Playlists;
+using SQLite.NET;
+
namespace AndroidRemote
{
public class Request
@@ -53,6 +56,8 @@
private static Bitmap actualCover = null;
private static string[] listAllPictures = null;
+ private SQLiteClient sqlClient;
+
public Request(Socket Socket)
{
socket = Socket;
@@ -193,6 +198,26 @@
ReplyPicturesDbByDate(date);
}
}
+ if (req.StartsWith("getpicture"))
+ {
+ int pos = req.IndexOf("?");
+ if (pos > 0)
+ {
+ string id = req.Substring(pos + 1);
+ id = id.Replace("id=", "");
+ ReplyPicturesDbFile(id);
+ }
+ }
+ if (req.StartsWith("getthumb"))
+ {
+ int pos = req.IndexOf("?");
+ if (pos > 0)
+ {
+ string id = req.Substring(pos + 1);
+ id = id.Replace("id=", "");
+ ReplyPicturesDbThumbFile(id);
+ }
+ }
}
#endregion
@@ -732,6 +757,11 @@
}
private void ReplyPicturesDbByDate(string Date)
{
+ sqlClient = new SQLiteClient(Config.GetFile(Config.Dir.Database, "PictureDatabase.db3"));
+ sqlClient.BusyRetries = 10;
+ sqlClient.BusyRetryDelay = 100;
+ DatabaseUtility.SetPragmas(sqlClient);
+
string msg = string.Empty;
// header
msg += "HTTP/1.0 200 Ok\r\n";
@@ -743,17 +773,16 @@
msg += "<Database>\r\n";
msg += "<Date>" + Date + "</Date>\r\n";
- List<string> aList = new List<string>();
- MediaPortal.Picture.Database.PictureDatabase.ListPicsByDate(Date, ref aList);
+ List<string[]> aList = new List<string[]>();
+ //MediaPortal.Picture.Database.PictureDatabase.ListPicsByDate(Date, ref aList); // we dont get the ids... pff
+ ListPicsByDate(Date, ref aList);
- foreach (string year in aList)
+ foreach (string[] item in aList)
{
- if (year != string.Empty)
- {
- msg += "<Item>\r\n";
- msg += "<Picture>" + HttpUtility.HtmlEncode(year) + "</Picture>\r\n";
- msg += "</Item>\r\n";
- }
+ msg += "<Item>\r\n";
+ msg += "<ID>" + HttpUtility.HtmlEncode(item[0]) + "</ID>\r\n";
+ msg += "<Name>" + HttpUtility.HtmlEncode(item[1]) + "</Name>\r\n";
+ msg += "</Item>\r\n";
}
msg += "</Database>\r\n\r\n";
@@ -761,7 +790,100 @@
sendMessage(socket, msg);
AndroidServer.logDebug("Reply db pictures date");
}
+ private void ReplyPicturesDbFile(string ID)
+ {
+ sqlClient = new SQLiteClient(Config.GetFile(Config.Dir.Database, "PictureDatabase.db3"));
+ sqlClient.BusyRetries = 10;
+ sqlClient.BusyRetryDelay = 100;
+ DatabaseUtility.SetPragmas(sqlClient);
+ string filePath = GetPathById(ID);
+
+ if (File.Exists(filePath))
+ {
+ Bitmap bit = (Bitmap)Bitmap.FromFile(filePath);
+ byte[] b;
+
+ if ((bit.Width > 600) || (bit.Height > 600))
+ {
+ Bitmap thumb = (Bitmap)bit.Clone();
+ thumb = MediaPortal.Util.BitmapResize.Resize(ref thumb, 600, 600, false, true);
+
+ b = BildToByteArray((Image)thumb);
+ }
+ else
+ {
+ b = BildToByteArray((Image)bit);
+ }
+
+ if (b != null)
+ {
+ string msg = string.Empty;
+ // header
+ msg += "HTTP/1.0 200 Ok\r\n";
+ msg += "Content-Type: image/jpeg" + "\r\n";
+ msg += "Content-Length: " + b.Length + "\r\n";
+ msg += "Proxy-Connection: close" + "\r\n";
+ msg += "\r\n";
+ sendMessage(socket, msg);
+ // content
+ sendBytes(socket, b);
+ AndroidServer.logDebug("Reply picture file");
+ }
+ else
+ {
+ SendServerError(filePath, "ReplyPictureFile");
+ }
+ }
+ else
+ {
+ SendErrorFile(filePath);
+ }
+ }
+ private void ReplyPicturesDbThumbFile(string ID)
+ {
+ sqlClient = new SQLiteClient(Config.GetFile(Config.Dir.Database, "PictureDatabase.db3"));
+ sqlClient.BusyRetries = 10;
+ sqlClient.BusyRetryDelay = 100;
+ DatabaseUtility.SetPragmas(sqlClient);
+
+ string filePath = GetPathById(ID);
+
+ if (File.Exists(filePath))
+ {
+ Bitmap bit = (Bitmap)Bitmap.FromFile(filePath);
+ byte[] b;
+
+ Bitmap thumb = (Bitmap)bit.Clone();
+ thumb = MediaPortal.Util.BitmapResize.Resize(ref thumb, 85, 85, false, true);
+
+ b = BildToByteArray((Image)thumb);
+
+ if (b != null)
+ {
+ string msg = string.Empty;
+ // header
+ msg += "HTTP/1.0 200 Ok\r\n";
+ msg += "Content-Type: image/jpeg" + "\r\n";
+ msg += "Content-Length: " + b.Length + "\r\n";
+ msg += "Proxy-Connection: close" + "\r\n";
+ msg += "\r\n";
+ sendMessage(socket, msg);
+ // content
+ sendBytes(socket, b);
+ AndroidServer.logDebug("Reply picture file");
+ }
+ else
+ {
+ SendServerError(filePath, "ReplyPictureFile");
+ }
+ }
+ else
+ {
+ SendErrorFile(filePath);
+ }
+ }
+
private void ReplyMusicDir(string dir, string request)
{
if (Directory.Exists(dir))
@@ -1376,5 +1498,69 @@
{
return System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(ResourceName);
}
+
+ public int ListPicsByDate(string Date, ref List<string[]> Pics)
+ {
+ int Count = 0;
+ {
+ if (sqlClient == null)
+ {
+ return 0;
+ }
+ string strSQL = "select idPicture,strFile from picture where strDateTaken like '" + Date + "%' order by 1";
+ SQLiteResultSet result;
+ try
+ {
+ result = sqlClient.Execute(strSQL);
+ if (result != null)
+ {
+ for (Count = 0; Count < result.Rows.Count; Count++)
+ {
+ string[] vals = new string[2];
+ vals[0] = DatabaseUtility.Get(result, Count, 0);
+ vals[1] = Path.GetFileName(DatabaseUtility.Get(result, Count, 1));
+ Pics.Add(vals);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Log.Error("MediaPortal.Picture.Database exception getting Picture by Date err:{0} stack:{1}", ex.Message,
+ ex.StackTrace);
+ //Open();
+ }
+ return Count;
+ }
+ }
+ public string GetPathById(string ID)
+ {
+ {
+ if (sqlClient == null)
+ {
+ return string.Empty;
+ }
+ string strSQL = "select strFile from picture where idPicture='" + ID + "'";
+ SQLiteResultSet result;
+ try
+ {
+ result = sqlClient.Execute(strSQL);
+ if (result != null)
+ {
+
+ if (result.Rows.Count == 1)
+ {
+ return DatabaseUtility.Get(result, 0, 0);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Log.Error("MediaPortal.Picture.Database exception getting Picture by Date err:{0} stack:{1}", ex.Message,
+ ex.StackTrace);
+ //Open();
+ }
+ return string.Empty;
+ }
+ }
}
}
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.
|
|
From: <kro...@us...> - 2010-12-05 21:44:14
|
Revision: 4009
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4009&view=rev
Author: kroko_koenig
Date: 2010-12-05 21:44:07 +0000 (Sun, 05 Dec 2010)
Log Message:
-----------
change to use shares of the mp for picture dirs
Modified Paths:
--------------
trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote.suo
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-12-05 19:33:12 UTC (rev 4008)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-12-05 21:44:07 UTC (rev 4009)
@@ -37,6 +37,7 @@
using MediaPortal.GUI.Library;
using MediaPortal.Utils;
+using MediaPortal.Util;
using MediaPortal.Database;
using MediaPortal.Configuration;
@@ -57,6 +58,8 @@
private static string[] listAllPictures = null;
private SQLiteClient sqlClient;
+ private VirtualDirectory virtualDirectory = new VirtualDirectory();
+ private Dictionary<string, string> dirList = new Dictionary<string, string>();
public Request(Socket Socket)
{
@@ -125,13 +128,13 @@
else if (req.StartsWith("/pictures"))
{
// handle pictures
- req = req.Replace("/pictures", "");
+ req = req.Substring(9);
if (req.StartsWith("/")) req = req.Substring(1);
if (req == "")
{
// root
- ReplyPictureDir(AndroidServer.PicturePath, "root");
+ ReplyPictureDir("");
}
else
{
@@ -139,17 +142,15 @@
if (req.EndsWith(".jpg"))
{
- string orgPath = AndroidServer.PicturePath + "\\" + req;
- ReplyPictureFile(orgPath);
+ ReplyPictureFile(req);
}
else if (req.EndsWith(".thb"))
{
- string orgPath = AndroidServer.PicturePath + "\\" + req;
- ReplyPictureThumbFile(orgPath);
+ ReplyPictureThumbFile(req);
}
else
{
- ReplyPictureDir(AndroidServer.PicturePath + "\\" + req, req);
+ ReplyPictureDir(req);
}
}
}
@@ -271,6 +272,16 @@
{
ReplyMusicDbSongs(req);
}
+ if (req.StartsWith("getfile"))
+ {
+ int pos = req.IndexOf("?");
+ if (pos > 0)
+ {
+ string id = req.Substring(pos + 1);
+ id = id.Replace("id=", "");
+ ReplyMusicDbFile(id, msgTyp);
+ }
+ }
}
#endregion
@@ -543,10 +554,15 @@
AndroidServer.logDebug("Reply info server");
}
- private void ReplyPictureDir(string dir, string request)
+ private void ReplyPictureDir(string Request)
{
- if (Directory.Exists(dir))
+ GetPictureShare();
+ string dir = GetLocalDir(Request);
+
+ if (Request == string.Empty)
{
+ #region root shares
+
string msg = string.Empty;
// header
msg += "HTTP/1.0 200 Ok\r\n";
@@ -556,36 +572,73 @@
// content
msg += "<?xml version=\"1.0\"?>\r\n";
msg += "<Directory>\r\n";
+
// folder
- string[] dirs = Directory.GetDirectories(dir, "*.*", SearchOption.TopDirectoryOnly);
- foreach (string f in dirs)
+ foreach (string key in dirList.Keys)
{
- msg += "<Folder>" + HttpUtility.HtmlEncode(Path.GetFileName(f)) + "</Folder>\r\n";
+ msg += "<Folder>" + HttpUtility.HtmlEncode(key) + "</Folder>\r\n";
}
- //files
- string[] files = Directory.GetFiles(dir, "*.jpg", SearchOption.TopDirectoryOnly);
- foreach (string f in files)
- {
- string fName = Path.GetFileName(f);
- if ((fName.ToLower() != "folder.jpg") && (fName.ToLower() != "folder.png"))
- msg += "<File>" + HttpUtility.HtmlEncode(fName) + "</File>\r\n";
- }
+
msg += "</Directory>\r\n";
// send
sendMessage(socket, msg);
- AndroidServer.logDebug("Reply picture dir");
+ AndroidServer.logDebug("Reply picture root dir");
+
+ #endregion
}
else
{
- // dir does not exist
- SendErrorURL(request);
+ #region reply dirs
+
+ if (Directory.Exists(dir))
+ {
+ 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";
+
+ // folder
+ string[] dirs = Directory.GetDirectories(dir, "*.*", SearchOption.TopDirectoryOnly);
+ foreach (string f in dirs)
+ {
+ msg += "<Folder>" + HttpUtility.HtmlEncode(Path.GetFileName(f)) + "</Folder>\r\n";
+ }
+
+ //files
+ string[] files = Directory.GetFiles(dir, "*.jpg", SearchOption.TopDirectoryOnly);
+ foreach (string f in files)
+ {
+ string fName = Path.GetFileName(f);
+ if ((fName.ToLower() != "folder.jpg") && (fName.ToLower() != "folder.png"))
+ msg += "<File>" + HttpUtility.HtmlEncode(fName) + "</File>\r\n";
+ }
+ msg += "</Directory>\r\n";
+ // send
+ sendMessage(socket, msg);
+ AndroidServer.logDebug("Reply picture dir");
+ }
+ else
+ {
+ // dir does not exist
+ SendErrorURL(Request);
+ }
+
+ #endregion
}
}
private void ReplyPictureFile(string filePath)
{
- if (File.Exists(filePath))
+ GetPictureShare();
+ string dir = GetLocalDir(filePath);
+
+ if (File.Exists(dir))
{
- Bitmap bit = (Bitmap)Bitmap.FromFile(filePath);
+ Bitmap bit = (Bitmap)Bitmap.FromFile(dir);
byte[] b;
if ((bit.Width > 600) || (bit.Height > 600))
@@ -626,10 +679,14 @@
}
private void ReplyPictureThumbFile(string filePath)
{
- filePath = filePath.Replace("thb", "");
- if (File.Exists(filePath))
+ filePath = filePath.Replace(".thb", "");
+
+ GetPictureShare();
+ string dir = GetLocalDir(filePath);
+
+ if (File.Exists(dir))
{
- Bitmap bit = (Bitmap)Bitmap.FromFile(filePath);
+ Bitmap bit = (Bitmap)Bitmap.FromFile(dir);
byte[] b;
Bitmap thumb = (Bitmap)bit.Clone();
@@ -797,7 +854,7 @@
sqlClient.BusyRetryDelay = 100;
DatabaseUtility.SetPragmas(sqlClient);
- string filePath = GetPathById(ID);
+ string filePath = GetPicturePathById(ID);
if (File.Exists(filePath))
{
@@ -847,7 +904,7 @@
sqlClient.BusyRetryDelay = 100;
DatabaseUtility.SetPragmas(sqlClient);
- string filePath = GetPathById(ID);
+ string filePath = GetPicturePathById(ID);
if (File.Exists(filePath))
{
@@ -1074,6 +1131,7 @@
{
msg += "<Item>\r\n";
+ msg += "<ID>" + HttpUtility.HtmlEncode(song.Id.ToString()) + "</ID>\r\n";
msg += "<Title>" + HttpUtility.HtmlEncode(song.Title) + "</Title>\r\n";
msg += "<Artist>" + HttpUtility.HtmlEncode(song.Artist) + "</Artist>\r\n";
msg += "<Album>" + HttpUtility.HtmlEncode(song.Artist) + "</Album>\r\n";
@@ -1081,7 +1139,6 @@
msg += "<Track>" + HttpUtility.HtmlEncode(song.Track.ToString()) + "</Track>\r\n";
msg += "<Duration>" + HttpUtility.HtmlEncode(song.Duration.ToString()) + "</Duration>\r\n";
msg += "<Rating>" + HttpUtility.HtmlEncode(song.Rating.ToString()) + "</Rating>\r\n";
- msg += "<Filename>" + HttpUtility.HtmlEncode(song.FileName) + "</Filename>\r\n";
msg += "</Item>\r\n";
}
@@ -1092,7 +1149,41 @@
AndroidServer.logDebug("Reply music db artist");
}
+ private void ReplyMusicDbFile(string ID, string Mode)
+ {
+ sqlClient = new SQLiteClient(Config.GetFile(Config.Dir.Database, "MusicDatabaseV11.db3"));
+ sqlClient.BusyRetries = 10;
+ sqlClient.BusyRetryDelay = 100;
+ DatabaseUtility.SetPragmas(sqlClient);
+ string filePath = GetMusicPathById(ID);
+
+ if (File.Exists(filePath))
+ {
+ byte[] b = FileToByteArray(filePath);
+
+ string msg = string.Empty;
+ // header
+ msg += "HTTP/1.0 200 Ok\r\n";
+ msg += "Content-Type: audio/mpeg" + "\r\n";
+ msg += "Content-Length: " + b.Length + "\r\n";
+ msg += "Proxy-Connection: close" + "\r\n";
+ msg += "\r\n";
+ sendMessage(socket, msg);
+
+ if (Mode != "HEAD")
+ {
+ // content
+ sendBytes(socket, b);
+ }
+ AndroidServer.logDebug("Reply music db file");
+ }
+ else
+ {
+ SendErrorFile("ID=" + ID);
+ }
+ }
+
private void ReplyNowPlaying()
{
string title = GUIPropertyManager.GetProperty("#Play.Current.Title");
@@ -1532,7 +1623,7 @@
return Count;
}
}
- public string GetPathById(string ID)
+ public string GetPicturePathById(string ID)
{
{
if (sqlClient == null)
@@ -1555,12 +1646,107 @@
}
catch (Exception ex)
{
- Log.Error("MediaPortal.Picture.Database exception getting Picture by Date err:{0} stack:{1}", ex.Message,
+ Log.Error("MediaPortal.Picture.Database exception getting strFile by ID err:{0} stack:{1}", ex.Message,
ex.StackTrace);
//Open();
}
return string.Empty;
}
}
+ public string GetMusicPathById(string ID)
+ {
+ {
+ if (sqlClient == null)
+ {
+ return string.Empty;
+ }
+ string strSQL = "SELECT strPath FROM tracks WHERE idTrack='" + ID + "'";
+ SQLiteResultSet result;
+ try
+ {
+ result = sqlClient.Execute(strSQL);
+ if (result != null)
+ {
+
+ if (result.Rows.Count == 1)
+ {
+ return DatabaseUtility.Get(result, 0, 0);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Log.Error("MediaPortal.Picture.Database exception getting strPath by ID err:{0} stack:{1}", ex.Message,
+ ex.StackTrace);
+ //Open();
+ }
+ return string.Empty;
+ }
+ }
+
+ private void GetPictureShare()
+ {
+ #region read virtual dir
+ using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
+ {
+ VirtualDirectory virtualDirectory = new VirtualDirectory();
+ virtualDirectory.Clear();
+
+ for (int i = 0; i < VirtualDirectory.MaxSharesCount; i++)
+ {
+ string sharePath = String.Format("sharepath{0}", i);
+ string shareName = String.Format("sharename{0}", i);
+ string shareType = String.Format("sharetype{0}", i);
+
+ Share share = new Share();
+ share.Path = xmlreader.GetValueAsString("pictures", sharePath, string.Empty);
+ share.Name = xmlreader.GetValueAsString("pictures", shareName, string.Empty);
+ share.IsFtpShare = xmlreader.GetValueAsBool("pictures", shareType, false);
+
+ if (share.Path.Length > 0)
+ {
+ if (share.Path != string.Empty)
+ {
+ if (!share.IsFtpShare)
+ {
+ dirList.Add(share.Name, share.Path);
+ }
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ #endregion
+ }
+ private string GetLocalDir(string Request)
+ {
+ string folder = string.Empty;
+ string baseFolder = 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 dirList)
+ {
+ if (pair.Key.ToLower() == (baseFolder.ToLower()))
+ {
+ dir = pair.Value + folder;
+ return dir;
+ }
+ }
+ return string.Empty;
+ }
}
}
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.
|
|
From: <kro...@us...> - 2010-12-08 17:25:28
|
Revision: 4022
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4022&view=rev
Author: kroko_koenig
Date: 2010-12-08 17:25:21 +0000 (Wed, 08 Dec 2010)
Log Message:
-----------
add playlist support
Modified Paths:
--------------
trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote.suo
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-12-08 15:08:48 UTC (rev 4021)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-12-08 17:25:21 UTC (rev 4022)
@@ -40,6 +40,7 @@
using MediaPortal.Util;
using MediaPortal.Database;
using MediaPortal.Configuration;
+using MediaPortal.TagReader;
using MediaPortal.Player;
using MediaPortal.Playlists;
@@ -358,18 +359,6 @@
data.Add(child.Name, child.InnerText);
}
- //PlayListPlayer playlistPlayer = PlayListPlayer.SingletonPlayer;
- //PlayList playList = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
-
- //PlayListItem playlistItem = new PlayListItem();
- //playlistItem.Type = PlayListItem.PlayListItemType.Audio;
- //playlistItem.FileName = "c:\\mp3\\the-gossip-heavy-cross-full-length-hq--lyrics.mp3";
- //playlistItem.Description = "My Desc";
- //playlistItem.Duration = 1234;
-
- //playlistItem.MusicTag = null;
- //playList.Add(playlistItem);
-
if (data.ContainsKey("command"))
{
@@ -526,6 +515,73 @@
GUIGraphicsContext.OnAction(action);
}
#endregion
+
+ #region playlist
+ if (data["command"] == ("ADD_MUSIC"))
+ {
+ // add music
+ // parameter = filename,artist,title,duration
+
+ PlayListPlayer playlistPlayer = PlayListPlayer.SingletonPlayer;
+ PlayList playList = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
+
+ bool found = false;
+ string fileName = data["filename"]; // TODO need to be converted to local name
+
+ foreach (PlayListItem item in playList)
+ {
+ if (item.FileName == fileName)
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ {
+ PlayListItem playlistItem = new PlayListItem();
+ playlistItem.Type = PlayListItem.PlayListItemType.Audio;
+ playlistItem.FileName = fileName;
+ playlistItem.Description = data["artist"] + " - " + data["title"];
+ playlistItem.Duration = 0;
+
+ MusicTag tag = new MusicTag();
+ tag.Artist = data["artist"];
+ tag.Title = data["title"];
+
+ tag.Duration = Convert.ToInt32(data["duration"]);
+ tag.FileName = fileName;
+
+ playlistItem.MusicTag = tag;
+ playList.Add(playlistItem);
+ }
+
+ }
+
+ if (data["command"] == ("REMOVE_PLAYLIST"))
+ {
+ // add music
+ // parameter = filename
+
+ PlayListPlayer playlistPlayer = PlayListPlayer.SingletonPlayer;
+ PlayList playList = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
+
+ string fileName = data["filename"]; // TODO need to be converted to local name
+ playList.Remove(fileName);
+ }
+
+ if (data["command"] == ("CLEAR_PLAYLIST"))
+ {
+ // clear playlist
+ // parameter = none
+
+ PlayListPlayer playlistPlayer = PlayListPlayer.SingletonPlayer;
+ PlayList playList = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
+
+ playList.Clear();
+ }
+
+ #endregion
}
}
}
@@ -1313,7 +1369,7 @@
msg += "<CurrentItem>" + currentSong.ToString() + "</CurrentItem>\r\n";
msg += "<TotalItem>" + list.Count.ToString() + "</TotalItem>\r\n";
- foreach (MediaPortal.Playlists.PlayListItem item in list)
+ foreach (PlayListItem item in list)
{
string desc = item.Description;
int duration = item.Duration;
@@ -1393,7 +1449,7 @@
if (Directory.Exists(key))
{
string[] files = Directory.GetFiles(key, "*.jpg", SearchOption.AllDirectories);
- foreach(string f in files)
+ foreach (string f in files)
{
allPicturesList.Add(f);
}
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.
|
|
From: <kro...@us...> - 2010-12-21 13:27:00
|
Revision: 4051
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4051&view=rev
Author: kroko_koenig
Date: 2010-12-21 13:26:53 +0000 (Tue, 21 Dec 2010)
Log Message:
-----------
UTF8 encoding on the server
Modified Paths:
--------------
trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote.suo
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-12-21 11:02:44 UTC (rev 4050)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-12-21 13:26:53 UTC (rev 4051)
@@ -730,9 +730,6 @@
}
}
-
-
-
}
#endregion
@@ -802,7 +799,7 @@
// folder
foreach (string key in directoryList.Keys)
{
- msg += "<Folder>" + HttpUtility.HtmlEncode(key) + "</Folder>\r\n";
+ msg += "<Folder>" + EncodeString(key) + "</Folder>\r\n";
}
msg += "</Directory>\r\n";
@@ -832,7 +829,7 @@
string[] dirs = Directory.GetDirectories(dir, "*.*", SearchOption.TopDirectoryOnly);
foreach (string f in dirs)
{
- msg += "<Folder>" + HttpUtility.HtmlEncode(Path.GetFileName(f)) + "</Folder>\r\n";
+ msg += "<Folder>" + EncodeString(Path.GetFileName(f)) + "</Folder>\r\n";
}
//files
@@ -841,7 +838,7 @@
{
string fName = Path.GetFileName(f);
if ((fName.ToLower() != "folder.jpg") && (fName.ToLower() != "folder.png"))
- msg += "<File>" + HttpUtility.HtmlEncode(fName) + "</File>\r\n";
+ msg += "<File>" + EncodeString(fName) + "</File>\r\n";
}
msg += "</Directory>\r\n";
// send
@@ -1204,7 +1201,7 @@
// folder
foreach (string key in directoryList.Keys)
{
- msg += "<Folder>" + HttpUtility.HtmlEncode(key) + "</Folder>\r\n";
+ msg += "<Folder>" + EncodeString(key) + "</Folder>\r\n";
}
msg += "</Directory>\r\n";
@@ -1234,7 +1231,7 @@
string[] dirs = Directory.GetDirectories(dir, "*.*", SearchOption.TopDirectoryOnly);
foreach (string f in dirs)
{
- msg += "<Folder>" + HttpUtility.HtmlEncode(Path.GetFileName(f)) + "</Folder>\r\n";
+ msg += "<Folder>" + EncodeString(Path.GetFileName(f)) + "</Folder>\r\n";
}
//files
@@ -1242,7 +1239,7 @@
foreach (string f in files)
{
string fName = Path.GetFileName(f);
- msg += "<File>" + HttpUtility.HtmlEncode(fName) + "</File>\r\n";
+ msg += "<File>" + EncodeString(fName) + "</File>\r\n";
}
msg += "</Directory>\r\n";
// send
@@ -1313,7 +1310,7 @@
msg += "Proxy-Connection: close" + "\r\n";
msg += "\r\n";
// content
- msg += "<?xml version=\"1.0\"?>\r\n";
+ msg += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
msg += "<Database>\r\n";
MediaPortal.Music.Database.MusicDatabase db = MediaPortal.Music.Database.MusicDatabase.Instance;
@@ -1326,7 +1323,7 @@
if (artist != string.Empty)
{
msg += "<Item>\r\n";
- msg += "<Artist>" + HttpUtility.HtmlEncode(artist) + "</Artist>\r\n";
+ msg += "<Artist>" + EncodeString(artist) + "</Artist>\r\n";
msg += "</Item>\r\n";
}
}
@@ -1361,11 +1358,11 @@
{
msg += "<Item>\r\n";
- msg += "<Album>" + HttpUtility.HtmlEncode(album.Album.Replace("|", "").Trim()) + "</Album>\r\n";
- msg += "<AlbumArtist>" + HttpUtility.HtmlEncode(album.AlbumArtist.Replace("|", "").Trim()) + "</AlbumArtist>\r\n";
- msg += "<Artist>" + HttpUtility.HtmlEncode(album.Artist.Replace("|", "").Trim()) + "</Artist>\r\n";
- msg += "<Genre>" + HttpUtility.HtmlEncode(album.Genre.Replace("|", "").Trim()) + "</Genre>\r\n";
- msg += "<Rating>" + HttpUtility.HtmlEncode(album.Rating.ToString()) + "</Rating>\r\n";
+ msg += "<Album>" + EncodeString(album.Album.Replace("|", "").Trim()) + "</Album>\r\n";
+ msg += "<AlbumArtist>" + EncodeString(album.AlbumArtist.Replace("|", "").Trim()) + "</AlbumArtist>\r\n";
+ msg += "<Artist>" + EncodeString(album.Artist.Replace("|", "").Trim()) + "</Artist>\r\n";
+ msg += "<Genre>" + EncodeString(album.Genre.Replace("|", "").Trim()) + "</Genre>\r\n";
+ msg += "<Rating>" + EncodeString(album.Rating.ToString()) + "</Rating>\r\n";
msg += "</Item>\r\n";
}
@@ -1427,14 +1424,14 @@
msg += "<Item>\r\n";
msg += "<ID>" + HttpUtility.HtmlEncode(song.Id.ToString()) + "</ID>\r\n";
- msg += "<Title>" + HttpUtility.HtmlEncode(song.Title) + "</Title>\r\n";
- msg += "<Artist>" + HttpUtility.HtmlEncode(song.Artist) + "</Artist>\r\n";
- msg += "<Album>" + HttpUtility.HtmlEncode(song.Artist) + "</Album>\r\n";
+ msg += "<Title>" + EncodeString(song.Title) + "</Title>\r\n";
+ msg += "<Artist>" + EncodeString(song.Artist) + "</Artist>\r\n";
+ msg += "<Album>" + EncodeString(song.Artist) + "</Album>\r\n";
msg += "<Genre>" + HttpUtility.HtmlEncode(song.Genre) + "</Genre>\r\n";
msg += "<Track>" + HttpUtility.HtmlEncode(song.Track.ToString()) + "</Track>\r\n";
msg += "<Duration>" + HttpUtility.HtmlEncode(song.Duration.ToString()) + "</Duration>\r\n";
msg += "<Rating>" + HttpUtility.HtmlEncode(song.Rating.ToString()) + "</Rating>\r\n";
- msg += "<Filename>" + HttpUtility.HtmlEncode(song.FileName) + "</Filename>\r\n";
+ msg += "<Filename>" + EncodeString(song.FileName) + "</Filename>\r\n";
msg += "</Item>\r\n";
}
@@ -1517,10 +1514,6 @@
total = string.Empty;
}
- artist = HttpUtility.HtmlEncode(artist);
- album = HttpUtility.HtmlEncode(album);
- title = HttpUtility.HtmlEncode(title);
-
string msg = string.Empty;
// header
msg += "HTTP/1.0 200 Ok\r\n";
@@ -1533,9 +1526,9 @@
msg += "<PlayerState>" + state + "</PlayerState>\r\n";
- msg += "<Title>" + title + "</Title>\r\n";
- msg += "<Artist>" + artist + "</Artist>\r\n";
- msg += "<Album>" + album + "</Album>\r\n";
+ msg += "<Title>" + EncodeString(title) + "</Title>\r\n";
+ msg += "<Artist>" + EncodeString(artist) + "</Artist>\r\n";
+ msg += "<Album>" + EncodeString(album) + "</Album>\r\n";
msg += "<Track>" + track + "</Track>\r\n";
if (actualCover != null)
msg += "<Cover>True</Cover>\r\n";
@@ -1578,7 +1571,7 @@
bool played = item.Played;
string typ = item.Type.ToString();
- desc = HttpUtility.HtmlEncode(desc);
+ desc = EncodeString(desc);
msg += "<Item>\r\n";
@@ -2052,5 +2045,15 @@
}
return string.Empty;
}
+
+ private string EncodeString(string Data)
+ {
+ byte[] str = Encoding.UTF8.GetBytes(Data);
+
+ System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
+ string conv = enc.GetString(str);
+
+ return HttpUtility.HtmlEncode(conv);
+ }
}
}
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.
|
|
From: <Rol...@us...> - 2011-04-17 21:52:34
|
Revision: 4175
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4175&view=rev
Author: Rollsroyc3
Date: 2011-04-17 21:52:28 +0000 (Sun, 17 Apr 2011)
Log Message:
-----------
moving pictures plugin changes
Modified Paths:
--------------
trunk/plugins/AndroidRemote/Server/AndroidRemote/Plugins/MovingPictures.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
trunk/plugins/AndroidRemote/Server/AndroidRemote.suo
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Plugins/MovingPictures.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/Plugins/MovingPictures.cs 2011-04-17 18:17:56 UTC (rev 4174)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Plugins/MovingPictures.cs 2011-04-17 21:52:28 UTC (rev 4175)
@@ -129,6 +129,7 @@
msg += "<Runtime>" + SomeUtils.EncodeString(m.Runtime.ToString()) + "</Runtime>\r\n";
msg += "<Image>" + SomeUtils.EncodeString(m.Image) + "</Image>\r\n";
msg += "</Movie>\r\n";
+ Log.Error(new Exception("ar: movie - " + m.Title.ToString()) );
}
msg += "</Database>\r\n\r\n";
@@ -151,7 +152,7 @@
{
return null;
}
- string strSQL = "SELECT id,title,tagline,score,runtime,coverthumbfullpath FROM movie_info " + Query.ToString();
+ string strSQL = "SELECT id,title,summary,score,runtime,coverthumbfullpath FROM movie_info " + Query.ToString();
SQLiteResultSet result;
try
{
Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs
===================================================================
--- trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2011-04-17 18:17:56 UTC (rev 4174)
+++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2011-04-17 21:52:28 UTC (rev 4175)
@@ -323,6 +323,7 @@
{
string s = MP.GetMovies("");
handler.SendMessage(socket, s);
+ Log.Error(new Exception("Movies return succesfully"));
}
else
{
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.
|