public void InsertOrUpdateVideo(Video video)
 {
     _context.Entry(video).State = video.VideoID == 0 ? EntityState.Added : EntityState.Modified;
     foreach (var videoAsset in video.Assets)
         _context.Entry(videoAsset).State = videoAsset.VideoAssetID == 0 ? EntityState.Added : EntityState.Modified;
     _context.SaveChanges();
 }
        public bool AddToMyFavorites(Video i_Video)
        {
            bool exsit = false;

            if (i_Video != null)
            {
                if (MyFavoritesVideos.Count > 0)
                {
                    foreach (Video currentVideo in MyFavoritesVideos)
                    {
                        if (currentVideo.VideoId == i_Video.VideoId)
                        {
                            exsit = true;
                            break;
                        }
                    }
                }
            }
            else
            {
                throw new ArgumentNullException("You must choose video!");
            }

            if (!exsit)
            {
                MyFavoritesVideos.Add(i_Video);
            }

            return exsit;
        }
        public async Task<ActionResult> upload()
        {
            var youtubeService = await GetYouTubeService();

            var channels = youtubeService.Channels.List("");
            var video = new Video();
            // video.Snippet.
            video.Snippet = new VideoSnippet();
            video.Snippet.ChannelId = channels.Id;
            video.Snippet.Title = "Monica Video";
            video.Snippet.Description = "Monica Video Description";
            video.Snippet.Tags = new string[] { "monica", "vidzapper", "The Assetry" };
            video.Snippet.CategoryId = "22"; // See https://developers.google.com/youtube/v3/docs/videoCategories/list
            video.Status = new VideoStatus();
            video.Status.PrivacyStatus = "unlisted"; // or "private" or "public"
            var filePath = Server.MapPath("~/App_Data/monica.mp4");// @"REPLACE_ME.mp4"; // Replace with path to actual movie file.

            using (var fileStream = new FileStream(filePath, FileMode.Open))
            {
                var videosInsertRequest = youtubeService.Videos.Insert(video, "snippet,status", fileStream, "video/*");
                videosInsertRequest.ProgressChanged += videosInsertRequest_ProgressChanged;
                videosInsertRequest.ResponseReceived += videosInsertRequest_ResponseReceived;

                var tmp = await videosInsertRequest.UploadAsync();
                Console.Write(tmp.BytesSent);
            }

            return View();
        }
        public async Task Run(Stream fileStream)
        {
            string CLIENT_ID = "xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com";  // Replace with your client id
            string CLIENT_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxx";  // Replace with your secret

            var youtubeService = AuthenticateOauth(CLIENT_ID, CLIENT_SECRET, "SingleUser");

            var video = new Video();
            video.Snippet = new VideoSnippet();
            video.Snippet.Title = "Default Video Title " + new Guid();
            video.Snippet.Description = "Default Video Description";
            video.Snippet.Tags = new string[] { "tag1", "tag2" };
            video.Snippet.CategoryId = "22";
            video.Status = new VideoStatus();
            video.Status.PrivacyStatus = "unlisted"; // or "private" or "public"

            const int KB = 0x400;
            var minimumChunkSize = 50 * KB;

            using (fileStream)
            {
                var videosInsertRequest = youtubeService.Videos.Insert(video, "snippet,status", fileStream, "video/*");
                videosInsertRequest.ProgressChanged += videosInsertRequest_ProgressChanged;
                videosInsertRequest.ResponseReceived += videosInsertRequest_ResponseReceived;
                videosInsertRequest.ChunkSize = minimumChunkSize * 8;

                await videosInsertRequest.UploadAsync();
            }
        }
