Esempio n. 1
0
    public static async Task <List <VideoSearchComponents> > VideoSearch(string queryString, int queryPages = 1)
    {
        var videos = new VideoSearch();
        var items  = await videos.GetVideos(queryString, queryPages);

        return(items);
    }
Esempio n. 2
0
        public async Task DownloadAllMoviesThemeSongsAsync()
        {
            _logger.LogInformation("1");
            VideoSearch videoSearch = new VideoSearch();
            var         movies      = GetMoviesFromLibrary();

            _logger.LogInformation(movies.Count().ToString());
            foreach (var movie in movies)
            {
                var title = String.Format("{0} {1} Soundtrack", movie.Name, movie.ProductionYear);
                _logger.LogInformation(title);

                var results = await videoSearch.GetVideos(title, 1);


                var link = results[0].getUrl();
                _logger.LogInformation(link);
                try
                {
                    //IEnumerable<YoutubeExtractor.VideoInfo> videoInfos = YoutubeExtractor.DownloadUrlResolver.GetDownloadUrls(link);
                    await downloadYoutubeAudioAsync(movie.ContainingFolderPath, link);
                }
                catch (Exception e)
                {
                    _logger.LogInformation(e.Message);
                    _logger.LogInformation("error");
                }
            }
        }
Esempio n. 3
0
        public List <HotTopic> GetHotTopic()
        {
            List <HotTopic> list  = new List <HotTopic>();
            VideoSearch     items = new VideoSearch();

            list.Add(new HotTopic {
                Title = "Apple"
            });
            list.Add(new HotTopic {
                Title = "Walkthrough"
            });
            list.Add(new HotTopic {
                Title = "Gameplay"
            });
            list.Add(new HotTopic {
                Title = "Call Of Duty"
            });
            list.Add(new HotTopic {
                Title = "Test Drive"
            });
            list.Add(new HotTopic {
                Title = "Toyota"
            });
            list.Add(new HotTopic {
                Title = "Funny Video"
            });
            list.Add(new HotTopic {
                Title = "Tutorial"
            });
            list.Add(new HotTopic {
                Title = "Audio Book"
            });
            return(list);
        }
Esempio n. 4
0
        static async void Search()
        {
            // Disable logging
            Log.setMode(false);

            // Keyword
            string querystring = "Kurdo";

            // Number of result pages
            int querypages = 1;

            ////////////////////////////////
            // Start searching
            ////////////////////////////////

            VideoSearch videos = new VideoSearch();
            var         items  = await videos.GetVideos(querystring, querypages);

            foreach (var item in items)
            {
                Console.WriteLine("Title: " + item.getTitle());
                Console.WriteLine("Author: " + item.getAuthor());
                Console.WriteLine("Description: " + item.getDescription());
                Console.WriteLine("Duration: " + item.getDuration());
                Console.WriteLine("Url: " + item.getUrl());
                Console.WriteLine("Thumbnail: " + item.getThumbnail());
                Console.WriteLine("ViewCount: " + item.getViewCount());
                Console.WriteLine("");
            }
        }
Esempio n. 5
0
        public async Task GetYtLink([Optional] params string[] rawQuery)
        {
            try
            {
                if (rawQuery is null || rawQuery.Length == 0)
                {
                    await ReplyAsync("usage: `b!yt <query>`");

                    return;
                }

                string searchQuery = rawQuery.ParseText();

                VideoSearch videos = new VideoSearch();
                var         items  = await videos.GetVideos(searchQuery, 1);

                //EmbedBuilder embed = new EmbedBuilder();
                await ReplyAsync(items.First().getUrl());
            }
            catch (InvalidOperationException ex)
            {
                await ReplyAsync($"Such video doesn't exist.");

                Serilog.Log.Error(ex, "Issue while getting a video:");
                return;
            }
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            // Keyword
            string querystring = "test";

            // Number of result pages
            int querypages = 1;

            ////////////////////////////////
            // Starting searchquery
            ////////////////////////////////

            var items = new VideoSearch();

            int i = 1;

            foreach (var item in items.SearchQuery(querystring, querypages))
            {
                Console.WriteLine(i + "###########################");
                Console.WriteLine("Title: " + item.Title);
                Console.WriteLine("Author: " + item.Author);
                Console.WriteLine("Duration: " + item.Duration);
                Console.WriteLine("Url: " + item.Url);
                Console.WriteLine("Thumbnail: " + item.Thumbnail);
                Console.WriteLine("");

                i++;
            }

            Console.ReadLine();
        }
