private void SnipFiche() { pictureBox1.Image = null; lblYear.Text = "----"; if (ListeFilms.SelectedIndex != -1) { lblTitle.Text = "---- (" + TitleManipulator.HexIt(ListeFilms.SelectedItem.ToString()) + ")"; } else { lblTitle.Text = "----"; } lblDirector.Text = "-"; lblResume.Text = "-"; lblDuree.Text = "-"; lnklblFiche.Text = "-"; maxIndex = 0; lblGenres.Text = "-"; lblTotal.Text = "0"; lblPresse.Text = "-"; if (ListeFilms.SelectedIndex != -1) { if (!_cache.doesnotContainsFilmInfo(ListeFilms.SelectedItem.ToString())) { _cache.ResetFilmInfo(ListeFilms.SelectedItem.ToString()); } } }
private void DispatcherTimer_Tick(object sender, EventArgs e) { if (LastAction > Properties.Settings.Default.AFKDelay) { if (!_hasResetPotentials) { _hasResetPotentials = true; foreach (var window in _viewModel.AppTimes.SelectMany(appGroup => appGroup.Windows)) { window.PotentialSeconds = 0; } _viewModel.SetOrAddAppTime(_afkExe, 0, Properties.Settings.Default.AFKDelay + 1); } else { _viewModel.SetOrAddAppTime(_afkExe, 0); } _viewModel.UpdateProps(); return; } _hasResetPotentials = false; var curApp = Natives.GetFocusWindow(); if (curApp?.Title != null) { TitleManipulator.CleanTitle(ref curApp); _viewModel.SetOrAddAppTime(curApp, LastAction); } }
public static FilmInfo GetFromTitle(string title, int index) { FilmInfo ans = new FilmInfo(); string hexedTitle = TitleManipulator.HexIt(title); ans.HexedTitle = hexedTitle; ans.Key = title; ans.titre = currMovie.Title; ans.orig_titre = currMovie.OriginalTitle; ans.year = currMovie.ProductionYear.ToString(); if (currMovie.CastingShort != null) { ans.realisateur = currMovie.CastingShort.Directors; } if (currMovie.Statistics != null && currMovie.Statistics.PressRating != null) { ans.presse = (double)currMovie.Statistics.PressRating; } ans.totalInSearch = currCount; if (currMovie.LinkList != null && currMovie.LinkList.Count > 0) { ans.link = currMovie.LinkList[0].Href; } if (currMovie.Runtime != null) { ans.duree = TimeSpan.FromSeconds(int.Parse(currMovie.Runtime)).ToString(); } ans.genre = ""; if (currMovie.GenreList != null) { foreach (var genre in currMovie.GenreList) { ans.genre += genre.Value + ", "; } ans.genre = ans.genre.TrimEnd(' '); ans.genre = ans.genre.TrimEnd(','); } if (currMovie.SynopsisShort != null) { ans.synopsis = currMovie.SynopsisShort.Replace("<br />", "\n").Replace("<br/>", "\n"); ans.synopsis = noHTMLreg.Replace(ans.synopsis, ""); } if (currMovie.Poster != null) { ans.jaquette = BitmapFromWeb(currMovie.Poster.Href); ans.jaquetteTime = DateTime.Now; } return(ans); }
internal List <String> FilterSource(System.Windows.Forms.TextBox txtFiltre) { List <String> filteredSource = new List <string>(); foreach (string s in RawSource) { if ((_memory.ContainsKey(s) == true) && (_memory[s] != null)) { if (TitleManipulator.RemoveDiacritics(_memory[s].StringVal().ToLower()).Contains(TitleManipulator.RemoveDiacritics(txtFiltre.Text.ToLower()))) { filteredSource.Add(s); } } } return(filteredSource); }
public static FilmInfo GetFromTitleLight(string title, int index) { FilmInfo ans = new FilmInfo(); string hexedTitle = TitleManipulator.HexIt(title); ans.HexedTitle = hexedTitle; ans.Key = title; var alFeed = api.Search(hexedTitle, new[] { TypeFilters.Movie }); if (alFeed.MovieList != null && alFeed.MovieList.Count >= index) { currCount = alFeed.MovieList.Count; Movie apiMovie = alFeed.MovieList[index - 1]; apiMovie = api.MovieGetInfo(int.Parse(apiMovie.Code), ResponseProfiles.Large, new[] { TypeFilters.Movie }, new[] { "synopsis" }, new[] { MediaFormat.Mpeg2 }); if (apiMovie.Error != null) { throw new Exception(apiMovie.Error.Value); } ans.titre = apiMovie.Title; currMovie = apiMovie; } else { currCount = 0; if (alFeed.Error != null) { throw new Exception(alFeed.Error.Value); } } return(ans); }
private bool IsOK(FilmInfo finfo) { return(TitleManipulator.flattenString(finfo.titre).Contains(TitleManipulator.flattenString(finfo.HexedTitle)) || TitleManipulator.flattenString(finfo.orig_titre).Contains(TitleManipulator.flattenString(finfo.HexedTitle))); }
private void GetFilmInfos(bool bIsAuto) { try { _cache.PersistCache(); this.Cursor = Cursors.WaitCursor; FilmInfo finfo = null; if (ListeFilms.SelectedIndex != -1) { if (_cache.doesnotContainsFilmInfo(ListeFilms.SelectedItem.ToString())) { lblIndex.Text = currIndex.ToString(); finfo = AlloClient.GetFromTitleLight(ListeFilms.SelectedItem.ToString(), currIndex); if (finfo != null) { maxIndex = finfo.totalInSearch; if (bIsAuto) { if ((finfo.titre != null) && maxIndex > 1) { //Stop if the film is ok with the file title if (!IsOK(finfo)) { if (currIndex != maxIndex) { ++currIndex; btnPrev.Enabled = true; GetFilmInfos(true); } } } if (finfo.titre != null) { // Get the full info finfo = AlloClient.GetFromTitle(ListeFilms.SelectedItem.ToString(), currIndex); } } } } else { currIndex = 0; lblIndex.Text = currIndex.ToString(); finfo = _cache.GetInfo(ListeFilms.SelectedItem.ToString()); } } if (finfo != null) { pictureBox1.Image = finfo.jaquette; lblYear.Text = finfo.year; lblTitle.Text = finfo.titre + " (" + finfo.HexedTitle + ")"; lblDirector.Text = finfo.realisateur; lblResume.Text = finfo.synopsis; lblDuree.Text = finfo.duree; lblTotal.Text = finfo.totalInSearch.ToString(); lnklblFiche.Text = finfo.link; lblGenres.Text = TitleManipulator.AddSpacesToSentence(finfo.genre); lblPresse.Text = finfo.presse.ToString("0.0") + "/5"; } else { SnipFiche(); } if (ListeFilms.SelectedIndex != -1) { _cache.SetInfo(ListeFilms.SelectedItem.ToString(), finfo); } } catch (Exception e) { MessageBox.Show(e.Message); } finally { this.Cursor = Cursors.Arrow; } }