private static void SetPlaylistFields(ref Item currentItem, BCPlaylist play) {

			//Set the appropriate field values for the new item
			currentItem.Fields["Name"].Value = play.name;
			currentItem.Fields["Reference Id"].Value = play.referenceId;
			currentItem.Fields["Short Description"].Value = play.shortDescription;
			string vidIdList = "";
			foreach (long vidId in play.videoIds) {
				if (vidIdList.Length > 0) {
					vidIdList += ",";
				}
				vidIdList += vidId.ToString();
			}
			currentItem.Fields["Video Ids"].Value = vidIdList;
			currentItem.Fields["ID"].Value = play.id.ToString();
			currentItem.Fields["Thumbnail URL"].Value = play.thumbnailURL;
			string filterTags = "";
			if (play.filterTags != null) {
				foreach (string tag in play.filterTags) {
					if (filterTags.Length > 0) {
						filterTags += ",";
					}
					filterTags += tag;
				}
			}
			currentItem.Fields["Filter Tags"].Value = filterTags;
			currentItem.Fields["Playlist Type"].Value = play.playlistType.ToString();
			currentItem.Fields["Account Id"].Value = play.accountId.ToString();
		}
Exemple #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //remove access filter
            using (new Sitecore.SecurityModel.SecurityDisabler()) {
                using (new EditContext(currentItem.playlistItem, true, false)) {
                    //set form fields with current item data
                    currentItem.PlaylistName     = plPlaylist.PlaylistName;
                    currentItem.PlaylistType     = plPlaylist.PlaylistType;
                    currentItem.ShortDescription = plPlaylist.ShortDescription;
                    currentItem.FilterTags       = plPlaylist.FilterTags;
                    currentItem.ReferenceID      = plPlaylist.ReferenceID;
                }
            }

            BCPlaylist p = plPlaylist.GetBCPlaylist();

            p.id = currentItem.PlaylistID;
            RPCResponse <BCPlaylist> rpcr = bc.UpdatePlaylist(p);

            pnlSaveMessage.Visible = true;

            if (rpcr.error.message != null)
            {
                ltlSaveMessage.Text = rpcr.error.code + ": " + rpcr.error.message;
            }
            else
            {
                ltlSaveMessage.Text = "The playlist settings have been saved to Brightcove Successfully with name: " + rpcr.result.name;
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //build bcvideo
            BCPlaylist plist = plPlaylist.GetBCPlaylist();

            //upload the video
            RPCResponse <long> rpcr = bc.CreatePlaylist(plist);

            if (rpcr.error.message != null)
            {
                ltlMessage.Text = rpcr.error.code + ": " + rpcr.error.message;
            }
            else
            {
                ltlMessage.Text = "Playlist Created Successfully with ID: " + rpcr.result.ToString();

                plist.id = rpcr.result;
                UpdateInsertPair <PlaylistItem> a = accountItem.ImportToSitecore(plist, UpdateType.NEW);
            }

            //blank out the other fields after upload
            plPlaylist.ClearForm();

            //display the current video and playlist count
            ltlTotalPlaylists.Text = accountItem.PlaylistLib.Playlists.Count.ToString();
        }
