private void DoButton(string friendly, string button)
        {
            uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
            mpRequest.Action = "button";
            mpRequest.Filter = button;

            string response = uWiMP.TVServer.MPClientRemoting.SendAsyncMessage(friendly, mpRequest);
        }
    private object DisplayTVEpisode(string friendly, string compositeID)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getepisode";
      mpRequest.Value = compositeID;

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
      string name = (string)jo("name");
      string summary = (string)jo("summary");
      string watched = (string)jo("watched");
      string image = (string)jo("image");
      string filename = (string)jo("filename");
      string imagePath = GetThumb(friendly, string.Format("tvepisodethumb:{0}", compositeID));

      markup += "<div class=\"iMenu\" >";
      markup += string.Format("<h3>{0} - {1}</h3>", friendly, name);
      markup += "<div class=\"iBlock\">";
      markup += string.Format("<p><img src=\"{0}\" width=\"260\" style=\"display:block; margin-left:auto; margin-right:auto;\"/><br>{1}</p>", imagePath, summary);
      markup += "</div>";

      markup += "<ul class=\"iArrow\">";

      markup += string.Format("<li><a href=\"MPClient/TVSeriesPlay.aspx?friendly={0}&compositeID={1}#_TVSeriesPlayVideo\" rev=\"async\">{2}</a></li>", friendly, compositeID, GetGlobalResourceObject("uWiMPStrings", "play"));
      if (User.IsInRole("watcher")) {
        if (File.Exists(filename)) {
          markup += string.Format("<li><a href=\"Streaming/StartStream.aspx?type=tvseries&id={0}#_StartStream\" rev=\"async\">{1}</a></li>", HttpUtility.UrlEncode(filename), GetGlobalResourceObject("uWiMPStrings", "stream"));
        } else {
          uWiMP.TVServer.Utilities.TVLog(string.Format("Could not find file {0}", filename));
        }
      }

      markup += "</ul>";
      markup += "</div>";

      return markup;
    }
    string GetThumb(string friendly, string thumb)
    {
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getfile";
      mpRequest.Value = thumb;
      mpRequest.Filter = "large";

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
      string filetype = (string)jo("filetype");
      string filename = (string)jo("filename");
      string data = (string)jo("data");

      string relativePath = string.Format("../../images/{0}", Split(thumb, ":")(0));
      string imagePath = string.Format("{0}/{1}", relativePath, filename);
      System.Drawing.Imaging.ImageFormat format;
      switch (filetype.ToLower()) {
        case "jpeg":
          format = System.Drawing.Imaging.ImageFormat.Jpeg;
        case "gif":
          format = System.Drawing.Imaging.ImageFormat.Gif;
        case "png":
          format = System.Drawing.Imaging.ImageFormat.Png;
        case "bmp":
          format = System.Drawing.Imaging.ImageFormat.Bmp;
        default:
          return string.Format("{0}/blank.png", relativePath);
      }

      if (!File.Exists(Server.MapPath(imagePath))) {
        if (!Directory.Exists(relativePath))
          Directory.CreateDirectory(Server.MapPath(relativePath));

        System.Drawing.Image newImage;

        byte[] imageAsBytes = System.Convert.FromBase64String(data);
        MemoryStream myStream = new MemoryStream(imageAsBytes, 0, imageAsBytes.Length);
        myStream.Write(imageAsBytes, 0, imageAsBytes.Length);
        newImage = System.Drawing.Image.FromStream(myStream, true);

        try {
          newImage.Save(Server.MapPath(imagePath), format);
        } catch (Exception ex) {
          if (File.Exists(Server.MapPath(imagePath)))
            File.Delete(Server.MapPath(imagePath));
        }
      }

      return imagePath;
    }
    private string DisplayMusicUpdate(string friendly)
    {
      string markup = string.Empty;

      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "reorgmusic";

      string response = uWiMP.TVServer.MPClientRemoting.SendAsyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");

      markup += "<div class=\"iMenu\" >";
      markup += string.Format("<h3>{0} - {1}</h3>", friendly, GetGlobalResourceObject("uWiMPStrings", "music_update"));

      markup += "<ul>";
      if (success) {
        markup += string.Format("<li>{0}</a></li>", GetGlobalResourceObject("uWiMPStrings", "music_update_request_success"));
      } else {
        markup += string.Format("<li>{0}</a></li>", GetGlobalResourceObject("uWiMPStrings", "music_update_request_fail"));
      }

      markup += "</ul>";
      markup += "</div>";

      return markup;
    }
    private string DoPowerOption(string friendly, string poweroption)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "poweroption";
      mpRequest.Filter = poweroption;

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");

      markup += "<div class=\"iMenu\">";
      markup += string.Format("<h3>{0} - {1}</h3>", friendly, GetGlobalResourceObject("uWiMPStrings", "power_options"));
      markup += "<ul>";
      if (success) {
        markup += string.Format("<li>{0}</li>", GetGlobalResourceObject("uWiMPStrings", "power_option_success"));
      } else {
        markup += string.Format("<li style=\"color:red\">{0}</li>", GetGlobalResourceObject("uWiMPStrings", "power_option_fail"));
      }
      markup += "</ul>";
      markup += "</div>";

      markup += "<div>";
      markup += string.Format("<a href=\"MPClient/MainMenu.aspx#_MPClientMenu\" rev=\"async\" rel=\"Action\" class=\"iButton iBClassic\">{0}</a>", GetGlobalResourceObject("uWiMPStrings", "home"));
      markup += "</div>";

      return markup;
    }
        private string DisplayAlbumsForArtists(string friendly, string genre, int start, int pagesize)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getalbums";
      mpRequest.Filter = "genre";
      mpRequest.Value = genre;

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));

      JsonArray ja = (JsonArray)jo("albums");
      uWiMP.TVServer.MPClient.SmallAlbumInfo[] albums = (uWiMP.TVServer.MPClient.SmallAlbumInfo[])JsonConvert.Import(typeof(uWiMP.TVServer.MPClient.SmallAlbumInfo[]), ja.ToString);

      if (start == 0) {
        markup += "<div class=\"iMenu\" >";
        markup += string.Format("<h3>{0} - {1}</h3>", friendly, genre);
        markup += "<ul class=\"iArrow\">";
        markup += string.Format("<li><a href=\"MPClient/MyMusicPlayRandom.aspx?friendly={0}&filter=genre&value={1}#_MPClientPlayRandom\" rev=\"async\">{2}</a></li>", friendly, genre, GetGlobalResourceObject("uWiMPStrings", "play_100_random"));
        markup += "</ul>";
        markup += "<ul class=\"iArrow\">";
      }

      for (int i = start; i <= (start + (pagesize - 1)); i++) {
        if (i <= UBound(albums)) {
          markup += string.Format("<li><a href=\"MPClient/MyMusicListAlbum.aspx?friendly={0}&album={3}&artist={4}#_MyMusicListAlbum\" rev=\"async\">{1}<br/><small style=\"display:block;font-size:14px;color:#7f7f7f;line-height:18px;text-shadow:none;font-weight:normal;\">{2}</small></a></li>", friendly, albums(i).Album, albums(i).Artist, Server.UrlEncode(albums(i).Album), Server.UrlEncode(albums(i).Artist));
        }
      }

      if ((start + (pagesize - 1)) < UBound(albums)) {
        markup += string.Format("<li id=\"morealbumsgenre\" class=\"iMore\"><a href=\"MPClient/MyMusicListAlbumsForGenre.aspx?friendly={0}&value={1}&start={2}#_MyMusicListAlbumForGenre\" rev=\"async\" title=\"{3}\">{4}</a></li>", friendly, genre, (start + pagesize).ToString(), GetGlobalResourceObject("uWiMPStrings", "loading"), GetGlobalResourceObject("uWiMPStrings", "more"));
      }

      if (start == 0) {
        markup += "</ul>";
        markup += "</div>";
      }

      return markup;
    }
    private string DisplayMovingPicturesYears(string friendly, string decade)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getmovingpicturefilter";
      mpRequest.Filter = "year";
      mpRequest.Value = decade;

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
      JsonArray ja = (JsonArray)jo("year");
      string[] filters = (string[])ja.ToArray(typeof(string));
      Array.Sort(filters);
      Array.Reverse(filters);

      markup += "<div class=\"iMenu\">";
      markup += string.Format("<h3>{0} - {1}</h3>", friendly, GetGlobalResourceObject("uWiMPStrings", "movingpictures_year"));
      markup += "<ul class=\"iArrow\">";

      foreach (string filter in filters) {
        if (filter != "")
          markup += string.Format("<li><a href=\"MPClient/MovingPicturesList.aspx?friendly={0}&filter=year&value={1}&start=0#_MovingPicturesMovies{1}\" rev=\"async\">{1}</a></li>", friendly, filter);
      }

      markup += "</ul>";
      markup += "</div>";

      return markup;
    }
    private string DisplayMyMusicArtists(string friendly, string letter, int start, int pagesize)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getmusicfilter";
      mpRequest.Filter = "artist";
      mpRequest.Value = letter;

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));

      JsonArray ja = (JsonArray)jo("artist");
      string[] filters = (string[])ja.ToArray(typeof(string));
      Array.Sort(filters);

      if (start == 0) {
        markup += "<div class=\"iMenu\" >";
        markup += string.Format("<h3>{0} - {1}</h3>", friendly, GetGlobalResourceObject("uWiMPStrings", "music_by_artist"));
        markup += "<ul class=\"iArrow\">";
      }

      for (int i = start; i <= (start + (pagesize - 1)); i++) {
        if (i <= UBound(filters)) {
          markup += string.Format("<li><a href=\"MPClient/MyMusicListAlbumsForArtist.aspx?friendly={0}&value={1}#_MyMusicListAlbumForArtist\" rev=\"async\">{1}</a></li>", friendly, filters(i));
        }
      }

      if ((start + (pagesize - 1)) < UBound(filters)) {
        markup += string.Format("<li id=\"more\" class=\"iMore\"><a href=\"MPClient/MyMusicListArtists.aspx?friendly={0}&value={1}&start={2}#_MyMusicAlbumsForArtist\" rev=\"async\" title=\"{3}\">{4}</a></li>", friendly, letter, (start + pagesize).ToString(), GetGlobalResourceObject("uWiMPStrings", "loading"), GetGlobalResourceObject("uWiMPStrings", "more"));
      }

      if (start == 0) {
        markup += "</ul>";
        markup += "</div>";
      }

      return markup;
    }
    private object DisplayTVSeasons(string friendly)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getrecentepisodes";
      mpRequest.Value = uWiMP.TVServer.Utilities.GetAppConfig("RECENTSIZE");
      mpRequest.Filter = uWiMP.TVServer.Utilities.GetAppConfig("PAGESIZE");

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
      JsonArray ja = (JsonArray)jo("episodes");
      uWiMP.TVServer.MPClient.LargeEpisodeInfo[] episodeList = (uWiMP.TVServer.MPClient.LargeEpisodeInfo[])JsonConvert.Import(typeof(uWiMP.TVServer.MPClient.LargeEpisodeInfo[]), ja.ToString);

      markup += "<div class=\"iMenu\" >";
      markup += string.Format("<h3>{0} - {2}</h3>", friendly, GetGlobalResourceObject("uWiMPStrings", "tv_series"), GetGlobalResourceObject("uWiMPStrings", "tvseries_recent"));
      markup += "<ul class=\"iArrow\">";

      foreach (uWiMP.TVServer.MPClient.LargeEpisodeInfo episode in episodeList) {
        mpRequest.Action = "getseries";
        mpRequest.Value = episode.SeriesID;
        response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
        jo = (JsonObject)JsonConvert.Import(response);
        success = (bool)jo("result");
        if (!success)
          throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
        string seriesName = (string)jo("name");
        markup += string.Format("<li><a href=\"MPClient/TVSeriesEpisode.aspx?friendly={0}&compositeID={1}#_TVSeriesEpisode{1}\" rev=\"async\">{2}. {3}<br/><small style=\"display:block;font-size:14px;color:#7f7f7f;line-height:18px;text-shadow:none;font-weight:normal;\">{4} {5} {6}</small></a></li>", friendly, episode.ID, episode.Index.ToString(), episode.Name, seriesName, GetGlobalResourceObject("uWiMPStrings", "tv_series_season"), episode.SeasonIndex.ToString);
      }

      markup += "</ul>";
      markup += "</div>";

      return markup;
    }
    private object DisplayTVSeasons(string friendly, string seriesID)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getseries";
      mpRequest.Value = seriesID;

      string josnResponse = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(josnResponse);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
      string name = (string)jo("name");
      string summary = (string)jo("summary");
      string banner = (string)jo("banner");
      string imagePath = GetSeriesBanner(friendly, banner);

      mpRequest.Action = "getseasons";
      josnResponse = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      jo = (JsonObject)JsonConvert.Import(josnResponse);
      success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
      JsonArray ja = (JsonArray)jo("seasons");
      uWiMP.TVServer.MPClient.SmallSeasonInfo[] seasonList = (uWiMP.TVServer.MPClient.SmallSeasonInfo[])JsonConvert.Import(typeof(uWiMP.TVServer.MPClient.SmallSeasonInfo[]), ja.ToString);

      if (seasonList.Length == 1) {
        Response.Redirect(string.Format("TVSeriesSeasonList.aspx?friendly={0}&compositeID={1}_{2}#_TVSeriesSeason{1}_{2}", friendly, seriesID, Replace(Split(seasonList(0).ID, "_")(1), "s", "")));
      }

      markup += "<div class=\"iMenu\" >";
      markup += string.Format("<h3>{0} - {1}</h3>", friendly, name);

      markup += "<div class=\"iBlock\">";
      markup += string.Format("<p><img src=\"{0}\" width=\"260\" style=\"display:block; margin-left:auto; margin-right:auto;\"/><br>{1}</p>", imagePath, summary);
      markup += "</div>";

      markup += "<ul class=\"iArrow\">";

      foreach (uWiMP.TVServer.MPClient.SmallSeasonInfo season in seasonList) {
        string seasonIndex = Replace(Split(season.ID, "_")(1), "s", "");
        markup += string.Format("<li><a href=\"MPClient/TVSeriesSeasonList.aspx?friendly={0}&compositeID={1}_{2}#_TVSeriesSeason{1}_{2}\" rev=\"async\">{3} {2}</a></li>", friendly, seriesID, seasonIndex, GetGlobalResourceObject("uWiMPStrings", "tv_series_season"));
      }

      markup += "</ul>";
      markup += "</div>";

      return markup;
    }
