public void PopulateLanguages() { string deflang = ConfigurationManager.AppSettings ["sublanguage"]; var opensub = new OpenSubtitlesClient (); ArrayList langs = opensub.GetSubLanguages (); var langstore = new ListStore (typeof(string), typeof(string)); langstore.AppendValues ("All", "all"); int defrow = 0; int i = 1; foreach (Hashtable lang in langs) { langstore.AppendValues (lang ["LanguageName"].ToString (), (lang ["SubLanguageID"] ?? string.Empty).ToString ()); if (lang.ContainsValue (deflang)) defrow = i; i++; } languagebox.Model = langstore; TreeIter iter; languagebox.Model.IterNthChild (out iter, defrow); languagebox.SetActiveIter (iter); }
private void GetSubs() { var store = new NodeStore (typeof(MovieTreeNode)); statusbar1.Push (1, "Searching for filename."); var opensub = new OpenSubtitlesClient (); _subtitles = opensub.FileSearch (_fname, GetCurrentLang ()); statusbar1.Push (2, "Found " + _subtitles.Count + " titles"); if (_subtitles.Count > 0) { foreach (OpenSubtitlesClient.SearchResult sub in _subtitles) { var node = new MovieTreeNode { Title = sub.MovieName, Year = sub.MovieYear, Season = sub.SeriesSeason, Episode = sub.SeriesEpisode, Uploader = sub.UserNickName, Downloads = sub.SubDownloadsCnt, DownloadLink = sub.SubDownloadLink, AuthorCommments = sub.SubAuthorComment, SubAddDate = sub.SubAddDate.ToShortDateString(), ReleaseName = sub.MovieReleaseName, IMDBRating = sub.MovieImdbRating, SubRating = sub.SubRating, Lang = sub.SubLanguageID, Language = sub.LanguageName, SubFormat = sub.SubFormat, SubHearingImpaired = sub.SubHearingImpaired == "1", IDMovieImdb = sub.IDMovieImdb }; store.AddNode (node); } } MovieNodeView.NodeStore = store; DetailNode.NodeStore = null; MovieNodeView.ShowAll (); DetailNode.ShowAll (); TreeIter it; if (MovieNodeView.Model.GetIterFirst (out it)) { MovieNodeView.Selection.SelectIter (it); SetDetailView (); } else { Downloadbutton.Sensitive = false; } }