예제 #1
0
파일: MainWindow.cs 프로젝트: Koed00/Subby
 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);
 }
예제 #2
0
파일: MainWindow.cs 프로젝트: Koed00/Subby
    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;
        }
    }