Esempio n. 11
0
    private string PlayVideo(string friendly, string movieID)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getmovie";
      mpRequest.Filter = movieID;

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
      uWiMP.TVServer.MPClient.BigMovieInfo movie = (uWiMP.TVServer.MPClient.BigMovieInfo)JsonConvert.Import(typeof(uWiMP.TVServer.MPClient.BigMovieInfo), response);

      mpRequest.Action = "playmovie";
      mpRequest.Value = "force";
      response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      jo = (JsonObject)JsonConvert.Import(response);
      success = (bool)jo("result");

      markup += "<div class=\"iMenu\">";
      markup += string.Format("<h3>{0} {1}</h3>", GetGlobalResourceObject("uWiMPStrings", "now_playing"), movie.Title);
      markup += "<ul class=\"iArrow\">";

      if (success) {
        markup += string.Format("<li><a href=\"MPClient/MCERemoteControl.aspx?friendly={0}#_Remote1\" rev=\"async\">{1}</a></li>", friendly, GetGlobalResourceObject("uWiMPStrings", "remote_control"));
        markup += string.Format("<li><a href=\"MPClient/NowPlaying.aspx?friendly={0}#_MPClientNowPlaying\" rev=\"async\">{1}</a></li>", friendly, GetGlobalResourceObject("uWiMPStrings", "now_playing"));
      } else {
        markup += string.Format("<li style=\"color:red\">{0}</li>", GetGlobalResourceObject("uWiMPStrings", "could_not_start_video"));
      }

      markup += "</ul>";
      markup += "</div>";

      return markup;
    }
    private string DisplaySavePlaylistResult(string friendly, string filename)
    {
      string markup = string.Empty;
      object regexPattern = "[\\\\\\/.:\\*\\?\"'<>|] ";
      Regex objRegEx = new Regex(regexPattern);
      filename = objRegEx.Replace(filename, "");

      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "saveplaylist";
      mpRequest.Filter = filename;

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");

      markup += "<div class=\"iMenu\" >";
      markup += string.Format("<h3>{0} - {1}</h3>", friendly, GetGlobalResourceObject("uWiMPStrings", "save_playlist"));

      markup += "<ul>";
      if (success) {
        markup += string.Format("<li>{0}</li>", GetGlobalResourceObject("uWiMPStrings", "save_playlist_success"));
      } else {
        markup += string.Format("<li>{0}</li>", GetGlobalResourceObject("uWiMPStrings", "save_playlist_fail"));
      }
      markup += "</ul>";
      markup += "</div>";

      return markup;
    }
    private string SendMessage(string friendly, string message)
    {
      string markup = string.Empty;
      string response = string.Empty;
      List<Client> successfulClients = new List<Client>();
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "sendmessage";
      mpRequest.Filter = string.Format("{0} {1}", GetGlobalResourceObject("uWiMPStrings", "message_from"), User.Identity.Name.ToString);
      mpRequest.Value = message;

      if (friendly.ToLower == "all") {
        List<Client> clients = uWiMP.TVServer.MPClientDatabase.GetClients;

        if ((User.IsInRole("remoter")) & (clients.Count > 0)) {
          foreach (uWiMP.TVServer.MPClient.Client client in clients) {
            if (uWiMP.TVServer.MPClientRemoting.CanConnect(client.Friendly)) {
              mpRequest.Filter = client.Friendly;
              response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(client.Friendly, mpRequest);
              JsonObject jo = (JsonObject)JsonConvert.Import(response);
              bool success = (bool)jo("result");
              if (success)
                successfulClients.Add(client);
            }
          }
        }

        markup += "<div class=\"iMenu\">";
        markup += string.Format("<h3>{0}</h3>", GetGlobalResourceObject("uWiMPStrings", "send_message_to"));
        markup += "<ul class=\"iArrow\">";
        if (successfulClients.Count > 0) {
          foreach (uWiMP.TVServer.MPClient.Client client in successfulClients) {
            markup += string.Format("<li><a href=\"MPClient/MPClientMenu.aspx?friendly={0}#_MPClient\" rev=\"async\">{0}</a></li>", client.Friendly);
          }
        } else {
          markup += string.Format("<li style=\"color:red\">{0}</li>", GetGlobalResourceObject("uWiMPStrings", "no_messages_sent"));
        }
        markup += "</ul>";
        markup += "</div>";
      } else {
        response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
        JsonObject jo = (JsonObject)JsonConvert.Import(response);
        bool success = (bool)jo("result");

        markup += "<div class=\"iMenu\">";
        markup += string.Format("<h3>{0} - {1}</h3>", friendly, GetGlobalResourceObject("uWiMPStrings", "send_message"));
        markup += "<ul>";
        if (success) {
          markup += string.Format("<li>{0}</li>", GetGlobalResourceObject("uWiMPStrings", "send_message_success"));
        } else {
          markup += string.Format("<li style=\"color:red\">{0}</li>", GetGlobalResourceObject("uWiMPStrings", "send_message_fail"));
        }
        markup += "</ul>";
        markup += "</div>";
      }

      return markup;
    }
    private string DisplayMyVideoMenu(string friendly, string movieID)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getmovie";
      mpRequest.Filter = movieID;

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
      uWiMP.TVServer.MPClient.BigMovieInfo movie = (uWiMP.TVServer.MPClient.BigMovieInfo)JsonConvert.Import(typeof(uWiMP.TVServer.MPClient.BigMovieInfo), response);

      markup += "<div class=\"iMenu\" >";
      markup += string.Format("<h3>{0} - {1}</h3>", friendly, movie.Title);

      markup += "<div class=\"iBlock\">";
      markup += string.Format("<p><em>{0}</em><br><br>{1}</p>", movie.Tagline, movie.Plot);
      markup += "</div>";

      //starbar
      markup += "<div class=\"starbar static\">";
      markup += "<div class=\"outer\">";
      markup += string.Format("<div class=\"inner\" style=\"width:{0}px;\"/>", (movie.Rating * 20).ToString);
      markup += string.Format("<div class=\"meta\"><b>{0}/10</b></div>", movie.Rating);
      markup += "</div>";
      markup += "</div>";
      markup += "</div>";

      markup += "<ul class=\"iArrow\">";

      markup += string.Format("<li><a href=\"MPClient/MyVideosPlay.aspx?friendly={0}&ID={1}#_MPClientPlayVideo\" rev=\"async\">{2}</a></li>", friendly, movieID, GetGlobalResourceObject("uWiMPStrings", "play"));
      markup += string.Format("<li><a href=\"MPClient/MyVideosCoverArt.aspx?friendly={0}&ID={1}#_MPClientCoverArt\" rev=\"async\">{2}</a></li>", friendly, movieID, GetGlobalResourceObject("uWiMPStrings", "cover_art"));
      markup += string.Format("<li><a href=\"http://www.imdb.com/title/{0}/\" target=\"_blank\" >{1}</a></li>", movie.IMDBNumber, GetGlobalResourceObject("uWiMPStrings", "imdb"));

      markup += "</ul>";
      markup += "</div>";

      return markup;
    }
    private string DisplayAlbum(string wa, string friendly, string album, string artist)
    {
      string markup = string.Empty;

      markup += "<div class=\"iMenu\">";
      markup += string.Format("<h3>{0} - {1} - {2}</h3>", friendly, artist, album);

      markup += "<ul class=\"iArrow\">";
      markup += string.Format("<li><a href=\"#\" onclick=\"return playtracks('{3}','{0}','{1}');\">{2}</a></li>", friendly, Replace(artist, "'", "\\'"), GetGlobalResourceObject("uWiMPStrings", "play"), wa);
      markup += string.Format("<li><label>{0}</label><input type=\"checkbox\" id=\"jsShuffleAlbum\" class=\"iToggle\" title=\"{1}\" /></li>", GetGlobalResourceObject("uWiMPStrings", "shuffle"), GetGlobalResourceObject("uWiMPStrings", "yesno"));
      markup += string.Format("<li><label>{0}</label><input type=\"checkbox\" id=\"jsEnqueueAlbum\" class=\"iToggle\" title=\"{1}\" /></li>", GetGlobalResourceObject("uWiMPStrings", "enqueue"), GetGlobalResourceObject("uWiMPStrings", "yesno"));
      markup += "</ul>";

      markup += "<ul>";

      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getalbum";
      mpRequest.Filter = album;
      mpRequest.Value = artist;

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));

      JsonArray ja = (JsonArray)jo("album");
      uWiMP.TVServer.MPClient.AlbumTrack[] tracks = (uWiMP.TVServer.MPClient.AlbumTrack[])JsonConvert.Import(typeof(uWiMP.TVServer.MPClient.AlbumTrack[]), ja.ToString);

      int i = 0;
      foreach (uWiMP.TVServer.MPClient.AlbumTrack track in tracks) {
        i += 1;
        markup += string.Format("<li><label><div style=\"display:inline-block; width:65%; overflow:hidden\">{0}</div></label><input type=\"checkbox\" id=\"MusicTrack{3}\" value=\"{3}\" class=\"iToggle\" title=\"{1}\" /></li>", track.Title, GetGlobalResourceObject("uWiMPStrings", "yesno"), i.ToString(), track.ID);
      }

      markup += "</ul>";

      markup += "<ul class=\"iArrow\">";
      markup += string.Format("<li><a href=\"MPClient/MyMusicCoverArt.aspx?friendly={0}&artist={1}&album={2}#_MyMusicCoverArt\" rev=\"async\">{3}</a></li>", friendly, artist, album, GetGlobalResourceObject("uWiMPStrings", "cover_art"));
      markup += "</ul>";

      markup += "</div>";

      return markup;
    }
    private string DisplayMyMusicArtists(string friendly)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getmusicfilter";
      mpRequest.Filter = "albumletter";

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));

      JsonArray ja = (JsonArray)jo("albumletter");
      string[] filters = (string[])ja.ToArray(typeof(string));
      Array.Sort(filters);

      markup += "<div class=\"iMenu\" >";
      markup += string.Format("<h3>{0} - {1}</h3>", friendly, GetGlobalResourceObject("uWiMPStrings", "music_by_album"));
      markup += "<ul class=\"iArrow\">";

      foreach (string filter in filters) {
        markup += string.Format("<li><a href=\"MPClient/MyMusicListAlbums.aspx?friendly={0}&value={1}&start=0#_MyMusicListAlbums{1}\" rev=\"async\">{1}</a></li>", friendly, filter);
      }

      markup += "</ul>";
      markup += "</div>";

      return markup;
    }
    private string DisplaySongs(string wa, string friendly, string playlist, int start, int pagesize)
    {
      string markup = string.Empty;

      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "gettracks";
      mpRequest.Filter = "playlist";
      mpRequest.Value = playlist;
      mpRequest.Start = start;
      mpRequest.PageSize = pagesize;

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));

      JsonArray ja = (JsonArray)jo("tracks");
      uWiMP.TVServer.MPClient.AlbumTrack[] tracks = (uWiMP.TVServer.MPClient.AlbumTrack[])JsonConvert.Import(typeof(uWiMP.TVServer.MPClient.AlbumTrack[]), ja.ToString);

      if (start == 0) {
        markup += "<div class=\"iMenu\">";
        markup += string.Format("<h3>{0}</h3>", playlist);

        markup += "<ul class=\"iArrow\">";
        markup += string.Format("<li><a href=\"#\" onclick=\"return playtracks('{3}','{0}','{1}');\">{2}</a></li>", friendly, Replace(playlist, "'", "\\'"), GetGlobalResourceObject("uWiMPStrings", "play"), wa);
        markup += string.Format("<li><label>{0}</label><input type=\"checkbox\" id=\"jsShufflePlaylist\" class=\"iToggle\" title=\"{1}\" /></li>", GetGlobalResourceObject("uWiMPStrings", "shuffle"), GetGlobalResourceObject("uWiMPStrings", "yesno"));
        markup += string.Format("<li><label>{0}</label><input type=\"checkbox\" id=\"jsEnqueuePlaylist\" class=\"iToggle\" title=\"{1}\" /></li>", GetGlobalResourceObject("uWiMPStrings", "enqueue"), GetGlobalResourceObject("uWiMPStrings", "yesno"));
        markup += "</ul>";

        markup += "<ul>";
      }

      int i = 0;
      foreach (uWiMP.TVServer.MPClient.AlbumTrack track in tracks) {
        i += 1;
        markup += string.Format("<li><label><div style=\"display:inline-block; width:65%; overflow:hidden\">{0}</div></label><input type=\"checkbox\" id=\"MusicTrack{3}\" value=\"{3}\" class=\"iToggle\" title=\"{1}\" /></li>", track.Title, GetGlobalResourceObject("uWiMPStrings", "yesno"), (start + i).ToString(), track.ID);
      }

      mpRequest.Start = start + pagesize;
      response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      jo = (JsonObject)JsonConvert.Import(response);
      success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
      ja = (JsonArray)jo("tracks");
      tracks = (uWiMP.TVServer.MPClient.AlbumTrack[])JsonConvert.Import(typeof(uWiMP.TVServer.MPClient.AlbumTrack[]), ja.ToString);

      if (UBound(tracks) > 0)
        markup += string.Format("<li id=\"moreplaylist\" class=\"iMore\"><a href=\"MPClient/MyMusicListTracksForPlaylist.aspx?friendly={0}&playlist={1}&start={2}#_MyMusicListTracksForPlaylist\" rev=\"async\" title=\"{3}\">{4}</a></li>", friendly, playlist, (start + pagesize).ToString(), GetGlobalResourceObject("uWiMPStrings", "loading"), GetGlobalResourceObject("uWiMPStrings", "more"));

      if (start == 0) {
        markup += "</ul>";
        markup += "</div>";
      }

      return markup;
    }
    private string DisplayMyMusicPlaylists(string friendly)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();

      mpRequest.Action = "getrandomplaylist";

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));

      JsonArray ja = (JsonArray)jo("playlists");
      string[] playlists = (string[])ja.ToArray(typeof(string));
      Array.Sort(playlists);

      markup += "<div class=\"iMenu\" >";
      markup += string.Format("<h3>{0} - {1}</h3>", friendly, GetGlobalResourceObject("uWiMPStrings", "music_playlists"));

      foreach (string playlist in playlists) {
        if (!playlist.ToLower == "noplaylists") {
          markup += "<ul class=\"iArrow\">";
          markup += string.Format("<li><a href=\"MPClient/MyMusicListTracksForPlaylist.aspx?friendly={0}&playlist={1}&start=0#_MyMusicListTracksForPlaylist\" rev=\"async\">{2}</a></li>", friendly, playlist, GetGlobalResourceObject("uWiMPStrings", "play_random_playlist"));
          markup += "</ul>";
        }
      }

      mpRequest.Action = "getplaylists";
      response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      jo = (JsonObject)JsonConvert.Import(response);
      success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));

      ja = (JsonArray)jo("playlists");
      playlists = (string[])ja.ToArray(typeof(string));
      Array.Sort(playlists);

      markup += "<ul class=\"iArrow\">";
      foreach (string playlist in playlists) {
        if (playlist.ToLower == "noplaylists") {
          markup += string.Format("<li style=\"color:red\">{1}</li>", friendly, GetGlobalResourceObject("uWiMPStrings", "no_playlists_found"));
        } else {
          markup += string.Format("<li><a href=\"MPClient/MyMusicListTracksForPlaylist.aspx?friendly={0}&playlist={1}&start=0#_MyMusicListTracksForPlaylist\" rev=\"async\">{1}</a></li>", friendly, playlist);
        }
      }
      markup += "</ul>";
      markup += "</div>";

      return markup;
    }
