Пример #1
0
        // Show the comics in the window
        private void Fillcomics()
        {
            System.IO.FileInfo fi;
            ArrayList          comics;

            fi = new System.IO.FileInfo(_homeDirectory + "\\AvailableComics.xml");

            _comicsViewer.Clear();
            // Show the "Downloading Comics..." item when the updater is running and there are comics to download
            if (SingletonComicsUpdater.Instance.Updating == true && SingletonComicsUpdater.Instance.SubscribedComics.Length != 0)
            {
                ComicListItem item;
                item = new ComicListItem("Downloading Comics... Click to refresh", "");
                item.RelativeBounds = new Rectangle(0, 0, 200, 40);
                _comicsViewer.AddItem(item);
            }

            // Load the comics or show the instructions screen
            try
            {
                comics = ComicsUpdater.LoadComics(fi.FullName);
            }
            catch
            {
                _instructions.Text    = "Please subscribe to comics";
                _instructions.Visible = true;
                return;
            }

            // If there are no subscribed comics, show instructions
            foreach (ComicInfo ci in comics)
            {
                if (ci.Subscribed == true)
                {
                    _instructions.Visible = false;
                    break;
                }
                else
                {
                    _instructions.Visible = true;
                }
            }

            // Get the number of days to keep
            int daysToKeep;

            try
            {
                string sDaysToKeep;

                SingletonConfig.Instance.GetPropertyAsString("Comics.DaysToKeep", out sDaysToKeep);
                daysToKeep = int.Parse(sDaysToKeep);
            }
            catch { daysToKeep = 7; }

            string sSortBy;

            SingletonConfig.Instance.GetPropertyAsString("Comics.SortBy", out sSortBy);
            if (sSortBy == "Date")
            {
                // Retrieve the local image for each comic
                for (int i = 0; i < daysToKeep; i++)
                {
                    foreach (ComicInfo ci in comics)
                    {
                        if (ci.Subscribed == true)
                        {
                            string title, fullName;

                            DateTime dt = DateTime.Now.AddDays(-i);
                            title = ci.DisplayName + " - " + dt.ToString("D", DateTimeFormatInfo.InvariantInfo);
                            // Create the image filename from the format in the XML file
                            char[]   delims         = { '$' };
                            String[] FilenameTokens = ci.ImageFilename.Split(delims, 100);
                            String   ImageFilename  = "";
                            // Parse the String format and form the filename
                            foreach (String s in FilenameTokens)
                            {
                                // Year
                                if (s.Equals("YY"))
                                {
                                    ImageFilename += dt.ToString("yy", DateTimeFormatInfo.InvariantInfo);
                                }
                                // Month
                                else if (s.Equals("MM"))
                                {
                                    ImageFilename += dt.ToString("MM", DateTimeFormatInfo.InvariantInfo);
                                }
                                // Day
                                else if (s.Equals("DD"))
                                {
                                    ImageFilename += dt.ToString("dd", DateTimeFormatInfo.InvariantInfo);
                                }
                                else
                                {
                                    ImageFilename += s;
                                }
                            }
                            fullName = _homeDirectory + "\\" + ci.FolderName + "\\" + ImageFilename + "." + ci.ImageSuffix;
                            bool noComic = true;
                            if (!System.IO.File.Exists(fullName))
                            {
                                noComic = true;
                                // try the Dilbert hack
                                fullName = _homeDirectory + "\\" + ci.FolderName + "\\" + ImageFilename + ".jpg";
                                if (System.IO.File.Exists(fullName))
                                {
                                    noComic = false;
                                }
                            }
                            else
                            {
                                noComic = false;
                            }

                            if (noComic)
                            {
                                continue;
                            }

                            // width is always 600
                            // height is a minimum of 200, maximum of 600
                            Bitmap bmp;
                            float  aspectRatio;
                            int    calculatedHeight, calculatedWidth;

                            bmp = null;
                            try
                            {
                                bmp = new Bitmap(fullName);
                            }
                            catch (Exception e)
                            {
                                SnapStream.Logging.WriteLog("Fillcomics - Could not load the comic: " + ci.DisplayName);
                                SnapStream.Logging.WriteLog(e.ToString());
                                continue;
                            }

                            if (bmp.Size.Height == 0)
                            {
                                SnapStream.Logging.WriteLog("Fillcomics - bitmap had no height: " + ci.DisplayName);
                                continue;
                            }

                            aspectRatio = (float)bmp.Size.Width / (float)bmp.Size.Height;
                            if (aspectRatio > 600 / 200)
                            {
                                calculatedWidth  = 600;
                                calculatedHeight = 200;
                            }
                            else
                            {
                                calculatedWidth  = 600;
                                calculatedHeight = (int)((float)bmp.Size.Width / aspectRatio);
                            }

                            ComicListItem item;
                            item = new ComicListItem(title, fullName);
                            item.RelativeBounds = new Rectangle(0, 0, calculatedWidth, calculatedHeight);
                            _comicsViewer.AddItem(item);
                        }
                    }
                }
            }
            if (sSortBy == "Comic")
            {
                // Retrieve the local image for each comic
                foreach (ComicInfo ci in comics)
                {
                    for (int i = 0; i < daysToKeep; i++)
                    {
                        if (ci.Subscribed == true)
                        {
                            string title, fullName;

                            DateTime dt = DateTime.Now.AddDays(-i);
                            title = ci.DisplayName + " - " + dt.ToString("D", DateTimeFormatInfo.InvariantInfo);
                            // Create the image filename from the format in the XML file
                            char[]   delims         = { '$' };
                            String[] FilenameTokens = ci.ImageFilename.Split(delims, 100);
                            String   ImageFilename  = "";
                            // Parse the String format and form the filename
                            foreach (String s in FilenameTokens)
                            {
                                // Year
                                if (s.Equals("YY"))
                                {
                                    ImageFilename += dt.ToString("yy", DateTimeFormatInfo.InvariantInfo);
                                }
                                // Month
                                else if (s.Equals("MM"))
                                {
                                    ImageFilename += dt.ToString("MM", DateTimeFormatInfo.InvariantInfo);
                                }
                                // Day
                                else if (s.Equals("DD"))
                                {
                                    ImageFilename += dt.ToString("dd", DateTimeFormatInfo.InvariantInfo);
                                }
                                else
                                {
                                    ImageFilename += s;
                                }
                            }
                            fullName = _homeDirectory + "\\" + ci.FolderName + "\\" + ImageFilename + "." + ci.ImageSuffix;
                            bool noComic = true;
                            if (!System.IO.File.Exists(fullName))
                            {
                                noComic = true;
                                // try the Dilbert hack
                                fullName = _homeDirectory + "\\" + ci.FolderName + "\\" + ImageFilename + ".jpg";
                                if (System.IO.File.Exists(fullName))
                                {
                                    noComic = false;
                                }
                            }
                            else
                            {
                                noComic = false;
                            }

                            if (noComic)
                            {
                                continue;
                            }

                            // width is always 600
                            // height is a minimum of 200, maximum of 600
                            Bitmap bmp;
                            float  aspectRatio;
                            int    calculatedHeight, calculatedWidth;

                            bmp = null;
                            try
                            {
                                bmp = new Bitmap(fullName);
                            }
                            catch (Exception e)
                            {
                                SnapStream.Logging.WriteLog("Fillcomics - Could not load the comic: " + ci.DisplayName);
                                SnapStream.Logging.WriteLog(e.ToString());
                                continue;
                            }

                            if (bmp.Size.Height == 0)
                            {
                                SnapStream.Logging.WriteLog("Fillcomics - bitmap had no height: " + ci.DisplayName);
                                continue;
                            }

                            aspectRatio = (float)bmp.Size.Width / (float)bmp.Size.Height;
                            if (aspectRatio > 600 / 200)
                            {
                                calculatedWidth  = 600;
                                calculatedHeight = 200;
                            }
                            else
                            {
                                calculatedWidth  = 600;
                                calculatedHeight = (int)((float)bmp.Size.Width / aspectRatio);
                            }

                            ComicListItem item;
                            item = new ComicListItem(title, fullName);
                            item.RelativeBounds = new Rectangle(0, 0, calculatedWidth, calculatedHeight);
                            _comicsViewer.AddItem(item);
                        }
                    }
                }
            }

            // Start at the first
            _comicsViewer.SelectedIndex = 0;

            return;
        }
        // On entering the screen
        public override void Activate()
        {
            if (base.NavigatingForward)
            {
                base.Activate();

                // Get all trailers downloaded
                string[] movList = Directory.GetFiles(homedir + "\\Trailers", "*.mov");
                for (int i = 0; i < movList.Length; i++)
                {
                    int lastIndex = movList[i].LastIndexOf("\\");
                    movList[i] = movList[i].Substring(lastIndex + 1);
                }

                // Get the movie info to display
                YahooTrailersInfo movieinfo = (YahooTrailersInfo)ScreenArgs;
                //SnapStream.Logging.WriteLog("YahooTrailers: Loading " + movieinfo.Title.ToString());
                _header.Text      = movieinfo.Title.ToString();
                _details.Text     = movieinfo.Details.ToString();
                _starring.Text    = movieinfo.Starring.ToString();
                _genre.Text       = movieinfo.Genre.ToString();
                _releasedate.Text = movieinfo.ReleaseDate.ToString();
                _rating.Text      = movieinfo.Rating.ToString();

                // Get Poster
                string jpgpath = homedir + "\\Posters\\" + movieinfo.Title.ToString().Replace(":", "").Replace("?", "") + ".jpg";
                ((PosterWindow)_poster).LoadTexture(jpgpath);

                // Create variable item list of trailers
                ((BaseList)_trailers).Clear();

                // List all the available trailers
                string  movieName = _header.Text;
                Trailer trailer;

                // Trailer 2
                if (movieinfo._trailer2URL != null)
                {
                    //SnapStream.Logging.WriteLog("YahooTrailers: Getting Trailer #2 Links");
                    // 480p Link
                    if (isInLibrary(movieName + "*****@*****.**", movList))
                    {
                        trailer = new Trailer("PLAY Trailer2@480p", "Trailer 2", "480p");
                    }
                    else
                    {
                        trailer = new Trailer("Trailer2@480p", "Trailer 2", "480p");
                    }
                    trailer._movieURL = movieinfo._trailer2URL[0];
                    trailer.Height    = 35;
                    _trailers.AddItem(trailer);
                    // 720p Link
                    if (isInLibrary(movieName + "*****@*****.**", movList))
                    {
                        trailer = new Trailer("PLAY Trailer2@720p", "Trailer 2", "720p");
                    }
                    else
                    {
                        trailer = new Trailer("Trailer2@720p", "Trailer 2", "720p");
                    }
                    trailer._movieURL = movieinfo._trailer2URL[1];
                    trailer.Height    = 35;
                    _trailers.AddItem(trailer);
                    // 1080p Link
                    if (isInLibrary(movieName + "*****@*****.**", movList))
                    {
                        trailer = new Trailer("PLAY Trailer2@1080p", "Trailer 2", "1080p");
                    }
                    else
                    {
                        trailer = new Trailer("Trailer2@1080p", "Trailer 2", "1080p");
                    }
                    trailer._movieURL = movieinfo._trailer2URL[2];
                    trailer.Height    = 35;
                    _trailers.AddItem(trailer);
                }
                // Trailer
                if (movieinfo._trailerURL != null)
                {
                    //SnapStream.Logging.WriteLog("YahooTrailers: Getting Trailer Links");
                    // 480p Link
                    if (isInLibrary(movieName + "*****@*****.**", movList))
                    {
                        trailer = new Trailer("PLAY Trailer@480p", "Trailer", "480p");
                    }
                    else
                    {
                        trailer = new Trailer("Trailer@480p", "Trailer", "480p");
                    }
                    trailer._movieURL = movieinfo._trailerURL[0];
                    trailer.Height    = 35;
                    _trailers.AddItem(trailer);
                    // 720p Link
                    if (isInLibrary(movieName + "*****@*****.**", movList))
                    {
                        trailer = new Trailer("PLAY Trailer@720p", "Trailer", "720p");
                    }
                    else
                    {
                        trailer = new Trailer("Trailer@720p", "Trailer", "720p");
                    }
                    trailer._movieURL = movieinfo._trailerURL[1];
                    trailer.Height    = 35;
                    _trailers.AddItem(trailer);
                    // 1080p Link
                    if (isInLibrary(movieName + "*****@*****.**", movList))
                    {
                        trailer = new Trailer("PLAY Trailer@1080p", "Trailer", "1080p");
                    }
                    else
                    {
                        trailer = new Trailer("Trailer@1080p", "Trailer", "1080p");
                    }
                    trailer._movieURL = movieinfo._trailerURL[2];
                    trailer.Height    = 35;
                    _trailers.AddItem(trailer);
                }
                // Teaser
                if (movieinfo._teaser2URL != null)
                {
                    //SnapStream.Logging.WriteLog("YahooTrailers: Getting Teaser #2 Links");
                    // 480p Link
                    if (isInLibrary(movieName + "*****@*****.**", movList))
                    {
                        trailer = new Trailer("PLAY Teaser2@480p", "Teaser 2", "480p");
                    }
                    else
                    {
                        trailer = new Trailer("Teaser2@480p", "Teaser 2", "480p");
                    }
                    trailer._movieURL = movieinfo._teaser2URL[0];
                    trailer.Height    = 35;
                    _trailers.AddItem(trailer);
                    // 720p Link
                    if (isInLibrary(movieName + "*****@*****.**", movList))
                    {
                        trailer = new Trailer("PLAY Teaser2@720p", "Teaser 2", "720p");
                    }
                    else
                    {
                        trailer = new Trailer("Teaser2@720p", "Teaser 2", "720p");
                    }
                    trailer._movieURL = movieinfo._teaser2URL[1];
                    trailer.Height    = 35;
                    _trailers.AddItem(trailer);
                    // 1080p Link
                    if (isInLibrary(movieName + "*****@*****.**", movList))
                    {
                        trailer = new Trailer("PLAY Teaser2@1080p", "Teaser 2", "1080p");
                    }
                    else
                    {
                        trailer = new Trailer("Teaser2@1080p", "Teaser 2", "1080p");
                    }
                    trailer._movieURL = movieinfo._teaser2URL[2];
                    trailer.Height    = 35;
                    _trailers.AddItem(trailer);
                }
                // Teaser
                if (movieinfo._teaserURL != null)
                {
                    //SnapStream.Logging.WriteLog("YahooTrailers: Getting Teaser Links");
                    // 480p Link
                    if (isInLibrary(movieName + "*****@*****.**", movList))
                    {
                        trailer = new Trailer("PLAY Teaser@480p", "Teaser", "480p");
                    }
                    else
                    {
                        trailer = new Trailer("Teaser@480p", "Teaser", "480p");
                    }
                    trailer._movieURL = movieinfo._teaserURL[0];
                    trailer.Height    = 35;
                    _trailers.AddItem(trailer);
                    // 720p Link
                    if (isInLibrary(movieName + "*****@*****.**", movList))
                    {
                        trailer = new Trailer("PLAY Teaser@720p", "Teaser", "720p");
                    }
                    else
                    {
                        trailer = new Trailer("Teaser@720p", "Teaser", "720p");
                    }
                    trailer._movieURL = movieinfo._teaserURL[1];
                    trailer.Height    = 35;
                    _trailers.AddItem(trailer);
                    // 1080p Link
                    if (isInLibrary(movieName + "*****@*****.**", movList))
                    {
                        trailer = new Trailer("PLAY Teaser@1080p", "Teaser", "1080p");
                    }
                    else
                    {
                        trailer = new Trailer("Teaser@1080p", "Teaser", "1080p");
                    }
                    trailer._movieURL = movieinfo._teaserURL[2];
                    trailer.Height    = 35;
                    _trailers.AddItem(trailer);
                }


                return;
            }
        }