Beispiel #5
0
        public void Encode(Video video)
        {
            // Video encoding logic

            foreach (var channel in _notificationChannels)
                channel.Send(new Message());
        }
        private async void BtPickVideoClick(object sender, RoutedEventArgs e)
        {
            App app = Application.Current as App;

            if (app == null)
                return;
            FileOpenPicker openPicker = new FileOpenPicker
            {
                ViewMode = PickerViewMode.Thumbnail,
                SuggestedStartLocation = PickerLocationId.VideosLibrary
            };
            openPicker.FileTypeFilter.Add(".avi");
            openPicker.FileTypeFilter.Add(".mp4");

            StorageFile file = await openPicker.PickSingleFileAsync();
            if (file != null)
            {
                var client = new VideosServiceClient(app.EsbUsername, app.EsbPassword, app.EsbAccessKey);
                Video video = new Video { Title = file.DisplayName, Tags = file.DisplayName, Synopse = file.DisplayName };
                this.tblock_PostVideoResult.Text = await client.CreateVideoAsync(file, video);
            }
            else
            {
                this.tblock_PostVideoResult.Text = "Error reading file";
            }

        }
        private void btn_upload_Click(object sender, RoutedEventArgs e)
        {
            btn_upload.IsEnabled = false;
            btn_upload.Content = "Uploading";
            btn_cancel.IsEnabled = true;

            uploadVideo = new Video();
            uploadVideo.Title = txt_title.Text.ToString();
            uploadVideo.Description = txt_description.Text.ToString();
            uploadVideo.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema));
            uploadVideo.Keywords = txt_keywords.Text.ToString();
            if (cb_privacy.SelectedIndex == 1)
            {
                uploadVideo.Private = true;
            }
            else
            {
                uploadVideo.Private = false;
            }
            uploadVideo.YouTubeEntry.MediaSource = new MediaFileSource(txt_video_path.Text.ToString(), getMimeType(txt_video_path.Text.ToString()));

            bw = new BackgroundWorker();
            bw.WorkerSupportsCancellation = true;
            bw.DoWork += new DoWorkEventHandler(bw_DoWork);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);

            if (bw.IsBusy != true)
            {
                bw.RunWorkerAsync();
            }
        }
        public async static void search(string query)
        {        
            using(WebClient c = new WebClient())
            {                               
                c.Headers.Add("Content-Type", "application/json");
                var requestUri = new Uri(string.Format("{0}/search?part=snippet&q={1}&maxResults=50&key={2}&type=video&videoCategoryId=10", API_ENDPOINT, query, API_KEY));
                var json = await c.DownloadStringTaskAsync(requestUri);
                var jsonObject = JsonConvert.DeserializeObject<YouTubeResponse>(json);

                videos.Clear();                       

                foreach(var videoResult in jsonObject.items)
                {
                    var video = new Video();

                    video.title = Encoding.ASCII.GetString(Encoding.ASCII.GetBytes(videoResult.snippet.title));
                    video.id = videoResult.id.videoId;
                    video.date = videoResult.snippet.publishedAt;

                    if (video.isValid())
                    {
                        videos.Add(video);
                    }
                }
            }
        }
        private void configSource_browseBtn_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.CheckFileExists = true;
            ofd.CheckPathExists = true;
            ofd.Multiselect = false;

            // TODO: Filter extensions to video exclusively

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                configSource_browsePath.Text = ofd.FileName;
                FileName = ofd.FileName;

                StartFrame = 0;

                vid = new Video(FileName); // TODO: What if exception here?
                EndFrame = vid.CountFrames() - 1;

                SetupTextboxValidation();

                configSource_startFrame.Value = 0;
                configSource_endFrame.Value = EndFrame;

                SetStartFramePreview((int)configSource_startFrame.Value);
                SetEndFramePreview((int)configSource_endFrame.Value);

                configSource_startFrame.Enabled = true;
                configSource_endFrame.Enabled = true;
            }
        }
Beispiel #10
0
 /// <summary>動画へアクセスするページを取得する</summary>
 /// <param name="Target">ターゲット動画</param>
 public VideoPage GetVideoPage(Video.VideoInfo Target)
 {
     if (Target.videoPage != null)
         return Target.videoPage;
     else
         return Target.videoPage = new VideoPage(Target, this, context);
 }