Exemple #4
0
        public string GetVideosInPlaylist(string playlistId)
        {
            string     result   = string.Empty;
            BCPlaylist playlist = null;

            string[] selectedVideoList = null;

            try
            {
                if (string.IsNullOrEmpty(playlistId) || (this._playlistId <= 0))
                {
                    selectedVideoList = new string[] { string.Empty };
                }
                else
                {
                    playlist           = this.bcApi.FindPlaylistById(long.Parse(playlistId));
                    this._playlistName = playlist.name;
                    this._playlistType = playlist.playlistType.ToString();
                    this._playlistTags = playlist.filterTags.ToDelimitedString(",");
                    selectedVideoList  = new string[playlist.videos.Count];

                    for (int i = 0; i < playlist.videoIds.Count; i++)
                    {
                        long    video     = playlist.videoIds[i];
                        BCVideo videoData = playlist.videos[i];

                        if (!result.Equals(string.Empty))
                        {
                            result += ",";
                        }

                        result += video.ToString();
                        selectedVideoList[i] = string.Format(@"{{ ""id"":{0}, ""name"":'{1}', ""thumbnailURL"":'{2}' }}",
                                                             videoData.id, videoData.name, videoData.thumbnailURL);
                    }
                }

                this._videoIdList = result;

                string output = string.Format(
                    @"<script language=""javascript"" type=""text/javascript"" charset=""utf-8"">/*<![CDATA[*/
                        var vcPlaylistVideos = [{0}];
                    /*]]>*/</script>", string.Join(",", selectedVideoList));

                message.InnerHtml += output;
            }
            catch
            {
                // Do nothing
            }

            return(result);
        }
        public BCPlaylist GetBCPlaylist()
        {
            BCPlaylist plist = new BCPlaylist();

            plist.name             = this.PlaylistName;
            plist.playlistType     = this.PlaylistType;
            plist.referenceId      = this.ReferenceID;
            plist.shortDescription = this.ShortDescription;
            //plist.videoIds = this.VideoIDs;
            plist.filterTags = this.FilterTags;

            return(plist);
        }
		/// <summary>
		/// Updates a playlist, specified by playlist id. This method must be called 
		/// using an HTTP POST request and JSON parameters.
		/// </summary>
		/// <param name="playlist">
		/// The metadata for the playlist you'd like to create. This takes the form of a 
		/// JSON object of name/value pairs, each of which corresponds to a settable 
		/// property of the Playlist object. Populate the videoIds property of the 
		/// playlist, not the videos property. 
		/// </param>
		/// <returns></returns>
		public RPCResponse<BCPlaylist> UpdatePlaylist(BCPlaylist playlist) {

			// Generate post objects
			Dictionary<string, object> postParams = new Dictionary<string, object>();

			//add video to the post params
			RPCRequest rpc = new RPCRequest();
			rpc.method = "update_playlist";
			rpc.parameters = "\"playlist\": " + playlist.ToUpdateJSON() + " ,\"token\": \"" + Account.WriteToken.Value + "\"";
			postParams.Add("json", rpc.ToJSON());

			//Get the JSon reader returned from the APIRequest
			RPCResponse<BCPlaylist> rpcr = BCAPIRequest.ExecuteWrite<BCPlaylist>(postParams, Account);

			return rpcr;
		}
Exemple #7
0
        public static string[] GetAllPlaylists(BCAPI api, int pageNumber, string query)
        {
            string[] result = null;

            if (api != null)
            {
                int           itemsPerPage = 50;
                int           itemCount    = 0;
                BCQueryResult playlists    = null;

                // Cannot search playlists yet, but in the future use "query" -ACA 9/12/2011
                if (!string.IsNullOrEmpty(query))
                {
                    query = query.Trim().ToLower();
                }
                else
                {
                    query = string.Empty;
                }

                playlists = api.FindAllPlaylists(itemsPerPage, BCSortByType.MODIFIED_DATE, BCSortOrderType.DESC, null, null, Util.PlaylistBrowseFields, MediaDeliveryTypeEnum.DEFAULT, pageNumber, true);

                if (playlists != null)
                {
                    itemCount = playlists.TotalCount;
                }

                result = new string[playlists.TotalCount];

                for (int i = 0; i < playlists.Playlists.Count; i++)
                {
                    if (i < itemsPerPage)
                    {
                        BCPlaylist playlist = playlists.Playlists[i];

                        result[i] = string.Format(@"{{ ""id"":{0}, ""name"":'{1}', ""thumbnailURL"":'{2}' }}",
                                                  playlist.id, Util.FixParam(playlist.name), Util.FixParam(playlist.thumbnailURL));
                    }
                    else
                    {
                        result[i] = "null";
                    }
                }
            }

            return(result.ToArray());
        }
Exemple #8
0
        public void SetTags(BCPlaylist playlist)
        {
            if (playlist.playlistType != PlaylistTypeEnum.EXPLICIT)
            {
                string tags = Request.Form["tags"];

                if (!string.IsNullOrEmpty(tags))
                {
                    string[] list = tags.Split(",".ToCharArray());

                    foreach (string item in list)
                    {
                        playlist.filterTags.Add(item.Trim());
                    }
                }
            }
        }
        /// <summary>
        /// Updates a playlist, specified by playlist id. This method must be called
        /// using an HTTP POST request and JSON parameters.
        /// </summary>
        /// <param name="playlist">
        /// The metadata for the playlist you'd like to create. This takes the form of a
        /// JSON object of name/value pairs, each of which corresponds to a settable
        /// property of the Playlist object. Populate the videoIds property of the
        /// playlist, not the videos property.
        /// </param>
        /// <returns></returns>
        public RPCResponse <BCPlaylist> UpdatePlaylist(BCPlaylist playlist)
        {
            // Generate post objects
            Dictionary <string, object> postParams = new Dictionary <string, object>();

            //add video to the post params
            RPCRequest rpc = new RPCRequest();

            rpc.method     = "update_playlist";
            rpc.parameters = "\"playlist\": " + playlist.ToUpdateJSON() + " ,\"token\": \"" + Account.WriteToken.Value + "\"";
            postParams.Add("json", rpc.ToJSON());

            //Get the JSon reader returned from the APIRequest
            RPCResponse <BCPlaylist> rpcr = BCAPIRequest.ExecuteWrite <BCPlaylist>(postParams, Account);

            return(rpcr);
        }
Exemple #10
0
        /// <summary>
        /// This handles syncing the local info with brightcove
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            pnlUpdateMessage.Visible = true;

            //import/update the playlists

            BCPlaylist b = bc.FindPlaylistById(currentItem.PlaylistID);
            UpdateInsertPair <PlaylistItem> playUIP = accountItem.ImportToSitecore(b, UpdateType.UPDATE);

            //show message over how many things changed
            if (playUIP.UpdatedItems.Count > 0)
            {
                loadFormWithCurrentValues();
                ltlUpdateMessage.Text = "The settings have been updated from Brightcove.";
            }
            else
            {
                ltlUpdateMessage.Text = "There was a problem updating this playlist.";
            }
        }
