/// <summary>
        /// Searches for the specified show and its episode.
        /// </summary>
        /// <param name="ep">The episode.</param>
        public void Search(Episode ep)
        {
            _td = new TaskDialog
                {
                    Title           = "Searching...",
                    Instruction     = "{0} S{1:00}E{2:00}".FormatWith(ep.Show.Name, ep.Season, ep.Number),
                    Content         = "Searching for the episode...",
                    CommonButtons   = TaskDialogButton.Cancel,
                    ShowProgressBar = true
                };

            _td.SetMarqueeProgressBar(true);
            _td.Destroyed   += TaskDialogDestroyed;
            _td.ButtonClick += TaskDialogDestroyed;

            _active = true;
            new Thread(() =>
                {
                    Thread.Sleep(500);

                    if (_active)
                    {
                        _res = _td.Show().CommonButton;
                    }
                }).Start();

            _os.SearchAsync(ep);

            Utils.Win7Taskbar(state: TaskbarProgressBarState.Indeterminate);
        }
 /// <summary>
 /// Searches for videos on the service asynchronously.
 /// </summary>
 /// <param name="ep">The episode.</param>
 public void SearchAsync(Episode ep)
 {
     SearchThread = new Thread(() =>
         {
             try
             {
                 var url = Search(ep);
                 OnlineSearchDone.Fire(this, "{0} S{1:00}E{2:00}".FormatWith(ep.Show.Name, ep.Season, ep.Number), url);
             }
             catch (OnlineVideoNotFoundException ex)
             {
                 OnlineSearchError.Fire(this, "{0} S{1:00}E{2:00}".FormatWith(ep.Show.Name, ep.Season, ep.Number), ex.Message, new Tuple<string, string, string>(ex.LinkTitle, ex.LinkURL, null));
             }
             catch (Exception ex)
             {
                 OnlineSearchError.Fire(this, "{0} S{1:00}E{2:00}".FormatWith(ep.Show.Name, ep.Season, ep.Number), "There was an error while searching for the video on this service.", new Tuple<string, string, string>(null, null, ex.Message));
             }
         });
     SearchThread.Start();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Searches for videos on BBC iPlayer.
 /// </summary>
 /// <param name="ep">The episode.</param>
 /// <returns>
 /// URL of the video.
 /// </returns>
 public override string Search(Episode ep)
 {
     return "http://www.google.com/search?btnI=I'm+Feeling+Lucky&hl=en&q=" + Utils.EncodeURL("intitle:" + ep.Show.Name + " intitle:\"season " + ep.Season + "\" site:itunes.apple.com inurl:/tv-season/");
 }
Exemplo n.º 4
0
 /// <summary>
 /// Searches for videos on BBC iPlayer.
 /// </summary>
 /// <param name="ep">The episode.</param>
 /// <returns>
 /// URL of the video.
 /// </returns>
 public override string Search(Episode ep)
 {
     return "http://www.google.com/search?btnI=I'm+Feeling+Lucky&hl=en&q=" + Utils.EncodeURL("intitle:" + ep.Show.Name + " intitle:\"Season " + ep.Season + ", Episode " + ep.Number + "\" site:amazon.com");
 }
 /// <summary>
 /// Searches for videos on the service.
 /// </summary>
 /// <param name="ep">The episode.</param>
 /// <returns>
 /// URL of the video.
 /// </returns>
 public abstract string Search(Episode ep);
Exemplo n.º 6
0
        /// <summary>
        /// Downloads all the episodes from the database.
        /// </summary>
        /// <param name="setWatched">if set to <c>true</c> the value of the <c>Watched</c> will be fetched from the <c>Database.Trackings</c> list.</param>
        /// <returns>
        /// List of episodes.
        /// </returns>
        public static List<Episode> GetEpisodes(bool setWatched = false)
        {
            lock (Connection)
            {
                using (var cmd = new SQLiteCommand("select episodeid, showid, season, episode, airdate, name, descr, pic, url from episodes", Connection))
                using (var dr  = cmd.ExecuteReader())
                {
                    var episodes = new List<Episode>();

                    while (dr.Read())
                    {
                        try
                        {
                            var episode = new Episode();

                            episode.EpisodeID = dr.GetInt32(0);
                            episode.ShowID    = dr.GetInt32(1);
                            episode.Season    = dr.GetInt32(2);
                            episode.Number    = dr.GetInt32(3);

                            if (setWatched)
                                episode.Watched = Trackings.Contains(episode.EpisodeID);

                            if (!(dr[4] is DBNull))
                                episode.Airdate = Extensions.GetUnixTimestamp(dr.GetInt32(4));

                            if (!(dr[5] is DBNull))
                                episode.Name = dr.GetString(5);

                            if (!(dr[6] is DBNull))
                                episode.Description = dr.GetString(6);

                            if (!(dr[7] is DBNull))
                                episode.Picture = dr.GetString(7);

                            if (!(dr[8] is DBNull))
                                episode.URL = dr.GetString(8);

                            episodes.Add(episode);
                        }
                        catch
                        {
                        }
                    }

                    return episodes;
                }
            }
        }