Esempio n. 7
0
        /// <summary>
        /// Gets a song from a user and plays it
        /// </summary>
        /// <param name="guild"></param>
        /// <param name="channel"></param>
        /// <param name="path">The path to the song (youtube url)</param>
        /// <param name="author">The person requesting the song</param>
        /// <returns></returns>
        public async Task SendLinkAsync(IGuild guild, IMessageChannel channel, string path, IUser author)
        {
            if (ConnectedChannels.TryGetValue(guild.Id, out client))
            {
                Tuple <string, string, string, string, IUser> VideoData = null;

                var items = new VideoSearch();

                var item = items.SearchQuery(path, 1)[0];

                VideoData = new Tuple <string, string, string, string, IUser>(path, item.Title, item.Duration, item.Thumbnail, author);

                queue.Enqueue(VideoData);
                if (songPlaying)
                {
                    await channel.SendMessageAsync($"{VideoData.Item2} has been added to the queue");

                    if (queue.Count == 1)
                    {
                        PlaySong(channel);
                    }
                }
                else
                {
                    songPlaying = true;
                    isSongPlaying.SetResult(true);
                    PlaySong(channel);
                }
            }
        }
Esempio n. 8
0
        private void doSearch()
        {
            panelContent.Controls.Clear();
            home.Clear();
            VideoSearch vs = new VideoSearch();

            foreach (var item in vs.SearchQuery(txtBoxSearch.Text, 1))
            {
                Button b = new Button();
                b.Width             = 340;
                b.Height            = 356;
                b.TextImageRelation = TextImageRelation.TextAboveImage;
                b.Text      = item.Title;
                b.ForeColor = Color.White;
                b.Font      = new Font("Century Gothic", 18);
                byte[] imgBytes = new WebClient().DownloadData(item.Thumbnail);
                using (MemoryStream ms = new MemoryStream(imgBytes))
                {
                    b.Image = Image.FromStream(ms);
                }
                dict.Add(b, item.Url);
                b.Click += new EventHandler(videoClick);
                panelContent.Controls.Add(b);
                home.Add(b);
            }
        }
        public async Task <IActionResult> Details(int movieScheduleId)
        {
            var model = new MovieDetailsModel
            {
                Movie = _movieScheduleRepository.Find(movieScheduleId)
            };

            var imdbData = await _imdbService.GetMovie(model.Movie.Movie.ImdbId);

            if (!string.IsNullOrEmpty(imdbData.Error))
            {
                return(RedirectToAction("Error", "Public"));
            }

            model.Rate        = float.Parse(imdbData.ImdbRating);
            model.Categories  = imdbData.Genre.Split(',');
            model.Duration    = TimeSpan.FromMinutes(int.Parse(imdbData.RunTime.Replace("min", string.Empty).Trim()));
            model.ImageSource = imdbData.Poster;
            model.Reviews     = model.Movie.Movie.Reviews.OrderByDescending(mr => mr.CreatedAt).ToArray();

            var searcher = new VideoSearch();

            var video = searcher.SearchQuery(model.Movie.Movie.Name, 1).FirstOrDefault();

            if (video != null)
            {
                model.Trailer = TransformUrlToEmbed(video.Url);
            }

            return(View(model));
        }