Пример #3
0
        private void GetTrailers()
        {
            // try to log in
            uri = new System.Uri("http://movies.yahoo.com/feature/hdtrailers.html");
            SnapStream.Logging.WriteLog("YahooTrailers: Scraping http://movies.yahoo.com/feature/hdtrailers.html");
            // Create a webclient
            webreq  = (HttpWebRequest)WebRequest.Create(uri);
            cookies = new CookieContainer();
            webreq.CookieContainer = cookies;
            // Get the response
            try
            {
                webres    = (HttpWebResponse)webreq.GetResponse();
                resStream = webres.GetResponseStream();
                response  = new StreamReader(resStream).ReadToEnd();
                response  = response.Substring(response.IndexOf("<!-- Menu Links -->"));
                // Create a new List item
                YahooTrailersListItem trailerlistitem;
                while (response.IndexOf("\"a-m-t\">") != -1)
                {
                    // Get the Title
                    int    startindex = response.IndexOf("\"a-m-t\">") + 19;
                    int    endindex   = response.IndexOf("</dt>", startindex);
                    string title      = response.Substring(startindex, endindex - startindex).Trim();
                    trailerlistitem = new YahooTrailersListItem(title);
                    //SnapStream.Logging.WriteLog("YahooTrailers: " + title);
                    response = response.Substring(startindex + title.Length);
                    // Get the Poster URL
                    startindex = response.IndexOf("img src=\"") + 9;
                    endindex   = response.IndexOf("\" border", startindex);
                    trailerlistitem._jpegURL = response.Substring(startindex, endindex - startindex).Trim();
                    ////SnapStream.Logging.WriteLog(trailerlistitem._jpegURL);
                    response = response.Substring(startindex + trailerlistitem._jpegURL.Length);
                    // Get the Details
                    startindex = response.IndexOf("<div>") + 6;
                    endindex   = response.IndexOf("<br />", startindex) - 1;
                    trailerlistitem._details = response.Substring(startindex, endindex - startindex).Trim();
                    //SnapStream.Logging.WriteLog(trailerlistitem._details);
                    response = response.Substring(startindex + trailerlistitem._details.Length);
                    // Get the Starring actors
                    startindex = response.IndexOf("Starring: ") + 10;
                    endindex   = response.IndexOf("<br />", startindex);
                    trailerlistitem._starring = response.Substring(startindex, endindex - startindex).Trim();
                    trailerlistitem.addStarring(trailerlistitem._starring);
                    //SnapStream.Logging.WriteLog(trailerlistitem._starring);
                    response = response.Substring(startindex + trailerlistitem._starring.Length);
                    // Get the Genre
                    startindex             = response.IndexOf("<br />") + 7;
                    endindex               = response.IndexOf("<br />", startindex);
                    trailerlistitem._genre = response.Substring(startindex, endindex - startindex).Trim();
                    //SnapStream.Logging.WriteLog(trailerlistitem._genre);
                    response = response.Substring(startindex + trailerlistitem._genre.Length);
                    // Get the release date
                    startindex = response.IndexOf("<br />") + 7;
                    endindex   = response.IndexOf("<br />", startindex);
                    trailerlistitem._releasedate = response.Substring(startindex, endindex - startindex).Trim();
                    //SnapStream.Logging.WriteLog(trailerlistitem._releasedate);
                    response = response.Substring(startindex + trailerlistitem._releasedate.Length);
                    // Get the Rating
                    startindex = response.IndexOf("<br />") + 7;
                    endindex   = response.IndexOf("<br />", startindex);
                    trailerlistitem._rating = response.Substring(startindex, endindex - startindex).Trim();
                    //SnapStream.Logging.WriteLog(trailerlistitem._rating);
                    response = response.Substring(startindex + trailerlistitem._rating.Length);
                    // Find Trailers
                    int    foundTrailer2 = response.IndexOf("Trailer 2:", 0, response.IndexOf("</dd>"));
                    int    foundTrailer  = response.IndexOf("Trailer:", 0, response.IndexOf("</dd>"));
                    int    foundTeaser2  = response.IndexOf("Teaser 2:", 0, response.IndexOf("</dd>"));
                    int    foundTeaser   = response.IndexOf("Teaser:", 0, response.IndexOf("</dd>"));
                    string subresponse;
                    // Get Trailer 2
                    if (foundTrailer2 != -1)
                    {
                        //SnapStream.Logging.WriteLog("YahooTrailers: Found Trailer 2");

                        // Declare the trailer array
                        trailerlistitem._trailer2URL = new string[3];

                        // Get to the HTML
                        subresponse = response.Substring(foundTrailer2);
                        //SnapStream.Logging.WriteLog(subresponse);

                        // Get all three resolutions
                        startindex = subresponse.IndexOf("href=\"") + 6;
                        endindex   = subresponse.IndexOf("\"", startindex);
                        trailerlistitem._trailer2URL[0] = subresponse.Substring(startindex, endindex - startindex).Trim();
                        //SnapStream.Logging.WriteLog(trailerlistitem._trailer2URL[0]);
                        //response = response.Substring(startindex+trailerlistitem._trailer2URL[i].Length);
                        trailerlistitem._trailer2URL[1] = trailerlistitem._trailer2URL[0].Replace("480", "720");
                        //SnapStream.Logging.WriteLog(trailerlistitem._trailer2URL[1]);
                        trailerlistitem._trailer2URL[2] = trailerlistitem._trailer2URL[0].Replace("480", "1080");
                        //SnapStream.Logging.WriteLog(trailerlistitem._trailer2URL[2]);
                    }
                    // Get Trailer
                    if (foundTrailer != -1)
                    {
                        ////SnapStream.Logging.WriteLog("YahooTrailers: Found Trailer");

                        // Declare the trailer array
                        trailerlistitem._trailerURL = new string[3];

                        // Get to the HTML
                        subresponse = response.Substring(foundTrailer);
                        ////SnapStream.Logging.WriteLog(subresponse);

                        // Get all three resolutions
                        startindex = subresponse.IndexOf("href=\"") + 6;
                        endindex   = subresponse.IndexOf("\"", startindex);
                        trailerlistitem._trailerURL[0] = subresponse.Substring(startindex, endindex - startindex).Trim();
                        //SnapStream.Logging.WriteLog(trailerlistitem._trailerURL[0]);
                        //response = response.Substring(startindex+trailerlistitem._trailerURL[i].Length);
                        trailerlistitem._trailerURL[1] = trailerlistitem._trailerURL[0].Replace("480", "720");
                        //SnapStream.Logging.WriteLog(trailerlistitem._trailerURL[1]);
                        trailerlistitem._trailerURL[2] = trailerlistitem._trailerURL[0].Replace("480", "1080");
                        //SnapStream.Logging.WriteLog(trailerlistitem._trailerURL[2]);
                    }
                    // Get Teaser 2
                    if (foundTeaser2 != -1)
                    {
                        ////SnapStream.Logging.WriteLog("YahooTrailers: Found Teaser 2");

                        // Declare the trailer array
                        trailerlistitem._teaser2URL = new string[3];

                        // Get to the HTML
                        subresponse = response.Substring(foundTeaser2);
                        ////SnapStream.Logging.WriteLog(subresponse);

                        // Get all three resolutions
                        startindex = subresponse.IndexOf("href=\"") + 6;
                        endindex   = subresponse.IndexOf("\"", startindex);
                        trailerlistitem._teaser2URL[0] = subresponse.Substring(startindex, endindex - startindex).Trim();
                        //SnapStream.Logging.WriteLog(trailerlistitem._teaser2URL[0]);
                        //response = response.Substring(startindex+trailerlistitem._teaser2URL[i].Length);
                        trailerlistitem._teaser2URL[1] = trailerlistitem._teaser2URL[0].Replace("480", "720");
                        //SnapStream.Logging.WriteLog(trailerlistitem._teaser2URL[1]);
                        trailerlistitem._teaser2URL[2] = trailerlistitem._teaser2URL[0].Replace("480", "1080");
                        //SnapStream.Logging.WriteLog(trailerlistitem._teaser2URL[2]);
                    }
                    // Get Teaser
                    if (foundTeaser != -1)
                    {
                        //SnapStream.Logging.WriteLog("YahooTrailers: Found Teaser");

                        // Declare the trailer array
                        trailerlistitem._teaserURL = new string[3];

                        // Get to the HTML
                        subresponse = response.Substring(foundTeaser);
                        ////SnapStream.Logging.WriteLog(subresponse);

                        // Get all three resolutions
                        startindex = subresponse.IndexOf("href=\"") + 6;
                        endindex   = subresponse.IndexOf("\"", startindex);
                        trailerlistitem._teaserURL[0] = subresponse.Substring(startindex, endindex - startindex).Trim();
                        //SnapStream.Logging.WriteLog(trailerlistitem._teaserURL[0]);
                        //response = response.Substring(startindex+trailerlistitem._teaserURL[i].Length);
                        trailerlistitem._teaserURL[1] = trailerlistitem._teaserURL[0].Replace("480", "720");
                        //SnapStream.Logging.WriteLog(trailerlistitem._teaserURL[1]);
                        trailerlistitem._teaserURL[2] = trailerlistitem._teaserURL[0].Replace("480", "1080");
                        //SnapStream.Logging.WriteLog(trailerlistitem._teaserURL[2]);
                    }

                    // Get Posters
                    string jpgpath = homedir + "\\Posters\\" + title.Replace(":", "").Replace("?", "") + ".jpg";
                    try
                    {
                        System.Net.WebClient webClient = new System.Net.WebClient();
                        webClient.DownloadFile(trailerlistitem._jpegURL, jpgpath);
                        trailerlistitem.addPoster(title);
                    }
                    catch (System.Net.WebException e)
                    {
                        SnapStream.Logging.WriteLog(e.Message);
                    }

                    // Add to trailer list
                    trailerlistitem.Height = 75;
                    _trailerlist.AddItem(trailerlistitem);
                }
                SnapStream.Logging.WriteLog("YahooTrailers: Done fetching trailer information");
            }
            catch (System.Net.WebException e)
            {
                SnapStream.Logging.WriteLog("YahooTrailers: " + e.ToString());
                _header.Text = "Yahoo Trailers: Connection Error";
            }
        }