Exemple #11
0
        public BCPlaylist AddPlaylist()
        {
            BCPlaylist         playlist = null;
            RPCResponse <long> response = null;

            playlist              = new BCPlaylist();
            playlist.name         = Request.Form["playlistName"];
            playlist.playlistType = (PlaylistTypeEnum)Enum.Parse(typeof(PlaylistTypeEnum), Request.Form["playlistType"], true);
            SetTags(playlist);

            for (int i = 0; (i < this.writeTokenList.Length) && (i < 5); i++)
            {
                response = this.bcApi.CreatePlaylist(playlist);

                // Detect error: 213, ConcurrentWritesExceededError
                if (response.error.code == "213")
                {
                    this.accountConfig.WriteToken.Value = writeTokenList[i];
                    this.ResetApiConnection();
                }
                else
                {
                    break;
                }
            }

            if (response.error.message != null)
            {
                message.InnerHtml = "<p class=\"error\">ERROR: " + response.error.message + "</p>";
            }
            else
            {
                PlaylistId        = response.result.ToString();
                message.InnerHtml = "SUCCESS - " + PlaylistId;
            }

            return(playlist);
        }
Exemple #12
0
        private static void SetPlaylistFields(ref Item currentItem, BCPlaylist play)
        {
            //Set the appropriate field values for the new item
            currentItem.Fields["Name"].Value              = play.name;
            currentItem.Fields["Reference Id"].Value      = play.referenceId;
            currentItem.Fields["Short Description"].Value = play.shortDescription;
            string vidIdList = "";

            foreach (long vidId in play.videoIds)
            {
                if (vidIdList.Length > 0)
                {
                    vidIdList += ",";
                }
                vidIdList += vidId.ToString();
            }
            currentItem.Fields["Video Ids"].Value     = vidIdList;
            currentItem.Fields["ID"].Value            = play.id.ToString();
            currentItem.Fields["Thumbnail URL"].Value = play.thumbnailURL;
            string filterTags = "";

            if (play.filterTags != null)
            {
                foreach (string tag in play.filterTags)
                {
                    if (filterTags.Length > 0)
                    {
                        filterTags += ",";
                    }
                    filterTags += tag;
                }
            }
            currentItem.Fields["Filter Tags"].Value   = filterTags;
            currentItem.Fields["Playlist Type"].Value = play.playlistType.ToString();
            currentItem.Fields["Account Id"].Value    = play.accountId.ToString();
        }
        public bool UpdatePlaylist(bool isNewPlaylist, BCPlaylist playlist)
        {
            string[] videos = Request.Form["videos"].Split(",".ToCharArray());
            RPCResponse<BCPlaylist> response = null;

            if (playlist == null)
            {
                playlist = new BCPlaylist();
            }

            playlist.id = this._playlistId;

            if (!isNewPlaylist)
            {
                if (!string.IsNullOrEmpty(Request.Form["playlistName"]))
                {
                    playlist.name = Request.Form["playlistName"];
                }

                playlist.playlistType = (PlaylistTypeEnum)Enum.Parse(typeof(PlaylistTypeEnum), Request.Form["playlistType"], true);
                SetTags(playlist);
            }

            // Remove all the videos, then add the ones that are specified
            playlist.videoIds.RemoveRange(0, playlist.videoIds.Count);

            if (playlist.playlistType.Equals(PlaylistTypeEnum.EXPLICIT))
            {
                foreach (string v in videos)
                {
                    if (!string.IsNullOrEmpty(v))
                    {
                        playlist.videoIds.Add(long.Parse(v));
                    }
                }
            }

            for (int i = 0; (i < this.writeTokenList.Length) && (i < 5); i++)
            {
                try
                {
                    response = this.bcApi.UpdatePlaylist(playlist);

                    // Detect error: 213, ConcurrentWritesExceededError
                    if (response.error.code == "213")
                    {
                        this.accountConfig.WriteToken.Value = writeTokenList[i];
                        this.ResetApiConnection();
                    }
                    else
                    {
                        break;
                    }
                }
                catch { }
            }

            if (response == null) 
            {
                message.InnerHtml = "<p class=\"error\">ERROR: Unknown</p>";

                return false;
            }
            else if (response.error.message != null)
            {
                message.InnerHtml = "<p class=\"error\">ERROR: " + response.error.message + "</p>";

                return false;
            }
            else
            {
                message.InnerHtml = "SUCCESS - " + playlist.id.ToString();

                return true;
            }
        }
