public static SerializableYoutubeVideo Create(IYoutubeVideo video)
        {
            var svideo = new SerializableYoutubeVideo();

            svideo.id = video.Id;

            svideo.snippet = new YoutubeSnippet()
            {
                categoryId      = video.Category?.Id ?? 20,
                title           = video.Title,
                defaultLanguage = video.DefaultLanguage?.Hl ?? "de-de",
                description     = video.Description,
                tags            = video.Tags.ToArray()
            };

            svideo.status = new YoutubeStatus()
            {
                IsEmbeddable        = video.IsEmbeddable,
                Privacy             = video.Privacy,
                License             = video.License,
                PublishAt           = (video.PublishAt ?? default(DateTime)).ToString("yyyy-MM-ddTHH:mm:ss.ffffzzz"),
                ShouldPublishAt     = video.PublishAt != null,
                PublicStatsViewable = video.PublicStatsViewable
            };

            return(svideo);
        }
Beispiel #2
0
        public EditVideoForm(IYoutubeVideo video, INotificationSettings notificationSettings, bool hasMailPrivilegue, IYoutubeCategoryContainer catContainer, IYoutubeLanguageContainer langContainer, IYoutubePlaylistContainer plContainer, IPlaylistServiceConnectionContainer pscContainer)
            : this()
        {
            Video = video;
            NotificationSettings = notificationSettings;

            uploadGrid.IsNewUpload = false;
            uploadGrid.Fill(video, notificationSettings, hasMailPrivilegue, catContainer, langContainer, plContainer, pscContainer);
        }
Beispiel #3
0
        public YoutubeJob(IYoutubeVideo video, IYoutubeAccount account, UploadStatus uploadStatus)
        {
            LOGGER.Info($"Creating new job for video '{video?.Title ?? "null"}' and account '{account?.Title ?? "null"}'");

            Video        = video;
            Account      = account;
            UploadStatus = uploadStatus;

            JobUploader = new JobUploader(this);
            JobUploader.StateChanged += JobUploaderStateChanged;
        }
Beispiel #4
0
        public static HttpWebRequest CreateForNewUpload(Uri uri, IYoutubeVideo video, IYoutubeAccount account)
        {
            LOGGER.Info($"Creating web request for video: '{video.Path}' and account with id: {account.Id} and title: '{account.Title}'");

            var request = CreateWithAuthHeader(uri.AbsoluteUri, "PUT", account.GetActiveToken());

            request.ContentLength = video.File.Length;
            request.ContentType   = MimeMapping.GetMimeMapping(video.File.Name);

            // Am Leben halten (wichtig bei großen Dateien)!
            request.ServicePoint.SetTcpKeepAlive(true, 10000, 1000);
            request.AllowWriteStreamBuffering = false;
            request.Timeout = int.MaxValue;

            return(request);
        }
Beispiel #5
0
        public void Fill(IYoutubeVideo video, INotificationSettings notificationSettings, bool hasMailPrivilegue, IYoutubeCategoryContainer catContainer,
                         IYoutubeLanguageContainer langContainer, IYoutubePlaylistContainer plContainer, IPlaylistServiceConnectionContainer pscContainer)
        {
            categoryContainer = catContainer;
            RefreshCategories();

            languageContainer = langContainer;
            RefreshLanguages();

            playlistContainer = plContainer;
            RefreshPlaylists();

            HasMailPrivilegue    = hasMailPrivilegue;
            Video                = video;
            NotificationSettings = notificationSettings;

            PscContainer = pscContainer;
        }
Beispiel #6
0
        public static HttpWebRequest CreateForResumeUpload(Uri uri, IYoutubeVideo video, IYoutubeAccount account, long lastbyte)
        {
            LOGGER.Info($"Creating web request for resumable upload of video: '{video.Path}' and account with id: {account.Id} and title: '{account.Title}' from last byte: {lastbyte}");

            var request = CreateWithAuthHeader(uri.AbsoluteUri, "PUT", account.GetActiveToken());

            request.Headers.Add($"Content-Range: bytes {lastbyte + 1}-{video.File.Length - 1}/{video.File.Length}");
            request.ContentLength = video.File.Length - (lastbyte + 1);

            LOGGER.Info($"Content-Range header: 'bytes {lastbyte + 1}-{video.File.Length - 1}/{video.File.Length}'");
            LOGGER.Info($"Content-Length header: {video.File.Length - (lastbyte + 1)}");

            // Am Leben halten (wichtig bei großen Dateien)!
            request.ServicePoint.SetTcpKeepAlive(true, 10000, 1000);
            request.AllowWriteStreamBuffering = false;
            request.Timeout = int.MaxValue;

            return(request);
        }
