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