Esempio n. 10
0
        public async Task AddSong([Remainder] string url)
        {
            if (!(Uri.TryCreate(url, UriKind.Absolute, out Uri uriResult) && uriResult.Scheme == Uri.UriSchemeHttp))
            {
                int         querypages = 1;
                VideoSearch videos     = new VideoSearch();
                var         result     = videos.GetVideos(url, querypages).Result.FirstOrDefault();
                if (result == null)
                {
                    await Context.Channel.SendMessageAsync($"Die Suche nach `{url}` konnte keine Ergebnisse erziehlen.");
                }
                else
                {
                    url = result.getUrl();
                }
            }
            if (await _audioService.AddToPlaylist(Context.Guild, url))
            {
                var videoInfos = DownloadUrlResolver.GetDownloadUrls(url, false).FirstOrDefault();
                if (videoInfos != null)
                {
                    await Context.Channel.SendMessageAsync($"`{videoInfos.Title}` wurde erfolgreich zur Playlist hinzugefügt.");

                    return;
                }
            }
            await Context.Channel.SendMessageAsync($"Ups, da ging was schief.");
        }
        public async Task DownloadAllMoviesThemeSongsAsync()
        {
            _logger.LogInformation("1");
            VideoSearch videoSearch = new VideoSearch();
            var         movies      = GetMoviesFromLibrary();

            _logger.LogInformation(movies.Count().ToString());
            foreach (var movie in movies)
            {
                var title = movie.OriginalTitle + " bso " + movie.ProductionYear;
                _logger.LogInformation(title);

                var results = await videoSearch.GetVideos(title, 1);


                var link = results[0].getUrl();
                _logger.LogInformation(link);
                try
                {
                    await downloadYoutubeAudioAsync(movie.Path, link);
                }
                catch (Exception e)
                {
                    _logger.LogInformation(e.Message);
                    _logger.LogInformation("error");
                }
            }
        }
Esempio n. 12
0
        /*
         *  The main function. Basicly it shows the unicode logo I made, and ask user for a video title, that will be searched on YouTube.
         *  The function show all videos detected on 1st page and ask user if 1st result is correct.
         *  If not, the app will show user whole list of found videos, and asks for selecting the correct one
         *  (or entering new phrase if searched video is not on the list).
         *  When user confirm any of results, the program will show all available info, and let user download it.
         */

        ///<summary>The main function asks user for a phrase and let him or her, select the correct result and then gives some options to do with it.</summary>
        static void Main()
        {
            Console.Clear();
            Console.WriteLine(logo);
            Console.WriteLine("Enter title of the video you want to peek:");
            string videoName = Console.ReadLine();

            try
            {
                VideoSearch             items = new VideoSearch();
                List <VideoInformation> list  = items.SearchQuery(videoName, pagesToCheck);
                Console.WriteLine("Did you mean: " + list[0].Title + "?");
                if (Confirm())
                {
                    ShowAllInfo(list[0], true);
                }
                else
                {
                    SelectVideo(list, true);
                }
            }
            catch (System.Net.WebException)
            {
                Console.WriteLine("Connection error.\nCheck your internet connection and press any key to try again.");
                Console.ReadKey();
                Main();
            }
        }
Esempio n. 13
0
        static async Task Main(string[] args)
        {
            Console.WriteLine("Hello World!");



            string querystring = "travis";
            int    querypages  = 1;

            VideoSearch videos = new VideoSearch();
            var         items  = await videos.GetVideos(querystring, querypages);

            foreach (var item in items)
            {
                Console.WriteLine("Title: " + item.getTitle());
                Console.WriteLine("Author: " + item.getAuthor());
                Console.WriteLine("Description: " + item.getDescription());
                Console.WriteLine("Duration: " + item.getDuration());
                Console.WriteLine("Url: " + item.getUrl());
                Console.WriteLine("Thumbnail: " + item.getThumbnail());
                Console.WriteLine("ViewCount: " + item.getViewCount());
                Console.WriteLine("");
                var t = item;
                await GetAudio(t.getUrl(), t.getTitle() + ".mp4");
            }



            Console.WriteLine("Complete");
            //     >> Download <<
            //        string link = "https://www.youtube.com/watch?v=daKz_b7LrsE";
            // IEnumerable<VideoInfo> videoInfos = DownloadUrlResolver.GetDownloadUrls(link, false);
            //     DownloadVideo(videoInfos);
        }