Beispiel #11
0
        public static FullVideo Create(Google.YouTube.Video ytVideo = null)
        {
            if (ytVideo == null) {
                throw new Exception("Invalid link");
            }
            CurtDevDataContext db = new CurtDevDataContext();
            Video new_video = new Video {
                embed_link = ytVideo.VideoId,
                title = ytVideo.Title,
                screenshot = (ytVideo.Thumbnails.Count > 0) ? ytVideo.Thumbnails[2].Url : "/Content/img/noimage.jpg",
                description = ytVideo.Description,
                watchpage = ytVideo.WatchPage.ToString(),
                youtubeID = ytVideo.VideoId,
                dateAdded = DateTime.Now,
                sort = (db.Videos.Count() == 0) ? 1 : db.Videos.OrderByDescending(x => x.sort).Select(x => x.sort).First() + 1
            };
            db.Videos.InsertOnSubmit(new_video);
            db.SubmitChanges();

            FullVideo fullvideo = new FullVideo {
                videoID = new_video.videoID,
                embed_link = new_video.embed_link,
                dateAdded = new_video.dateAdded,
                sort = new_video.sort,
                videoTitle = new_video.title,
                thumb = (ytVideo.Thumbnails.Count > 0) ? ytVideo.Thumbnails[0].Url : "/Content/img/noimage.jpg"
            };

            return fullvideo;
        }
        protected void Create_Click(object sender, EventArgs e)
        {
            var playlist = new Playlist()
            {
                Title = this.Server.HtmlEncode(this.TitleTextBox.Text),
                Description = this.Server.HtmlEncode(this.Description.Text),
                CreationDate = DateTime.UtcNow,
                CreatorId = this.User.Identity.GetUserId()
            };

            Video video = this.Videos.GetByUrl(this.Server.HtmlEncode(this.Url.Text));
            if (video == null)
            {
                video = new Video()
                {
                    Url = this.Server.HtmlEncode(this.Url.Text)
                };
            }

            Category category = this.Categories.All().Where(c => c.Name == this.CategorySelect.SelectedItem.Text).FirstOrDefault();

            playlist.Category = category;
            playlist.Videos.Add(video);

            this.Playlists.Create(playlist);
            this.Playlists.SaveChanges();
        }
 public void DeleteVideo(int videoID)
 {
     var video = new Video() { VideoID = videoID };
     _context.Videos.Attach(video);
     _context.Videos.Remove(video);
     _context.SaveChanges();
 }
Beispiel #14
0
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
			if(bPluginLoaded)
			{
				freeframe.deInstantiate(instanceID);
				freeframe.Dispose();
			}
			if(webcam != null)
			{
				webcam.Dispose();
				webcam = null;
			}
			if(video != null)
			{
				video.Dispose();
				video = null;
			}
		}
Beispiel #15
0
        private void Tutorial_Load(object sender, EventArgs e)
        {
            int height = pnlTV.Height;
            int width = pnlTV.Width;
            try
            {
                video = new Video(System.IO.Path.Combine(Application.StartupPath, "RaagaHacker.avi"), false);
                video.Owner = pnlTV;
                pnlTV.Width = width;
                pnlTV.Height = height;
                video.Play();
            }
            catch (Exception ex)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "Tutorial_Load: Uanble to play video ";
                frm.ErrorMessage = ex.Message;
                frm.StrackTrace = ex.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
            finally
            {

                if (video != null)
                {
                    video.Dispose();
                    video = null;
                }

            }
        }
        protected void BBuscador(String track)
        {
            string spotUrl = String.Format("http://ws.spotify.com/search/1/track?q={0}", track);
            WebClient spotService = new WebClient();
            spotService.Encoding = Encoding.UTF8;
            spotService.DownloadStringCompleted += new DownloadStringCompletedEventHandler(SpotService_DownloadTracksCompleted);
            spotService.DownloadStringAsync(new Uri(spotUrl));

            YouTubeRequest request = new YouTubeRequest(settings);
            YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri);
            query.OrderBy = "relevance";
            query.Query = track;
            query.SafeSearch = YouTubeQuery.SafeSearchValues.None;
            Feed<Video> videoFeed = request.Get<Video>(query);
            if (videoFeed.Entries.Count() > 0)
            {
                video1 = videoFeed.Entries.ElementAt(0);
                literal1.Text = String.Format(embed, video1.VideoId);
                if (videoFeed.Entries.Count() > 1)
                {
                    video1 = videoFeed.Entries.ElementAt(1);
                    literal1.Text += String.Format(embed, video1.VideoId);
                }
            }
        }
Beispiel #17
0
        private static async Task<Stream> ReadInfoAsync(Video video)
        {
            string path = string.Format("{0}/{1}", video.Browser.Destination, video.Name);
            var response = await video.Browser.Camera.PrepareCommand<CommandGoProVideoInfo>(video.Browser.Address.Port).Set(path).SendAsync(checkStatus:false);

            return response.GetResponseStream();
        }