Esempio n. 19
0
    private object DisplayTVSeriesList(string friendly)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getserieslist";

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
      JsonArray ja = (JsonArray)jo("series");
      uWiMP.TVServer.MPClient.SmallSeriesInfo[] seriesList = (uWiMP.TVServer.MPClient.SmallSeriesInfo[])JsonConvert.Import(typeof(uWiMP.TVServer.MPClient.SmallSeriesInfo[]), ja.ToString);

      markup += "<div class=\"iMenu\" >";
      markup += string.Format("<h3>{0} - {1}</h3>", friendly, GetGlobalResourceObject("uWiMPStrings", "tv_series"));
      markup += "<ul class=\"iArrow\">";

      foreach (uWiMP.TVServer.MPClient.SmallSeriesInfo series in seriesList) {
        markup += string.Format("<li><a href=\"MPClient/TVSeriesSeasonsList.aspx?friendly={0}&ID={1}#_TVSeriesSeasons{1}\" rev=\"async\">{2}</a></li>", friendly, series.ID.ToString(), series.Name);
      }

      markup += "</ul>";
      markup += "</div>";

      return markup;
    }
Esempio n. 20
0
    private string GetNowPlaying(string friendly)
    {
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "nowplaying";

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));

      string media = (string)jo("media");

      switch (media.ToLower()) {
        case "music":
          return PlayingMusic(friendly, jo);
        case "video":
          return PlayingVideo(friendly, jo, "video");
        case "movingpicture":
          return PlayingVideo(friendly, jo, "movingpicture");
        case "dvd":
          return PlayingDVD(friendly, jo);
        case "radio":
          return PlayingRadio(friendly, jo);
        case "tv":
          return PlayingTV(friendly, jo);
        case "recording":
          return PlayingRecording(friendly, jo);
        case "tvepisode":
          return PlayingTVEpisode(friendly, jo);
        case "unknown":
          return PlayingUnknown(friendly);
        case "nothing":
          return PlayingNothing(friendly);
        default:
          return PlayingUnknown(friendly);
      }
    }
    private string PlayRandom(string friendly, string filter, string value)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "playrandommusic";
      mpRequest.Filter = filter;
      mpRequest.Value = value;

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");

      markup += "<div class=\"iMenu\" >";
      markup += string.Format("<h3>{0} - {1}</h3>", GetGlobalResourceObject("uWiMPStrings", "now_playing"), filter);
      markup += "<ul class=\"iArrow\">";

      if (success) {
        markup += string.Format("<li><a href=\"MPClient/MCERemoteControl.aspx?friendly={0}#_Remote1\" rev=\"async\">{1}</a></li>", friendly, GetGlobalResourceObject("uWiMPStrings", "remote_control"));
        markup += string.Format("<li><a href=\"MPClient/MyMusicSavePlaylist.aspx?friendly={0}#_MyMusicSavePlaylist\" rev=\"async\">{1}</a></li>", friendly, GetGlobalResourceObject("uWiMPStrings", "save_playlist"));
      } else {
        markup += string.Format("<li style=\"color:red\">{0}</li>", GetGlobalResourceObject("uWiMPStrings", "could_not_start_music"));
      }

      markup += "</ul>";
      markup += "</div>";

      return markup;
    }
