예제 #1
0
        public string[] GetShares(string type, bool path)
        {
            string[] aMediaShares = parent.Request("GetShares(" + type + ")");

            if (aMediaShares != null)
            {
                string[] aShareNames = new string[aMediaShares.Length];
                string[] aSharePaths = new string[aMediaShares.Length];

                for (int x = 0; x < aMediaShares.Length; x++)
                {
                    string[] aTmpShare = aMediaShares[x].Split(';');

                    if (aTmpShare != null)
                    {
                        aShareNames[x] = aTmpShare[0];
                        aSharePaths[x] = aTmpShare[1];
                    }
                }

                return((path) ? aSharePaths : aShareNames);
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        public System.Drawing.Image getVideoThumb(string videoID)
        {
            string hashName;

            string[] strPath;
            string[] downloadData;
            string   ipString;

            string[]  fileExist;
            Image     thumbnail = null;
            WebClient client    = new WebClient();
            string    condition = (videoID == null) ? "" : " WHERE C09 LIKE '%%" + videoID + "%%'";

            strPath  = parent.Request("QueryVideoDatabase", "SELECT strpath FROM movieview " + condition);
            hashName = Hash(strPath[0] + "VIDEO_TS.IFO");

            ipString = "P:\\Thumbnails\\Video\\" + hashName[0] + "\\" + hashName + ".tbn";

            fileExist = parent.Request("FileExists", ipString);

            if (fileExist[0] == "True")
            {
                try
                {
                    downloadData = parent.Request("FileDownload", ipString);

                    // Convert Base64 String to byte[]
                    byte[]       imageBytes = Convert.FromBase64String(downloadData[0]);
                    MemoryStream ms         = new MemoryStream(imageBytes, 0,
                                                               imageBytes.Length);

                    // Convert byte[] to Image
                    ms.Write(imageBytes, 0, imageBytes.Length);
                    thumbnail = Image.FromStream(ms, true);
                }
                catch (Exception e)
                {
                    //thumbnail =  Resources.video_32x32;
                }
            }
            else
            {
                //thumbnail = Resources.video_32x32;
            }

            return(thumbnail);
        }
예제 #3
0
        public string Get(string field, bool refresh)
        {
            field = field.ToLower();
            string returnValue = null;

            if (refresh)
            {
                string[] aNowPlayingTemp = parent.Request("GetCurrentlyPlaying");

                if (aNowPlayingTemp != null)
                {
                    maNowPlayingInfo = new string[aNowPlayingTemp.Length, 2];
                    for (int x = 0; x < aNowPlayingTemp.Length; x++)
                    {
                        int splitIndex = aNowPlayingTemp[x].IndexOf(':') + 1;

                        if (splitIndex > 2)
                        {
                            maNowPlayingInfo[x, 0] = aNowPlayingTemp[x].Substring(0, splitIndex - 1).Replace(" ", "").ToLower();
                            maNowPlayingInfo[x, 1] = aNowPlayingTemp[x].Substring(splitIndex, aNowPlayingTemp[x].Length - splitIndex);

                            if (maNowPlayingInfo[x, 0] == field)
                            {
                                returnValue = this.maNowPlayingInfo[x, 1];
                            }
                        }
                    }
                }
            }
            else
            {
                if (maNowPlayingInfo != null)
                {
                    for (int x = 0; x < this.maNowPlayingInfo.GetLength(0); x++)
                    {
                        if (this.maNowPlayingInfo[x, 0] == field)
                        {
                            returnValue = this.maNowPlayingInfo[x, 1];
                        }
                    }
                }
            }

            return(returnValue);
        }
예제 #4
0
        public bool WebServerEnabled()
        {
            string[] webserverEnabled = parent.Request("WebServerStatus");

            if (webserverEnabled == null)
            {
                return(false);
            }
            else
            {
                return((webserverEnabled[0] == "On") ? true : false);
            }
        }
예제 #5
0
        public string[] Get(string type, bool parse)
        {
            string[] aPlaylistTemp = parent.Request("GetPlaylistContents(" + type + ")");

            if (parse)
            {
                if (aPlaylistTemp != null)
                {
                    aCurrentPlaylist = new string[aPlaylistTemp.Length];
                    for (int x = 0; x < aPlaylistTemp.Length; x++)
                    {
                        int i = aPlaylistTemp[x].LastIndexOf(".");
                        if (i > 1)
                        {
                            string extension = aPlaylistTemp[x].Substring(i, aPlaylistTemp[x].Length - i);
                            aPlaylistTemp[x] = aPlaylistTemp[x].Replace("\\", "/");
                            string[] aPlaylistEntry = aPlaylistTemp[x].Split('/');
                            string   playlistEntry  = aPlaylistEntry[aPlaylistEntry.Length - 1].Replace(extension, "");
                            aCurrentPlaylist[x] = playlistEntry;
                        }
                        else
                        {
                            aCurrentPlaylist[x] = "";
                        }
                    }

                    return(aCurrentPlaylist);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(aPlaylistTemp);
            }
        }
예제 #6
0
        public void Refresh()
        {
            if (isConnected)
            {
                if (mediaNowPlaying != parent.NowPlaying.Get("filename", true) || mediaNowPlaying == null)
                {
                    mediaNowPlaying = parent.NowPlaying.Get("filename");
                    newMediaPlaying = true;
                }
                else
                {
                    newMediaPlaying = false;
                }

                isPlaying    = (parent.NowPlaying.Get("playstatus", true) == "Playing") ? true : false;
                isPaused     = (parent.NowPlaying.Get("playstatus", true) == "Paused") ? true : false;
                isNotPlaying = (mediaNowPlaying == "[Nothing Playing]" || mediaNowPlaying == null) ? true : false;

                if (mediaNowPlaying == null || isNotPlaying || mediaNowPlaying.Length < 6)
                {
                    isPlayingLastFm = false;
                }
                else
                {
                    isPlayingLastFm = (mediaNowPlaying.Substring(0, 6) == "lastfm") ? true : false;
                }

                string[] aVolume   = parent.Request("GetVolume");
                string[] aProgress = parent.Request("GetPercentage");

                if (aVolume == null || aVolume[0] == "Error")
                {
                    volume = 0;
                }
                else
                {
                    volume = Convert.ToInt32(aVolume[0]);
                }

                if (aProgress == null || aProgress[0] == "Error" || aProgress[0] == "0" || Convert.ToInt32(aProgress[0]) > 99)
                {
                    progress = 1;
                }
                else
                {
                    progress = Convert.ToInt32(aProgress[0]);
                }

                isMuted = (volume == 0) ? true : false;
            }
        }
예제 #7
0
        public string[] Get(bool parse, bool refresh)
        {
            if (refresh)
            {
                string[] aPlaylistTemp = parent.Request("GetPlaylistContents(GetCurrentPlaylist)");

                if (parse == true)
                {
                    if (aPlaylistTemp != null)
                    {
                        aCurrentPlaylist = new string[aPlaylistTemp.Length];
                        for (int x = 0; x < aPlaylistTemp.Length; x++)
                        {
                            int i = aPlaylistTemp[x].LastIndexOf(".");
                            if (i > 1)
                            {
                                string extension = aPlaylistTemp[x].Substring(i, aPlaylistTemp[x].Length - i);
                                aPlaylistTemp[x] = aPlaylistTemp[x].Replace("/", "\\");
                                string[] aPlaylistEntry = aPlaylistTemp[x].Split('\\');
                                string   playlistEntry  = aPlaylistEntry[aPlaylistEntry.Length - 1].Replace(extension, "");
                                aCurrentPlaylist[x] = playlistEntry;
                            }
                            else
                            {
                                aCurrentPlaylist[x] = "";
                            }
                        }
                    }
                }
                else
                {
                    aCurrentPlaylist = aPlaylistTemp;
                }
            }

            return(aCurrentPlaylist);
        }
예제 #8
0
        public string[] GetArtists(string searchString)
        {
            string condition = (searchString == null) ? "" : " WHERE strArtist LIKE '%%" + searchString + "%%'";

            return(parent.Request("QueryMusicDatabase", "SELECT strArtist FROM artist" + condition + " ORDER BY strArtist"));
        }
예제 #9
0
 public bool Play()
 {
     string[] response = parent.Request("ExecBuiltIn", "PlayerControl(Play)");
     return(parent.CreateBoolRespose(response));
 }
예제 #10
0
 public void Play()
 {
     parent.Request("ExecBuiltIn", "PlayerControl(Play)");
 }