Esempio n. 14
0
 private void buscarButton_Click(object sender, EventArgs e)
 {
     try
     {
         VideoSearch items = new VideoSearch();
         //Lista de la clase video
         List <Video> list = new List <Video>();
         // Por cada video que resulte de la busqueda, lo agregamos a la lista videos
         // Para despues pasarlo al datagrid.
         foreach (var item in items.SearchQuery(searchTextBox.Text, 1))
         {
             Video video = new Video();
             video.Titulo = item.Title;
             video.Autor  = item.Author;
             video.Url    = item.Url;
             byte[] ImagenBytes = new WebClient().DownloadData(item.Thumbnail);
             using (MemoryStream ms = new MemoryStream(ImagenBytes))
             {
                 video.Thumbnail = Image.FromStream(ms);
             }
             list.Add(video);
         }
         videoBindingSource.DataSource = list;
         searchTextBox.Clear();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error: " + ex.Message.ToString());
     }
 }
Esempio n. 15
0
        public void SearchMethod(string msg)
        {
            // Переменная колличества страниц результатов поиска
            int pages = 1;

            // Инициализация класса поиска видео
            var response = new VideoSearch();

            // Цикл вывода результата поиска
            foreach (var result in response.SearchQuery(msg, pages))
            {
                //Получение ID видео
                var id = result.Url.Substring(result.Url.LastIndexOf('=') + 1);
                // Получение ссылки на просмотр в режиме полного экрана
                var link = "https://www.youtube.com/embed/" + result.Url.Substring(result.Url.LastIndexOf('=') + 1);

                //Добавление названий и ссылок на видео с youtube в конечную коллекцию с результатами
                MainWindow.Self.lsbVideos.Dispatcher.Invoke(() => videos.Add(new Tbot()
                {
                    Name = result.Title,
                    Link = link,
                    Id   = id
                }));
            }
        }
Esempio n. 16
0
        private string SearchVideo(string search)
        {
            VideoSearch      items      = new VideoSearch();
            List <Video>     list       = new List <Video>();
            VideoInformation firstVideo = items.SearchQuery(search, 1).FirstOrDefault();

            return(firstVideo.Url);
        }
Esempio n. 17
0
        public async Task PlayLocal(params string[] search)
        {
            int querypages = 1;

            var items   = new VideoSearch();
            var message = await Context.Channel.SendMessageAsync("Searching...");

            var urls      = items.SearchQuery(string.Join(" ", search), querypages);
            var duration  = urls.First().Duration;
            var thumbnail = urls.First().Thumbnail;

            await message.ModifyAsync(msg => msg.Content = "Downloading " + urls.First().Title + "...");

            var urlToDownload   = urls.First().Url;
            var newFilename     = Guid.NewGuid().ToString();
            var mp3OutputFolder = Environment.CurrentDirectory + "/songs/";
            var downloader      = new YoutubeDL();

            downloader.VideoUrl      = urlToDownload;
            downloader.YoutubeDlPath = @"C:\Users\thoma\source\repos\CoolDiscordBot\CoolDiscordBot\bin\Debug\youtube-dl.exe";
            downloader.Options.FilesystemOptions.Output = Environment.CurrentDirectory + "/songs/" + newFilename;
            downloader.PrepareDownload();
            downloader.Download();
            var info = downloader.GetDownloadInfo();

            while (downloader.ProcessRunning == true)
            {
                await Task.Delay(50);
            }

            EmbedBuilder builder = new EmbedBuilder();

            builder.Title = Context.User.Username + "#" + Context.User.Discriminator;
            builder.AddField("Name", info.Title);
            builder.ThumbnailUrl = thumbnail;
            builder.AddField("Duration", duration);
            builder.AddField("Url", urlToDownload);


            await ReplyAsync("t", false, builder.Build());

            audioModule = new audiomodule();
            var voiceChannel = ((IVoiceState)Context.User).VoiceChannel;

            if (voiceChannel is null)
            {
                await ReplyAsync($"{Context.User.Mention} you are not in a voice channel!");

                return;
            }
            var audioClient = await voiceChannel.ConnectAsync().ConfigureAwait(false);

            Console.WriteLine(newFilename);
            string path = "\"" + Environment.CurrentDirectory + "/songs/" + newFilename + ".mkv" + "\"";

            await audioModule.PlayLocalMusic(path, audioClient);
        }