Beispiel #18
0
 public cVideo(GameWindow gw)
 {
     vid = new Video(@"Resources/Video/helloworldintro.avi");
     vid.Owner = Form.FromHandle(gw.Handle);
     vid.Ending += new EventHandler(vid_Ending);
     playstate = true;
 }
Beispiel #19
0
 protected virtual void OnVideoEncoded(Video video)
 {
     if (VideoEncoded != null)
     {
         VideoEncoded(this, new VideoEventArgs() { Video = video });
     }
 }
Beispiel #20
0
        private static void WriteVideo(Video video)
        {
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine(video.Title);

            if (video.VideoType == VideoType.Episode)
            {
                Console.WriteLine("Show name: " + video.Show);
                Console.WriteLine("Season: " + video.SeasonNumber + ", Episode: " + video.EpisodeNumber);
            }
            else
                Console.WriteLine("Type: " + video.Type);

            Console.WriteLine("Playing on " + video.Player.Title);
            Console.WriteLine("Thumb: " + video.VideoImageSource);

            Console.WriteLine();
            Console.WriteLine("User:"******"User Thumb:" + video.UserThumb);
            Console.WriteLine();
            Console.WriteLine("External ids:");
            Console.WriteLine(video.ExternalIds);
            Console.WriteLine("Episode External ids:");
            Console.WriteLine(video.EpisodeExternalIds);
            Console.WriteLine(video.Player.State);

            Console.WriteLine();
            Console.WriteLine("Links:");
            Console.WriteLine(video.Uri);
            Console.WriteLine(video.SchemeUri);
            Console.WriteLine();
            Console.WriteLine("IMDB (episode): " + video.ImdbEpisodeUri);
            Console.WriteLine("IMDB: " + video.ImdbUri);
            Console.WriteLine("TMDb (episode): " + video.TmdbEpisodeUri);
            Console.WriteLine("TMDb: " + video.TmdbUri);
            Console.WriteLine("TVDB (episode): " + video.TvdbEpisodeUri);
            Console.WriteLine("TVDB: " + video.TvdbUri);

            Console.WriteLine();
            if (video.Player.State == PlayerState.Playing)
                Console.WriteLine("Position: " + video.Progress);

            Console.WriteLine();
            Console.WriteLine("Cast:");

            foreach (var role in video.Roles)
            {
                Console.WriteLine(role.RoleName + ": " + role.Tag);
                Console.WriteLine("   IMDB: " + role.ImdbUrl + " (" + role.ImdbSchemeUrl + ")");
                Console.WriteLine("   Image: " + role.Thumb);
            }

            //Console.WriteLine("Directors");
            //foreach (var director in video.Directors)
            //    Console.WriteLine(director.tag);

            Console.WriteLine();
        }
Beispiel #21
0
 public void printVideoEntry(Video video)
 {
     textBox6.Text = video.Description;
     if (video.Media != null && video.Media.Rating != null)
     {
         textBox6.Text = video.Description + "\r\n Restricted in: " + video.Media.Rating.Country.ToString();
     }
 }
Beispiel #22
0
        public void Encode(Video video)
        {
            Console.WriteLine("Encoding Video...");

            Thread.Sleep(3000);

            OnVideoEncoded(video);
        }
Beispiel #23
0
        public DXVideoWrapper(string filename)
        {
            _video = new Video(filename);

            this.filename = filename;

            width = _video.DefaultSize.Width;
            height = _video.DefaultSize.Height;
        }
Beispiel #24
0
        public ShaderResource(IVideo video, int location, int index, string name)
        {
            this.video = (Video)video;
            this.location = location;
            this.index = index;
            this.Name = name;

            Apply = setNothing;
        }
Beispiel #25
0
        public void DoSave(Video video)
        {
            video.ValidateAndThrow();

            //  Merge instead of SaveOrUpdate because Video's ID is assigned, but the same Video
            //  entity can be referenced by many different Playlists. As such, it is common to have the entity
            //  loaded into the cache.
            VideoDao.Merge(video);
        }
