public void SetMetadata(string videoUri, VimeoHook vc) { Action <string> SetStatus = (o) => { if (VimeoHook.VerboseCallback != null) { VimeoHook.VerboseCallback(o); } }; try { SetStatus("Applying Metadata for " + Title); var parameters = new Dictionary <string, string> { { "name", Title }, { "description", Description.Replace("\\n", "\n") }, { "privacy.view", PrivacyView }, { "privacy.embed", PrivacyEmbed }, { "review_link", ReviewLink } }; if (License == "-") { License = ""; } parameters.Add("license", License.Trim()); if (PrivacyView == "password") { parameters.Add("password", Password); } vc.Request(videoUri, parameters, "PATCH", false); SetStatus("Adding Tags for " + Title); foreach (string tag in Tags.Split(',')) { vc.Request(String.Format("{0}/tags/{1}", videoUri, tag), "PUT", false, ""); } if (!Core.IsNullOrWhiteSpace(Album)) { SetStatus("Adding video to album " + Album); string videoRelUri = videoUri.Contains("/video") ? videoUri : "/videos/" + videoUri; vc.Request( string.Format("/me/albums/{0}{1}", Album, videoRelUri), null, "PUT"); } SetStatus("Metadata assignment completed for " + Title); } catch (Exception e) { SetStatus(string.Format("Error applying metadata for {0}: {1}", Title, e.Message)); } }
public void SetMetadata(string videoUri, VimeoHook vc) { Action<string> SetStatus = (o) => { if (VimeoHook.VerboseCallback != null) VimeoHook.VerboseCallback(o); }; try { SetStatus("Applying Metadata for " + Title); var parameters = new Dictionary<string, string>{ {"name",Title}, {"description",Description.Replace("\\n","\n")}, {"privacy.view",PrivacyView}, {"privacy.embed",PrivacyEmbed}, {"review_link",ReviewLink} }; if (License == "-") License = ""; parameters.Add("license", License.Trim()); if (PrivacyView == "password") parameters.Add("password", Password); vc.Request(videoUri, parameters, "PATCH", false); SetStatus("Adding Tags for " + Title); foreach (string tag in Tags.Split(',')) vc.Request(String.Format("{0}/tags/{1}", videoUri, tag), "PUT", false, ""); if (!Core.IsNullOrWhiteSpace(Album)) { SetStatus("Adding video to album " + Album); string videoRelUri = videoUri.Contains("/video") ? videoUri : "/videos/" + videoUri; vc.Request( string.Format("/me/albums/{0}{1}", Album, videoRelUri), null, "PUT"); } SetStatus("Metadata assignment completed for " + Title); } catch (Exception e) { SetStatus(string.Format("Error applying metadata for {0}: {1}", Title, e.Message)); } }
public static VimeoHook ReAuthorize( string accessToken, string clientId, string redirect = "", string apiRoot = "https://api.vimeo.com") { VimeoHook vc = new VimeoHook(); vc.clientId = clientId; vc.redirect = redirect; vc.AccessToken = accessToken; vc.apiRoot = apiRoot; vc.User = vc.Request("/me", null, "GET"); if (vc.User["error"].Value.Length > 0) { throw new Exception(vc.User["error"]); } return(vc); }
public static VimeoHook ReAuthorize( string accessToken, string clientId, string redirect="", string apiRoot = "https://api.vimeo.com") { VimeoHook vc = new VimeoHook(); vc.clientId = clientId; vc.redirect = redirect; vc.AccessToken = accessToken; vc.apiRoot = apiRoot; vc.User = vc.Request("/me", null, "GET"); if (vc.User["error"].Value.Length > 0) throw new Exception(vc.User["error"]); return vc; }