private void folderButton_Click(object sender, EventArgs e) { string[] subdirectoryEntries = Directory.GetDirectories(_RootDir); new List <string>(subdirectoryEntries); SelectMenu SelectMain = new SelectMenu(new List <string>(subdirectoryEntries), showNameTextBox.Text, "Select TV Show Folder"); if (SelectMain.ShowDialog() == DialogResult.OK) { int selectedid = SelectMain.selected; if (selectedid == -1) { return; } TVShowFolderTextBox.Text = subdirectoryEntries[selectedid].Replace(_RootDir, "").Replace(Path.DirectorySeparatorChar.ToString(), ""); SelectMain.Close(); } //folderBrowserDialog1.SelectedPath = _RootDir + Path.DirectorySeparatorChar + TVShowFolderTextBox.Text + Path.DirectorySeparatorChar; //if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) //{ // string tempString = folderBrowserDialog1.SelectedPath; // TVShowFolderTextBox.Text = tempString.Replace(_RootDir, "").Replace(Path.DirectorySeparatorChar.ToString(), ""); //}//end of if }
private void folderHDButton_Click(object sender, EventArgs e) { string[] subdirectoryEntries = Directory.GetDirectories(_RootDir); new List <string>(subdirectoryEntries); SelectMenu SelectMain = new SelectMenu(new List <string>(subdirectoryEntries), showNameTextBox.Text, "Select TV Show Folder"); if (SelectMain.ShowDialog() == DialogResult.OK) { int selectedid = SelectMain.selected; if (selectedid == -1) { return; } TVShowFolderHDTextBox.Text = subdirectoryEntries[selectedid].Replace(_RootDir, "").Replace(Path.DirectorySeparatorChar.ToString(), ""); SelectMain.Close(); } }
private void buttonAddShow_Click(object sender, EventArgs e) { string tvShowName = string.Empty; if (InputBox.Show("Edit Episode Title", "Episode Title:", ref tvShowName) == DialogResult.OK) { string[] subdirectoryEntries = Directory.GetDirectories(_RootDir); new List <string>(subdirectoryEntries); SelectMenu SelectMain = new SelectMenu(new List <string>(subdirectoryEntries), showNameTextBox.Text, "Select TV Show Folder"); if (SelectMain.ShowDialog() == DialogResult.OK) { int selectedid = SelectMain.selected; if (selectedid == -1) { return; } string tvShowFolder = subdirectoryEntries[selectedid].Replace(_RootDir, "").Replace(Path.DirectorySeparatorChar.ToString(), ""); SelectMain.Close(); TVShowSettings newTvShow = new TVShowSettings(tvShowName, tvShowFolder); OnlineShowInfo newTVDBID = TVDB.findTitle(tvShowName, true); if (newTVDBID.ShowID != -1) { newTvShow.TVDBShowName = newTVDBID.ShowName; newTvShow.TVDBSeriesID = newTVDBID.ShowID; newTvShow.SeriesEnded = newTVDBID.ShowEnded; } OnlineShowInfo newTMDbID = TMDbClient.findTitle(tvShowName, true); if (newTMDbID.ShowID != -1) { newTvShow.TMDbShowName = newTMDbID.ShowName; newTvShow.TMDbSeriesID = newTMDbID.ShowID; newTvShow.SeriesEnded = newTMDbID.ShowEnded; } _MainTVShowList.Add(newTvShow); } } }
public static OnlineShowInfo findTitle(string ShowName, bool showAll = false) { List <OnlineShowInfo> selectionList = new List <OnlineShowInfo>(); OnlineShowInfo TVShowID = new OnlineShowInfo(); if (ShowName == null) { return(TVShowID); } //ShowName = ShowName.Replace("Gold Rush Alaska", "Gold Rush"); //ShowName = ShowName.Replace("Tosh 0", "Tosh.0"); List <OnlineShowInfo> FinalList = new List <OnlineShowInfo>(); try { XDocument ShowList = XDocument.Load("http://services.tvrage.com/feeds/search.php?show=" + ShowName); var Categorys = from Show in ShowList.Descendants("show") select new { ShowID = Show.Element("showid").Value, Name = Show.Element("name").Value, YearStarted = Show.Element("started").Value, Status = Show.Element("status").Value }; foreach (var wd in Categorys) { FinalList.Add(new OnlineShowInfo(wd.Name, Int32.Parse(wd.ShowID), wd.YearStarted, wd.Status)); } } catch (Exception e) { } if (FinalList != null && FinalList.Count > 0) { if (FinalList.Count() == 0) { return(TVShowID); //return if nothing found } OnlineShowInfo selectedShow = new OnlineShowInfo(); if (FinalList.Count() == 1) { selectedShow = FinalList[0]; } else { if (FinalList.Count() != 0) { int indexofTVshow = -1; int difference = Math.Abs(FinalList[0].ShowName.Length - ShowName.Length); indexofTVshow = FinalList[0].ShowName.IndexOf(ShowName, StringComparison.InvariantCultureIgnoreCase); if (indexofTVshow != -1 && difference < 3 && !showAll) { selectedShow = FinalList[0]; } else { SelectMenu SelectMain = new SelectMenu(FinalList, ShowName, "Select Correct TVRage Show"); if (SelectMain.ShowDialog() == DialogResult.OK) { int selectedid = SelectMain.selected; if (selectedid == -1) { return(TVShowID); } selectedShow = FinalList[selectedid]; SelectMain.Close(); } } } } if (selectedShow.ShowID == -1) { return(TVShowID); //return if nothing is found } TVShowID = selectedShow; } TVShowID.ShowName = TVShowID.ShowName.Replace(":", "").Replace("?", "").Replace("/", "").Replace("<", "").Replace(">", "").Replace("\\", "").Replace("*", "").Replace("|", "").Replace("\"", ""); return(TVShowID); }
public OnlineShowInfo findTitle(string ShowName, bool showAll = false) { if (ShowName == null) { return(new OnlineShowInfo()); } List <OnlineShowInfo> FinalList = new List <OnlineShowInfo>(); List <TvdbSearchResult> list = m_tvdbHandler.SearchSeries(ShowName); if (list != null && list.Count > 0) { for (int i = 0; i < list.Count(); i++) { if (list[i].Id != 0) { bool ended = (getStatus(list[i].Id) == "Ended") ? true : false; FinalList.Add(new OnlineShowInfo(list[i].SeriesName, list[i].Id, list[i].FirstAired.ToString("yyyy"), ended)); bool m = Regex.IsMatch(list[i].SeriesName, @"\(\d{1,4}\)", RegexOptions.IgnoreCase); if (m) { showAll = true; } } } } else { return(new OnlineShowInfo()); } if (FinalList != null && FinalList.Count > 0) { if (FinalList.Count() == 0) { return(new OnlineShowInfo()); //return if nothing found } if (FinalList.Count() == 1) { return(FinalList[0]); } else { if (FinalList.Count() != 0) { int indexofTVshow = -1; int difference = Math.Abs(removeSymbols(FinalList[0].ShowName).Length - removeSymbols(ShowName).Length); indexofTVshow = removeSymbols(FinalList[0].ShowName).IndexOf(removeSymbols(ShowName), StringComparison.InvariantCultureIgnoreCase); if (indexofTVshow != -1 && difference < 3 && !showAll) { return(FinalList[0]); //selectedTitle = FinalList[0].ShowName; } else { SelectMenu SelectMain = new SelectMenu(FinalList, ShowName, "Select Correct TVDB Show"); if (SelectMain.ShowDialog() == DialogResult.OK) { int selectedid = SelectMain.selected; if (selectedid == -1) { return(new OnlineShowInfo()); } //selectedShow = FinalList[selectedid]; //selectedTitle = FinalList[selectedid].Title; SelectMain.Close(); return(FinalList[selectedid]); } } } } } return(new OnlineShowInfo()); }
public OnlineShowInfo findTitle(string ShowName, bool showAll = false) { List <OnlineShowInfo> selectionList = new List <OnlineShowInfo>(); OnlineShowInfo TVShowID = new OnlineShowInfo(); if (ShowName == null) { return(TVShowID); } //ShowName = ShowName.Replace("Gold Rush Alaska", "Gold Rush"); //ShowName = ShowName.Replace("Tosh 0", "Tosh.0"); List <OnlineShowInfo> FinalList = new List <OnlineShowInfo>(); try { SearchContainer <TvShowBase> results = tmdbClient.SearchTvShow(ShowName); // Let's iterate the first few hits foreach (TvShowBase result in results.Results.Take(10)) { FinalList.Add(new OnlineShowInfo(result.Name, result.Id, result.FirstAirDate.Value.Year.ToString())); } } catch (Exception e) { } if (FinalList != null && FinalList.Count > 0) { if (FinalList.Count() == 0) { return(TVShowID); //return if nothing found } OnlineShowInfo selectedShow = new OnlineShowInfo(); if (FinalList.Count() == 1) { selectedShow = FinalList[0]; } else { if (FinalList.Count() != 0) { int indexofTVshow = -1; int difference = Math.Abs(FinalList[0].ShowName.Length - ShowName.Length); indexofTVshow = FinalList[0].ShowName.IndexOf(ShowName, StringComparison.InvariantCultureIgnoreCase); if (indexofTVshow != -1 && difference < 3 && !showAll) { selectedShow = FinalList[0]; } else { SelectMenu SelectMain = new SelectMenu(FinalList, ShowName, "Select Correct TMDb Show"); if (SelectMain.ShowDialog() == DialogResult.OK) { int selectedid = SelectMain.selected; if (selectedid == -1) { return(TVShowID); } selectedShow = FinalList[selectedid]; SelectMain.Close(); } } } } if (selectedShow.ShowID == -1) { return(TVShowID); //return if nothing is found } TVShowID = selectedShow; } try { TvShow result = tmdbClient.GetTvShow(TVShowID.ShowID); TVShowID.ShowEnded = !result.InProduction; } catch (Exception e) { } TVShowID.ShowName = TVShowID.ShowName.Replace(":", "").Replace("?", "").Replace("/", "").Replace("<", "").Replace(">", "").Replace("\\", "").Replace("*", "").Replace("|", "").Replace("\"", ""); return(TVShowID); }
public SearchInfo findTitle(string ShowName) { SearchInfo TVShowID = new SearchInfo(); if (ShowName == null) { return(TVShowID); } //ShowName = ShowName.Replace("Gold Rush Alaska", "Gold Rush"); //ShowName = ShowName.Replace("Tosh 0", "Tosh.0"); WebClient client = new WebClient(); client.DownloadFile("http://epguides.com/common/allshows.txt", folder + "/allshows.txt"); List <SearchInfo> TVShowList = parseCSV(folder + "/allshows.txt", ShowName); if (TVShowList != null && TVShowList.Count > 0) { if (TVShowList.Count() == 0) { return(TVShowID); //return if nothing found } if (TVShowList.Count() == 1) { return(TVShowList[0]); } else { if (selectionList.Count() == 0) { SelectMenu SelectMain = new SelectMenu(TVShowList, ShowName); if (SelectMain.ShowDialog() == DialogResult.OK) { int selectedid = SelectMain.selected; if (selectedid == -1) { return(TVShowID); } selectionList.Add(TVShowList[selectedid]); SearchInfo temp = TVShowList[selectedid]; SelectMain.Close(); return(temp); } } else { int idNumber = -1; foreach (SearchInfo testIdem in selectionList) { if (testIdem.Title == ShowName) { idNumber = testIdem.SelectedValue; break; } } if (idNumber == -1) { SelectMenu SelectMain = new SelectMenu(TVShowList, ShowName); if (SelectMain.ShowDialog() == DialogResult.OK) { int selectedid = SelectMain.selected; if (selectedid == -1) { return(TVShowID); } selectionList.Add(TVShowList[selectedid]); SearchInfo temp = TVShowList[selectedid]; SelectMain.Close(); return(temp); } } else { return(TVShowList[idNumber]); } } } } return(TVShowID); }