Beispiel #7
0
        public void FillFields(IYoutubeVideo video)
        {
            if (AutoLevels != video.AutoLevels)
            {
                IsDirty    = true;
                AutoLevels = video.AutoLevels;
            }

            if (Category != video.Category)
            {
                IsDirty  = true;
                Category = video.Category;
            }

            if (DefaultLanguage != video.DefaultLanguage)
            {
                IsDirty         = true;
                DefaultLanguage = video.DefaultLanguage;
            }

            if (Description != video.Description)
            {
                IsDirty     = true;
                Description = video.Description;
            }

            if (IsEmbeddable != video.IsEmbeddable)
            {
                IsDirty      = true;
                IsEmbeddable = video.IsEmbeddable;
            }

            if (License != video.License)
            {
                IsDirty = true;
                License = video.License;
            }

            if (NotifySubscribers != video.NotifySubscribers)
            {
                IsDirty           = true;
                NotifySubscribers = video.NotifySubscribers;
            }

            if (Privacy != video.Privacy)
            {
                IsDirty = true;
                Privacy = video.Privacy;
            }

            if (PublicStatsViewable != video.PublicStatsViewable)
            {
                IsDirty             = true;
                PublicStatsViewable = video.PublicStatsViewable;
            }

            if (PublishAt != video.PublishAt)
            {
                IsDirty   = true;
                PublishAt = video.PublishAt;
            }

            if (Stabilize != video.Stabilize)
            {
                IsDirty   = true;
                Stabilize = video.Stabilize;
            }

            if (!TagsEqual(video.Tags))
            {
                IsDirty = true;

                Tags.Clear();
                foreach (var tag in video.Tags)
                {
                    Tags.Add(tag);
                }
            }

            if (Title != video.Title)
            {
                IsDirty = true;
                Title   = video.Title;
            }

            if (ThumbnailPath != video.ThumbnailPath)
            {
                IsDirty          = true;
                IsThumbnailDirty = true;
                ThumbnailPath    = video.ThumbnailPath;
            }

            if (AddToPlaylist != video.AddToPlaylist)
            {
                IsDirty       = true;
                AddToPlaylist = video.AddToPlaylist;
            }

            if (PlaylistId != video.PlaylistId)
            {
                IsDirty    = true;
                PlaylistId = video.PlaylistId;
            }

            if (PlaylistServiceSettings.ShouldSend != video.PlaylistServiceSettings.ShouldSend ||
                PlaylistServiceSettings.Host != video.PlaylistServiceSettings.Host ||
                PlaylistServiceSettings.Port != video.PlaylistServiceSettings.Port ||
                PlaylistServiceSettings.Username != video.PlaylistServiceSettings.Username ||
                PlaylistServiceSettings.Password != video.PlaylistServiceSettings.Password ||
                PlaylistServiceSettings.PlaylistId != video.PlaylistServiceSettings.PlaylistId ||
                PlaylistServiceSettings.PlaylistTitle != video.PlaylistServiceSettings.PlaylistTitle)
            {
                IsDirty = true;
                PlaylistServiceSettings.ShouldSend    = video.PlaylistServiceSettings.ShouldSend;
                PlaylistServiceSettings.Host          = video.PlaylistServiceSettings.Host;
                PlaylistServiceSettings.Port          = video.PlaylistServiceSettings.Port;
                PlaylistServiceSettings.Username      = video.PlaylistServiceSettings.Username;
                PlaylistServiceSettings.Password      = video.PlaylistServiceSettings.Password;
                PlaylistServiceSettings.PlaylistId    = video.PlaylistServiceSettings.PlaylistId;
                PlaylistServiceSettings.PlaylistTitle = video.PlaylistServiceSettings.PlaylistTitle;
            }
        }
Beispiel #8
0
 public VideoInformation(IYoutubeVideo video, ExpressionEvaluator evaluator, INotificationSettings notificationSettings)
 {
     Video                = video;
     Evaluator            = evaluator;
     NotificationSettings = notificationSettings;
 }