Esempio n. 18
0
  protected void Button1_Click1(object sender, EventArgs e)
  {
      string search = searchtextbox.Text.ToString();

      // Number of result pages
      int querypages = 1;

      ////////////////////////////////
      // Starting searchquery
      ////////////////////////////////

      var items = new VideoSearch();

      int i       = 1;
      var videoId = string.Empty;

      foreach (var item in items.SearchQuery(search, querypages))
      {
          //Console.WriteLine(i + "###########################");
          //Console.WriteLine("Title: " + item.Title);
          //Console.WriteLine("Author: " + item.Author);
          //Console.WriteLine("Description: " + item.Description);
          //Console.WriteLine("Duration: " + item.Duration);
          //Console.WriteLine("Url: " + item.Url);
          //Console.WriteLine("Thumbnail: " + item.Thumbnail);
          //Console.WriteLine("");

          var url = item.Url;
          var uri = new Uri(url);

          // you can check host here => uri.Host <= "www.youtube.com"

          var query = HttpUtility.ParseQueryString(uri.Query);

          // var videoId = string.Empty;

          if (query.AllKeys.Contains("v"))
          {
              videoId = query["v"];
          }
          else
          {
              videoId = uri.Segments.Last();
          }
          HtmlGenericControl div = new HtmlGenericControl("div");
          div.Attributes.Add("id", i.ToString());
          testinner.Controls.Add(div);
          div.InnerHtml = "<div class='col - sm - 4'><iframe width='560' height='315' src='https://www.youtube.com/embed/" + videoId + "' frameborder='0' allow='autoplay; encrypted-media' allowfullscreen></iframe><a href = Youtubevideosupload.aspx?youtubeid=" + videoId + "&teacher=" + userkey + "&duration=" + item.Duration + "> Share with your students</a> </div>";


          i++;
      }
  }
Esempio n. 19
0
        public async Task Yearch([Remainder] string message)
        {
            var    items = new VideoSearch();
            string fvid  = "Something went wrong";

            foreach (var item in items.SearchQuery(message, 1))
            {
                fvid = Convert.ToString(item.Url);
                break;
            }
            await Context.Channel.SendMessageAsync(fvid);
        }
Esempio n. 20
0
        static public ISong SearchYTGetSong(string query)
        {
            var      search   = new VideoSearch().SearchQuery(query, 1);
            TimeSpan duration = TimeSpan.FromMilliseconds(0);

            try
            {
                //duration = search[0].Duration
            }
            catch (Exception) { }
            return(new ISong().WithDuration(duration).WithTitle(search[0].Title).WithURL(search[0].Url));
        }
