Torna al Thread

[CODE] public static bool salvaVideo(tipoYouTubeVideo video, out List<string> msg_error) { msg_error = new List<string>(); try { bool errore = false; string filename = video.Upload.FileName; string FileType = video.Upload.ContentType; string videoname = Utility.PERCORSO_FISICO(VIDEO_TEMP_FOLDER + video.Codice + "_" + Formattazione.EliminaCaratteriSpeciali(filename, "_")); if (!errore) { video.Upload.SaveAs(videoname); //Autenticazione YouTubeRequest request = new YouTubeRequest(settings); ((GDataRequestFactory)request.Service.RequestFactory).Timeout = 9999999; Video newVideo = new Video(); newVideo.Title = Formattazione.SottoStringa(Formattazione.FormatString(System.Web.HttpUtility.HtmlDecode(video.Title)), TITLE_MAX_CHARACTER, false); newVideo.Tags.Add(new MediaCategory(video.Category, YouTubeNameTable.CategorySchema)); newVideo.Keywords = System.Web.HttpUtility.HtmlDecode(video.Keywords); newVideo.Description = Formattazione.SottoStringa(Formattazione.FormatString(System.Web.HttpUtility.HtmlDecode(video.Description)), DESCRIPTION_MAX_CHARACTER, false); newVideo.YouTubeEntry.Private = true; newVideo.Tags.Add(new MediaCategory(video.DeveloperTag, YouTubeNameTable.DeveloperTagSchema)); newVideo.YouTubeEntry.setYouTubeExtension("location", "Andria, BT"); newVideo.YouTubeEntry.MediaSource = new MediaFileSource(videoname, FileType); Video createdVideo = request.Upload(newVideo); if (createdVideo != null) { video.VideoId = createdVideo.VideoId; video.Image = createdVideo.Thumbnails[0].Url; } //Elimino il video il locale IO.DeleteFile(videoname); return true; } else { return false; } } catch (Exception ex) { msg_error.Add(Messaggi.ERR_UPLOAD_VIDEO); if (!string.IsNullOrEmpty(video.VideoId)) YouTube.Elimina(video.VideoId); return false; } } [/CODE]
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5