Beispiel #26
0
 public WMOFile(string fileName, Video.TextureManager customTexMgr = null)
 {
     mCustomTextureMgr = customTexMgr;
     if (mCustomTextureMgr == null)
         mCustomTextureMgr = Video.TextureManager.Default;
     FileName = fileName;
     System.Threading.Thread t = new System.Threading.Thread(AsyncLoadProc);
     t.Start();
 }
Beispiel #27
0
        /// <summary>
        ///     Creates a new Video with a random Id, or a given Id if specified, saves it to the database and returns it.
        /// </summary>
        public static Video CreateUnsavedVideoWithId(string idOverride = "", string titleOverride = "")
        {
            //  Create a random video ID to ensure the Video doesn't exist in the database currently.
            string randomVideoId = idOverride == string.Empty ? Guid.NewGuid().ToString().Substring(0, 11) : idOverride;
            string title = titleOverride == string.Empty ? string.Format("Video {0}", randomVideoId) : titleOverride;
            var video = new Video(randomVideoId, title, 999, "Author");

            return video;
        }
 public VideoEntry Build(Video video)
 {
     return new VideoEntry
         {
             Title = video.Title,
             Description = video.Description,
             Id = video.VideoId,
             Duration = int.Parse(video.Media.Duration.Seconds)
         };
 }
        private Package GetDefaultData()
        {
            Package package= new Package();
               package.Language = "en-US";
               package.Provider = "Paramount";
               package.Version = "5.0";

               Video video = new Video();
               video.VideoType = "film";
               video.SubType = "feature";
               video.VendorOfferCode = "408CH98720X103";
               video.VendorID = "09736156444";
               video.IsanIdentifier = "0000-0000-03B6-0000-O-0000-0000-2";
               video.UniversalProductCode = "09736156444";
               video.Counry = "US";
               video.OriginalSpokenLocale = "en-US";
               video.Title = "Forrest Gump";
               video.Synopsis = "&quot;Stupid is as stupid does,&quot; says Forrest Gump (played by Tom Hanks in an Oscar-winning performance) as he discusses his relative level of intelligence with a stranger while waiting for a bus. Despite his sub-normal IQ, Gump leads a truly charmed life, with a ringside seat for many of the most memorable events of the second half of the 20th century. Featured alongside Tom Hanks are Sally Field as Forrest's mother; Gary Sinise as his commanding officer in Vietnam; Mykelti Williamson as his ill-fated Army buddy who is familiar with every recipe that involves shrimp; and the special effects artists whose digital magic place Forrest amidst a remarkable array of historical events and people";
               video.ProductionCompany = "Paramount Pictures";
               video.CopyrightCline = "1994 Paramount Pictures";
               video.TheatricalReleaseDate = "2007-05-04";

               var genres = new Genre();
               genres.GenreName.Add("Comedy");
               genres.GenreName.Add("Drama");
               video.Genres = genres;

               var ratings = new List<Rating>();
               ratings.Add( new Rating("mpaa","Rated PG-13 for drug content, some sensuality and war violence.", "PG-13"));
               ratings.Add(new Rating("mpaa", "Rated PG-13 for drug content, some sensuality and war violence.", "PG-12"));
               video.Ratings = ratings;

               var casts = new List<Cast>();
               casts.Add(new Cast( "top","Tom Hanks","Forrest Gump"));
               video.Casts = casts;

               var crews = new List<Crew>();
               var roles= new List<Role>();
               roles.Add( new Role("Director"));
               crews.Add( new Crew("top","Robert Zemeckis",roles));
               video.Crews = crews;

               var chapters = new Chapters();
               chapters.TimecodeFormat = "format>24/999 1000/nonDrop";

               var chapterList = new List<Chapter>();
               var artworkFile = new ArtworkFile("chapter01.jpg", new Checksum( "ed93d0f3224a353a4cc8d4175d645130", "md5"), "6591649<");
               chapterList.Add(new Chapter("00:00:00:00", "Forrest's Story Begins", "en-US", artworkFile));
               chapters.Chapter = chapterList;
               video.Chapters = chapters;

               package.Video= video;

               return package;
        }
Beispiel #30
0
 public int addVideo(int account, string title, string description, string location)
 {
     Video video = new Video();
     video.Title = title;
     video.AccountId = account;
     video.Description = description;
     video.Location = location;
     this.db.Videos.InsertOnSubmit(video);
     this.db.SubmitChanges();
     return video.AccountId;
 }