Esempio n. 21
0
        private void button1_Click(object sender, EventArgs e)
        {
            // Keywords to make sure we keep in scope and not have a trump russia video show up
            // there is probably better ways to do this but this is easy and works incredibility well
            string keywords = "Modded Minecraft 1.12 Tutorial English ";

            //processed query string
            string querystring = keywords + textBox1.Text;

            // Number of result pages
            int querypages = 1;

            // Offset value for querypages
            int querypagesOffset = 1;

            //using Youtubesearch library
            var items = new VideoSearch();

            int i = 0;

            // Was an experiment to catch people wanting to figure out how to chunkload
            // example of sometype of keyword trigger (not needed)
            if (querystring.Contains("chunk load") || querystring.Contains("chunkload"))
            {
                textBox2.Text = "Run '/kit scl' for chunk loaders. You have access to two chunkloaders. Use F3+g to show chunk borders.";
                return;
            }

            //loop through to pull the 3 top videos
            foreach (var item in items.SearchQuery(querystring, querypages))
            {
                //when the search results return a low confidence, youtube replies with the 3 same low confidence video results.
                //for some reason these low confidence results likes to tell us how to make a server and this is due to the predefined key words taking prioity.
                //if keywords change, the default results will change

                if (item.Title.Contains("How to Make a Modded Minecraft Server"))
                {
                    textBox2.Text = "Invalid results! Make sure to use mod name or item name, needs to be descriptive!";
                    break;
                }

                i++;
                textBox2.AppendText("Title: " + item.Title + Environment.NewLine +
                                    "URL: " + item.Url + Environment.NewLine);


                if (i == 3)
                {
                    break;
                }
            }
        }
        private List <VideoInformation> Search(string query, int maxResults, Func <VideoInformation, int> comparer = null)
        {
            var items = new VideoSearch();

            // ordering by similarity to title by default, I should look into how that algorithm works sometime, seems interesting
            var results = items.SearchQuery(query, 1).OrderBy(comparer ?? (x => LevenshteinDistance.Compute(x.Title, query))).ToList();

            if (results.Count > maxResults)
            {
                results.RemoveRange(maxResults, results.Count - maxResults);
            }
            return(results);
        }
Esempio n. 23
0
        //example for asynchronous execution
        private static async void AsyncQuery()
        {
            var querystring = "test";
            int querypages = 1;

            var items = new VideoSearch();
            foreach (var item in await items.SearchQueryTaskAsync(querystring, querypages))
            {
                Console.WriteLine("##########################");
                Console.WriteLine(item.Title);
                Console.WriteLine("");
            }
        }
Esempio n. 24
0
        private void searchButton_Click(object sender, RoutedEventArgs e)
        {
            VideoSearch vs = new VideoSearch();

            string query = searchTextBox.Text;

            // Make the query
            List <VideoInformation> vlist = vs.SearchQuery(query, 1);

            // Bind vlist to the listbox.
            SkinListBox.ItemsSource = vlist;
            VideoInformation v = new VideoInformation();
        }
Esempio n. 25
0
        public async void PerformSearch()
        {
            Videos = new ObservableCollection <VideoModel>();
            string querystring = searchTerm;
            int    querypages  = 1;

            VideoSearch videos = new VideoSearch();
            var         items  = await videos.GetVideos(querystring, querypages);


            foreach (var i in items)
            {
                var t = new VideoModel()
                {
                    Author        = i.getAuthor(),
                    Downloaded    = false,
                    ImageLocation = i.getThumbnail(),
                    Selected      = false,
                    Title         = i.getTitle(),
                    Url           = i.getUrl(),
                };


                var sp = t.Title.IndexOf('-') - 1;

                var art   = "";
                var track = "";

                if (sp <= 1)
                {
                    art   = t.Title.Trim();
                    track = "";
                }
                else
                {
                    art   = t.Title.Substring(0, sp).Trim();
                    track = t.Title.Remove(0, sp + 2).Trim();
                }


                t.Artist   = art;
                t.SongName = track;

                Videos.Add(
                    t
                    );
            }

            ItemCount = Videos.Count;
        }
Esempio n. 26
0
 private void listView1_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         if (musiclist.SelectedItems.Count == 1)
         {
             if (ShowPopular == false)
             {
                 this.Enabled = false;
                 DownloadFromYoutube(musiclist.SelectedItems[0].Name);
                 this.Enabled = true;
                 metroTabControl1.SelectedIndex = 1;
             }
             else
             {
                 var    items        = new VideoSearch();
                 int    index        = 0;
                 bool   found        = false;
                 string youtubeUrl   = "";
                 string youtubeTitle = "";
                 while (!found)
                 {
                     youtubeUrl   = items.SearchQuery(musiclist.SelectedItems[0].Text, 1)[index].Url;
                     youtubeTitle = items.SearchQuery(musiclist.SelectedItems[0].Text, 1)[index].Title.Trim();
                     if (youtubeTitle.Contains("MUSIC BANK") || youtubeTitle.Contains("MusicBank") || youtubeTitle.Contains("음악중심") || youtubeTitle.Contains("음중") || youtubeTitle.Contains("뮤직뱅크") || youtubeTitle.Contains("뮤뱅") || youtubeTitle.Contains("라이브") || youtubeTitle.Contains("Live") || youtubeTitle.Contains("TJ노래방") || youtubeTitle.Contains("Karaoke") || youtubeTitle.Contains("1시간") || youtubeTitle.Contains("1h") || youtubeTitle.Contains("1Hour") || youtubeTitle.Contains("1hour"))
                     {
                         index++;
                     }
                     else
                     {
                         found = true;
                     }
                 }
                 this.Enabled = false;
                 DownloadFromYoutube(youtubeUrl);
                 this.Enabled = true;
                 metroTabControl1.SelectedIndex = 1;
             }
         }
         else
         {
             MessageBox.Show("곡을 한개만 선택해주세요.");
         }
     }
     catch
     {
         MessageBox.Show("오류 발생 프로그램을 종료합니다.");
         Process.GetCurrentProcess().Kill();
     }
 }