Exemple #14
0
        public bool UpdatePlaylist(bool isNewPlaylist, BCPlaylist playlist)
        {
            string[] videos = Request.Form["videos"].Split(",".ToCharArray());
            RPCResponse <BCPlaylist> response = null;

            if (playlist == null)
            {
                playlist = new BCPlaylist();
            }

            playlist.id = this._playlistId;

            if (!isNewPlaylist)
            {
                if (!string.IsNullOrEmpty(Request.Form["playlistName"]))
                {
                    playlist.name = Request.Form["playlistName"];
                }

                playlist.playlistType = (PlaylistTypeEnum)Enum.Parse(typeof(PlaylistTypeEnum), Request.Form["playlistType"], true);
                SetTags(playlist);
            }

            // Remove all the videos, then add the ones that are specified
            playlist.videoIds.RemoveRange(0, playlist.videoIds.Count);

            if (playlist.playlistType.Equals(PlaylistTypeEnum.EXPLICIT))
            {
                foreach (string v in videos)
                {
                    if (!string.IsNullOrEmpty(v))
                    {
                        playlist.videoIds.Add(long.Parse(v));
                    }
                }
            }

            for (int i = 0; (i < this.writeTokenList.Length) && (i < 5); i++)
            {
                try
                {
                    response = this.bcApi.UpdatePlaylist(playlist);

                    // Detect error: 213, ConcurrentWritesExceededError
                    if (response.error.code == "213")
                    {
                        this.accountConfig.WriteToken.Value = writeTokenList[i];
                        this.ResetApiConnection();
                    }
                    else
                    {
                        break;
                    }
                }
                catch { }
            }

            if (response == null)
            {
                message.InnerHtml = "<p class=\"error\">ERROR: Unknown</p>";

                return(false);
            }
            else if (response.error.message != null)
            {
                message.InnerHtml = "<p class=\"error\">ERROR: " + response.error.message + "</p>";

                return(false);
            }
            else
            {
                message.InnerHtml = "SUCCESS - " + playlist.id.ToString();

                return(true);
            }
        }
		public BCPlaylist GetBCPlaylist(){

			BCPlaylist plist = new BCPlaylist();
			plist.name = this.PlaylistName;
			plist.playlistType = this.PlaylistType;
			plist.referenceId = this.ReferenceID;
			plist.shortDescription = this.ShortDescription;
			//plist.videoIds = this.VideoIDs;
			plist.filterTags = this.FilterTags;

			return plist;
		}
