private MediaItem UploadMediaItemToAlbum(MediaItem mediaItem, string albumPath)
        {
            string relativeUploadUrl = GenerateRelativeUploadUrl(albumPath);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));
            paramaters.Add(new QueryParameter(_type, mediaItem.Type));
            if (string.IsNullOrEmpty(mediaItem.Description) == false)
            {
                paramaters.Add(new QueryParameter(_description, OAuth.UrlEncode(mediaItem.Description)));
            }
            if (string.IsNullOrEmpty(mediaItem.Title) == false)
            {
                paramaters.Add(new QueryParameter(_title, OAuth.UrlEncode(mediaItem.Title)));
            }

            QueryParameterList mediaParamaters = OAuth.GenerateOAuthParamaters(relativeUploadUrl, _uploadMediaMethod, Token, paramaters);

            string uploadMediaItemUrl = ApiUrl + relativeUploadUrl + "?format=xml";

            XmlResponseMessage uploadMediaItemResponse = GetResponseForUploadMediaItem(uploadMediaItemUrl, mediaItem, mediaParamaters);

            MediaItem newMediaItem = new MediaItem(uploadMediaItemResponse.ResponseXml);

            _currentUser.MediaList.Add(newMediaItem);
            return(newMediaItem);
        }
Beispiel #2
0
 private string GenerateRelativeMediaUrl(string url)
 {
     return(_media + "/" + OAuth.UrlEncode(OAuth.UrlEncode(url)));
 }
Beispiel #3
0
 private string GenerateAlbumIdentifier(string albumName)
 {
     return(_albumUrl + "/" + OAuth.UrlEncode(OAuth.UrlEncode(albumName)));
 }
Beispiel #4
0
 private string GenerateRelativeSearchUrl(string query)
 {
     return(_searchUrl + "/" + OAuth.UrlEncode(query));
 }