Esempio n. 27
0
        async void YouTubeSearch(string querystring)
        {
            AudioS      audioSearch;
            int         querypages = 1;
            VideoSearch videos     = new VideoSearch();
            var         items      = await videos.GetVideos(querystring, querypages);

            searchList.Items.Clear();
            foreach (var item in items)
            {
                audioSearch = new AudioS(item.getAuthor(), item.getTitle().Trim(), item.getDescription(), item.getDuration(), item.getUrl(), item.getThumbnail());
                searchList.Items.Add(audioSearch);
            }
        }
        private void queryBtn_Click(object sender, EventArgs e)
        {
            this.picList.Clear();

            if (this.comboBox1.Text == "" || this.comboBox1.Text == null)
            {
                MessageBox.Show("请选择要查询的摄像头ID", "警告");
                return;
            }


            int cameraID = int.Parse(this.comboBox1.Text);


            //judge the input validation
            DateTime date1 = this.dateTimePicker1.Value;
            DateTime date2 = this.dateTimePicker2.Value;
            DateTime time1 = this.timeEdit1.Time;
            DateTime time2 = this.timeEdit2.Time;

            DateTime dateTime1 = new DateTime(date1.Year, date1.Month, date1.Day, time1.Hour, time1.Minute, time1.Second);
            DateTime dateTime2 = new DateTime(date2.Year, date2.Month, date2.Day, time2.Hour, time2.Minute, time2.Second);

            if (dateTime1 >= dateTime2)
            {
                MessageBox.Show("时间起点不应该大于或者等于时间终点,请重新输入!", "警告");
                return;
            }


            string[] files = VideoSearch.FindVideos(cameraID, dateTime1, dateTime2);

            if (files == null)
            {
                MessageBox.Show("没有搜索到满足条件的视频!", "警告");
                return;
            }

            //this.picList.Scrollable = true;
            //this.picList.MultiSelect = false;
            //this.picList.View = View.LargeIcon;
            //this.picList.LargeImageList = imageList1;

            this.videoList.Items.Clear();
            foreach (var file in files)
            {
                this.videoList.Items.Add(file);
            }
        }
Esempio n. 29
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();

            var items = new VideoSearch();

            int i = 1;

            querypages = int.Parse(comboBox2.SelectedItem.ToString());

            foreach (var item in items.SearchQuery(textBox2.Text, querypages))
            {
                dataGridView1.Rows.Add(item.Title, item.Author, item.Description, item.Duration, item.Url, GetImageFromUrl(item.Thumbnail));
            }
        }
Esempio n. 30
0
        public string YTSearch(string search)
        {
            var results = new VideoSearch();

            ResultsList = results.SearchQuery(search, 1);
            string searchresults = "```1. " + ResultsList[0].Title + " " + ResultsList[0].Duration;

            for (int i = 1; i < 5; i++)
            {
                searchresults = searchresults + Environment.NewLine + (i + 1).ToString() + ". " + ResultsList[i].Title + " " + ResultsList[i].Duration;
            }

            searchresults = searchresults + "```";
            return(searchresults);
        }