Exemple #16
0
        public override void Deprecated_Page_Load()
        {
            if (this.bcApi == null)
            {
                return;
            }

            this._changedPlaylist = false;
            bool isNewPlaylist = false;

            if (!string.IsNullOrEmpty(Request.Form["playlistId"]))
            {
                PlaylistId = Request.Form["playlistId"];
            }
            else if (!string.IsNullOrEmpty(Request.QueryString["playlistid"]))
            {
                PlaylistId = Request.QueryString["playlistid"];
            }

            if (!string.IsNullOrEmpty(Request["cancel"]))
            {
                Response.Redirect(Request.FilePath);

                return;
            }

            if (this.IsPostBack)
            {
                BCPlaylist playlistObj = null;

                if (string.IsNullOrEmpty(PlaylistId) || (PlaylistId == "0"))
                {
                    if (!string.IsNullOrEmpty(Request.Form["playlistName"]))
                    {
                        playlistObj           = AddPlaylist();
                        this._changedPlaylist = true;
                        isNewPlaylist         = true;
                    }
                }

                if (!this.IsAdmin)
                {
                    message.InnerHtml = "<p class=\"error\">ERROR: user " + this.CurrentUser.LoginName + " is not an administrator</p>";
                }

                if (this.IsAdmin && (this._playlistId > 0))
                {
                    if (!string.IsNullOrEmpty(Request.Form["deletePlaylist"]))
                    {
                        RPCResponse response = this.bcApi.DeletePlaylist(this._playlistId);

                        if (response.error.message != null)
                        {
                            message.InnerHtml = "<p class=\"error\">ERROR: " + response.error.message + "</p>";
                            this._playlistId  = 0;
                        }
                        else
                        {
                            this._changedPlaylist = true;
                        }
                    }
                    else if (!string.IsNullOrEmpty(Request.Form["videos"]))
                    {
                        if (!UpdatePlaylist(isNewPlaylist, playlistObj))
                        {
                            this._playlistId = 0;
                        }

                        this._changedPlaylist = true;
                    }
                    else
                    {
                        this._changedPlaylist = true;
                    }
                }

                if (this._changedPlaylist)
                {
                    Response.Redirect(Request.FilePath + "?close=1");

                    return;
                }
                else
                {
                    this._videoIdList = GetVideosInPlaylist(PlaylistId);
                }
            }
            else
            {
                this._videoIdList = GetVideosInPlaylist(PlaylistId);

                if (this._playlistId > 0)
                {
                    return;
                }
            }

            int           pageNumber = Util.ParseInt(Request.QueryString[Util.PagingKey]);
            BCQueryResult result     = this.bcApi.FindAllPlaylists(this._itemsPerPage, BCSortByType.MODIFIED_DATE, BCSortOrderType.DESC, null, null, Util.PlaylistBrowseFields, MediaDeliveryTypeEnum.DEFAULT, pageNumber, true);

            if ((result != null) && (result.Playlists.Count > 0))
            {
                this._itemCount = result.TotalCount;

                foreach (BCPlaylist item in result.Playlists)
                {
                    message.InnerHtml += string.Format(
                        @"<div class=""playlistRow"" playlistId=""{0}"">
                            <input type=""checkbox"" value=""{0}"" style=""display:none;"" />
                            <div class=""thumbnail""><a href=""{8}""><img src=""{7}"" border=""0""/></a></div>
                            <div class=""playlist"">
                                <a href=""{8}"">{1}</a><br />
                                <span class=""playlistVideoCount"" val=""{3}"">{3}</span>
                                <span class=""playlistType"" val=""{2}"">{6}</span>
                                <span class=""playlistTags"" val=""{4}"">{4}</span>
                            </div><a class=""playlistEdit"" href=""{5}"">Edit</a>
                        </div>",
                        item.id, item.name, item.playlistType.ToString(), item.videos.Count.ToString(),
                        item.filterTags.ToDelimitedString(","), string.Format(this.EditPlaylistLink, item.id),
                        GetPlaylistTypeDisplay(item.playlistType.ToString()), item.thumbnailURL, string.Format(this.PlayVideoLink, item.id));
                }

                message.InnerHtml += Util.GetPaging(pageNumber, this._itemsPerPage, this._itemCount, Request.FilePath);
            }
            else
            {
                message.InnerHtml += "No playlists";
            }
        }
        public void SetTags(BCPlaylist playlist)
        {
            if (playlist.playlistType != PlaylistTypeEnum.EXPLICIT)
            {
                string tags = Request.Form["tags"];

                if (!string.IsNullOrEmpty(tags))
                {
                    string[] list = tags.Split(",".ToCharArray());

                    foreach (string item in list)
                    {
                        playlist.filterTags.Add(item.Trim());
                    }
                }
            }
        }
        public BCPlaylist AddPlaylist()
        {
            BCPlaylist playlist = null;
            RPCResponse<long> response = null;

            playlist = new BCPlaylist();
            playlist.name = Request.Form["playlistName"];
            playlist.playlistType = (PlaylistTypeEnum)Enum.Parse(typeof(PlaylistTypeEnum), Request.Form["playlistType"], true);
            SetTags(playlist);

            for (int i = 0; (i < this.writeTokenList.Length) && (i < 5); i++)
            {
                response = this.bcApi.CreatePlaylist(playlist);

                // Detect error: 213, ConcurrentWritesExceededError
                if (response.error.code == "213")
                {
                    this.accountConfig.WriteToken.Value = writeTokenList[i];
                    this.ResetApiConnection();
                }
                else
                {
                    break;
                }
            }

            if (response.error.message != null)
            {
                message.InnerHtml = "<p class=\"error\">ERROR: " + response.error.message + "</p>";
            }
            else
            {
                PlaylistId = response.result.ToString();
                message.InnerHtml = "SUCCESS - " + PlaylistId;
            }

            return playlist;
        }
		public static UpdateInsertPair<PlaylistItem> ImportToSitecore(this AccountItem account, BCPlaylist Playlist, UpdateType utype) {
			List<BCPlaylist> Playlists = new List<BCPlaylist>();
			Playlists.Add(Playlist);
			return ImportToSitecore(account, Playlists, utype);
		}