Esempio n. 22
0
    private string PlayEpisode(string friendly, string compositeID)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getepisode";
      mpRequest.Value = compositeID;

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
      string name = (string)jo("name");

      mpRequest.Action = "playepisode";
      response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      jo = (JsonObject)JsonConvert.Import(response);
      success = (bool)jo("result");

      markup += "<div class=\"iMenu\">";
      markup += string.Format("<h3>{0} {1}</h3>", GetGlobalResourceObject("uWiMPStrings", "now_playing"), name);
      markup += "<ul class=\"iArrow\">";

      if (success) {
        markup += string.Format("<li><a href=\"MPClient/MCERemoteControl.aspx?friendly={0}#_Remote1\" rev=\"async\">{1}</a></li>", friendly, GetGlobalResourceObject("uWiMPStrings", "remote_control"));
        markup += string.Format("<li><a href=\"MPClient/NowPlaying.aspx?friendly={0}#_MPClientNowPlaying\" rev=\"async\">{1}</a></li>", friendly, GetGlobalResourceObject("uWiMPStrings", "now_playing"));
      } else {
        markup += string.Format("<li style=\"color:red\">{0}</li>", GetGlobalResourceObject("uWiMPStrings", "tvseries_start_fail"));
      }

      markup += "</ul>";
      markup += "</div>";

      return markup;
    }
    private object DisplayTVSeasons(string friendly, string compositeID)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getseries";
      mpRequest.Value = Split(compositeID, "_")(0);

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
      string name = (string)jo("name");

      mpRequest.Action = "getepisodes";
      mpRequest.Value = compositeID;
      response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      jo = (JsonObject)JsonConvert.Import(response);
      success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
      JsonArray ja = (JsonArray)jo("episodes");
      uWiMP.TVServer.MPClient.SmallEpisodeInfo[] episodeList = (uWiMP.TVServer.MPClient.SmallEpisodeInfo[])JsonConvert.Import(typeof(uWiMP.TVServer.MPClient.SmallEpisodeInfo[]), ja.ToString);

      markup += "<div class=\"iMenu\" >";
      markup += string.Format("<h3>{0} - {1} ({2})</h3>", friendly, name, Split(compositeID, "_")(1));
      markup += "<ul class=\"iArrow\">";

      foreach (uWiMP.TVServer.MPClient.SmallEpisodeInfo episode in episodeList) {
        markup += string.Format("<li><a href=\"MPClient/TVSeriesEpisode.aspx?friendly={0}&compositeID={1}#_TVSeriesEpisode{1}\" rev=\"async\">{2}. {3}</a></li>", friendly, episode.ID, episode.Index.ToString(), episode.Name);
      }

      markup += "</ul>";
      markup += "</div>";

      return markup;
    }
    private string DisplayCoverArt(string friendly, string movieID)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getmovingpicture";
      mpRequest.Filter = movieID;

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
      uWiMP.TVServer.MPClient.BigMovieInfo movie = (uWiMP.TVServer.MPClient.BigMovieInfo)JsonConvert.Import(typeof(uWiMP.TVServer.MPClient.BigMovieInfo), response);

      markup += "<div class=\"iMenu\">";
      markup += string.Format("<h3>{0}</h3>", movie.Title);
      markup += "<div class=\"iBlock\" >";
      markup += "<p>";
      markup += string.Format("<img src=\"{0}\" height=\"300\" style=\"display:block; margin-left:auto; margin-right:auto;\"/>", GetThumb(friendly, string.Format("movingpicturethumb:{0}", Path.GetFileName(movie.ThumbURL))));
      markup += "</p>";
      markup += "</ul>";
      markup += "</div>";
      markup += "</div>";

      return markup;
    }
    private string DisplayMyVideosList(string wa, string friendly, string filter, string value, int start, int pagesize)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getmovingpictures";
      mpRequest.Filter = filter;
      mpRequest.Value = value;

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
      JsonArray ja = (JsonArray)jo("movingpictures");
      uWiMP.TVServer.MPClient.SmallMovieInfo[] movies = (uWiMP.TVServer.MPClient.SmallMovieInfo[])JsonConvert.Import(typeof(uWiMP.TVServer.MPClient.SmallMovieInfo[]), ja.ToString);

      if (start == 0) {
        markup += string.Format("<div class=\"iMenu\" id=\"{0}\">", wa);
        markup += string.Format("<h3>{0} - {1} ({2})</h3>", friendly, GetGlobalResourceObject("uWiMPStrings", "moving_pictures"), value);
        markup += "<ul class=\"iArrow\">";
      }

      for (int i = start; i <= (start + (pagesize - 1)); i++) {
        if (i <= UBound(movies)) {
          markup += string.Format("<li><a href=\"MPClient/MovingPicturesDisplay.aspx?friendly={0}&ID={1}#_MovingPicturesVideo{1}\" rev=\"async\">{2}</a></li>", friendly, movies(i).ID, movies(i).Title);
        }
      }

      if ((start + (pagesize - 1)) < UBound(movies)) {
        markup += string.Format("<li id=\"moremovingpictures{1}\" class=\"iMore\"><a href=\"MPClient/MovingPicturesList.aspx?friendly={0}&filter={1}&value={2}&start={3}#_MovingPicturesMovies{2}\" rev=\"async\" title=\"{4}\">{5}</a></li>", friendly, filter, value, (start + pagesize).ToString(), GetGlobalResourceObject("uWiMPStrings", "loading"), GetGlobalResourceObject("uWiMPStrings", "more"));
      }

      if (start == 0) {
        markup += "</ul>";
        markup += "</div>";
      }

      return markup;
    }
    private string DisplayCoverArt(string friendly, string artist, string album)
    {
      string markup = string.Empty;
      uWiMP.TVServer.MPClient.Request mpRequest = new uWiMP.TVServer.MPClient.Request();
      mpRequest.Action = "getmusiccoverart";
      mpRequest.Filter = artist;
      mpRequest.Value = album;

      string response = uWiMP.TVServer.MPClientRemoting.SendSyncMessage(friendly, mpRequest);
      JsonObject jo = (JsonObject)JsonConvert.Import(response);
      bool success = (bool)jo("result");
      if (!success)
        throw new Exception(string.Format("Error with iPiMP remoting...<br>Client: {0}<br>Action: {1}", friendly, mpRequest.Action));
      string imageString = (string)jo("image");

      string imagePath = string.Empty;
      if (imageString.ToLower == "empty") {
        imagePath = "../../images/music/blankmusic.png";
      } else {
        imagePath = saveImageToDisk(artist, album, imageString);
      }

      markup += "<div class=\"iMenu\" >";
      markup += string.Format("<h3>{0} - {1}</h3>", artist, album);
      markup += "<div class=\"iBlock\" >";
      markup += "<p>";
      markup += string.Format("<img src=\"{0}\" width=\"260\" style=\"display:block; margin-left:auto; margin-right:auto;\"/>", imagePath);
      markup += "</p>";
      markup += "</ul>";
      markup += "</div>";
      markup += "</div>";

      return markup;
    }