Exemple #20
0
        public static UpdateInsertPair <PlaylistItem> ImportToSitecore(this AccountItem account, BCPlaylist Playlist, UpdateType utype)
        {
            List <BCPlaylist> Playlists = new List <BCPlaylist>();

            Playlists.Add(Playlist);
            return(ImportToSitecore(account, Playlists, utype));
        }
Exemple #21
0
        public static string[] GetAllPlaylists(BCAPI api, int pageNumber, string query, string order, string sort)
        {
            string[] result = null;

            if (api != null)
            {
                int               itemsPerPage    = 50;
                int               itemCount       = 0;
                BCQueryResult     playlists       = null;
                List <BCPlaylist> playListsSorted = new List <BCPlaylist>();
                // Cannot search playlists yet, but in the future use "query" -ACA 9/12/2011
                if (!string.IsNullOrEmpty(query))
                {
                    query = query.Trim().ToLower();
                }
                else
                {
                    query = string.Empty;
                }

                playlists = api.FindAllPlaylists(itemsPerPage, getSort(sort), getOrder(order), null, null, Util.PlaylistBrowseFields, MediaDeliveryTypeEnum.DEFAULT, pageNumber, true);
                if (sort != null)
                {
                    if (sort.Equals("display name"))
                    {
                        if (order.Equals("ascending"))
                        {
                            playListsSorted = playlists.Playlists.OrderBy(i => i.name).ToList();
                        }
                        else
                        {
                            playListsSorted = playlists.Playlists.OrderByDescending(i => i.name).ToList();
                        }
                    }
                }

                if (playListsSorted != null)
                {
                    if (playListsSorted.Count == 0)
                    {
                        playListsSorted = playlists.Playlists;
                    }
                }

                if (playlists != null)
                {
                    itemCount = playListsSorted.Count;
                }

                result = new string[playListsSorted.Count];

                for (int i = 0; i < playListsSorted.Count; i++)
                {
                    if (i < itemsPerPage)
                    {
                        BCPlaylist playlist = playListsSorted[i];

                        result[i] = string.Format(@"{{ ""id"":{0}, ""name"":'{1}', ""thumbnailURL"":'{2}' }}",
                                                  playlist.id, Util.FixParam(playlist.name), Util.FixParam(playlist.thumbnailURL));
                    }
                    else
                    {
                        result[i] = "null";
                    }
                }
            }

            return(result.ToArray());
        }