Beispiel #1
0
        public List <AnimeEpisodeVM> GetEpisodes()
        {
            List <AnimeEpisodeVM> eps = new List <AnimeEpisodeVM>();

            try
            {
                List <JMMServerBinary.Contract_AnimeEpisode> epContracts = JMMServerVM.Instance.clientBinaryHTTP.GetEpisodesForFile(this.VideoLocalID,
                                                                                                                                    JMMServerVM.Instance.CurrentUser.JMMUserID);
                foreach (JMMServerBinary.Contract_AnimeEpisode epcontract in epContracts)
                {
                    AnimeEpisodeVM ep = new AnimeEpisodeVM(epcontract);
                    eps.Add(ep);
                }
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write(ex.ToString());
            }

            return(eps);
        }
        private ContextMenuAction ShowContextMenuGroup(string previousMenu)
        {
            GUIListItem currentitem = m_Facade.SelectedListItem;
              if (currentitem == null)
              return ContextMenuAction.Exit;
              AnimeGroupVM grp = currentitem.TVTag as AnimeGroupVM;
              if (grp == null)
              return ContextMenuAction.Exit;

              ContextMenu cmenu = new ContextMenu(grp.GroupName, previousmenu: previousMenu);

              if (grp.SubGroups.Count == 0)
              {
              cmenu.AddAction(grp.IsFave == 1 ? Translation.RemoveFromFavorites : Translation.AddToFavorites, () =>
              {
                  grp.IsFave = grp.IsFave == 1 ? 0 : 1;
                  grp.Save();
                  EvaluateVisibility();
              });
              }

              cmenu.AddAction(Translation.MarkAllAsWatched, () =>
              {
              foreach (AnimeSeriesVM ser in grp.AllSeries)
              {
                  if (ser.AnimeSeriesID.HasValue)
                      JMMServerHelper.SetWatchedStatusOnSeries(true, Int32.MaxValue, ser.AnimeSeriesID.Value);
              }
              LoadFacade();
              });
              cmenu.AddAction(Translation.MarkAllAsUnwatched, () =>
              {
              foreach (AnimeSeriesVM ser in grp.AllSeries)
              {
                  if (ser.AnimeSeriesID.HasValue)
                      JMMServerHelper.SetWatchedStatusOnSeries(false, Int32.MaxValue, ser.AnimeSeriesID.Value);
              }
              LoadFacade();
              });
              if (grp.AllSeries.Count == 1)
              {
              cmenu.AddAction(Translation.SeriesInformation, () => ShowAnimeInfoWindow(grp.AllSeries[0]));
              }
              History h = GetCurrent();
              if (h.Listing is GroupFilterVM)
              {
              GroupFilterVM gf = (GroupFilterVM) h.Listing;
              cmenu.Add(Translation.QuickSort + " ...", () =>
              {
                  string sortType = "";
                  GroupFilterSortDirection sortDirection = GroupFilterSortDirection.Asc;
                  if (gf.GroupFilterID.HasValue)
                  {
                      if (GroupFilterQuickSorts.ContainsKey(gf.GroupFilterID.Value))
                          sortDirection = GroupFilterQuickSorts[gf.GroupFilterID.Value].SortDirection;
                      if (!Utils.DialogSelectGFQuickSort(ref sortType, ref sortDirection, gf.GroupFilterName))
                      {
                          if (!GroupFilterQuickSorts.ContainsKey(gf.GroupFilterID.Value))
                              GroupFilterQuickSorts[gf.GroupFilterID.Value] = new QuickSort();
                          GroupFilterQuickSorts[gf.GroupFilterID.Value].SortType = sortType;
                          GroupFilterQuickSorts[gf.GroupFilterID.Value].SortDirection = sortDirection;
                          LoadFacade();
                          return ContextMenuAction.Exit;
                      }
                  }
                  return ContextMenuAction.Continue;
              });
              if ((gf.GroupFilterID.HasValue) && (GroupFilterQuickSorts.ContainsKey(gf.GroupFilterID.Value)))
              {
                  cmenu.AddAction(Translation.RemoveQuickSort, () =>
                  {
                      GroupFilterQuickSorts.Remove(gf.GroupFilterID.Value);
                      LoadFacade();
                  });
              }
              }

              // ReSharper disable ImplicitlyCapturedClosure
              cmenu.AddAction(Translation.RandomSeries, () =>
              // ReSharper restore ImplicitlyCapturedClosure
              {
              RandomWindow_CurrentEpisode = null;
              RandomWindow_CurrentSeries = null;
              RandomWindow_LevelObject = grp;
              RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.Group;
              RandomWindow_RandomType = RandomObjectType.Series;
              GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
              });
              // ReSharper disable ImplicitlyCapturedClosure
              cmenu.AddAction(Translation.RandomEpisode, () =>
              // ReSharper restore ImplicitlyCapturedClosure
              {
              RandomWindow_CurrentEpisode = null;
              RandomWindow_CurrentSeries = null;
              RandomWindow_LevelObject = grp;
              RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.Group;
              RandomWindow_RandomType = RandomObjectType.Episode;
              GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
              });

              cmenu.Add(Translation.AdvancedOptions + " ...", () => ShowContextMenuAdvancedOptionsGroup(grp.GroupName));

              return cmenu.Show();
        }
Beispiel #3
0
 public AnimeEpisodeTypeVM(AnimeSeriesVM series, AnimeEpisodeVM ep)
 {
     AnimeSeries = series;
     EpisodeType = (enEpisodeType)ep.EpisodeType;
     EpisodeTypeDescription = AnimeEpisodeTypeVM.EpisodeTypeTranslated(EpisodeType);
 }
        public void loadPlayingPreset(AnimeEpisodeVM curEpisode, string fileName)
        {
            debug("Loading preset for episode: " + curEpisode.EpisodeName);
            List<VideoDetailedVM> fileLocals = curEpisode.FilesForEpisode;

            FileFfdshowPresetVM fileFfdshowPreset = null;
            foreach (VideoDetailedVM fileLocal in fileLocals)
            {
                if (fileLocal.Uri.ToUpper() == fileName.ToUpper())
                {
                    fileFfdshowPreset = fileLocal.FileFfdshowPreset;
                    break;
                }
            }

            if (fileFfdshowPreset != null && fileFfdshowPreset.Preset != null && fileFfdshowPreset.Preset != "")
            {
                debug("Found preset for episode \"" + curEpisode.EpisodeName + "\", preset name is: \"" + fileFfdshowPreset.Preset + "\"");
                debug("Episode file name is: " + fileName);
                AnimePluginSettings settings = new AnimePluginSettings();
                if (settings.FfdshowNotificationsLock)
                {
                    Thread.Sleep(settings.FfdshowNotificationsLockTime); //make sure ffdshow has time to load
                }

                // Retrieve the ffdshow instance corresponding to the file name
                //                FFDShowAPI.FFDShowAPI ffdshowAPI = new FFDShowAPI.FFDShowAPI(fileName, FFDShowAPI.FFDShowAPI.FileNameMode.FileName);  <- currently doesn't work
                //                FFDShowAPI.FFDShowAPI ffdshowAPI = new FFDShowAPI.FFDShowAPI();  <- retrieve only the first ffdshow instance
                FFDShowAPI.FFDShowAPI ffdshowAPI = new FFDShowAPI.FFDShowAPI();

                List<FFDShowAPI.FFDShowAPI.FFDShowInstance> ffdshowInstances = FFDShowAPI.FFDShowAPI.getFFDShowInstances();
                if (ffdshowInstances == null || ffdshowInstances.Count == 0)
                {
                    BaseConfig.MyAnimeLog.Write("FFDShow Error: be sure you have \"ffdshow raw video filter\" added and check in [MediaPortal Configuration -> Videos -> Video Post Processing] and you have in your ffdshow raw configuration: - checked keyboard shortcuts - checked remote API - choosen Custom 32786");
                    return;
                }

                debug("FFDShow number of instance found: " + ffdshowInstances.Count);
                for (int i = 0; i < ffdshowInstances.Count; i++)
                {
                    if (ffdshowInstances[i].fileName == null || ffdshowInstances[i].fileName.Trim() == "") // ffdshow raw doesn't have filename
                    {
                        debug("FFDShow instance without file name found (raw ffdshow)");
                        ffdshowAPI = new FFDShowAPI.FFDShowAPI(ffdshowInstances[i].handle);
                        if (ffdshowAPI == null)
                        {
                            BaseConfig.MyAnimeLog.Write("FFDShow Error: be sure you have \"ffdshow raw video filter\" added and check in [MediaPortal Configuration -> Videos -> Video Post Processing] and you have in your ffdshow raw configuration: - checked keyboard shortcuts - checked remote API - choosen Custom 32786");
                            return;
                        }
                        break;
                    }

                }

                bool isFFDShowActive = ffdshowAPI.checkFFDShowActive();
                if (isFFDShowActive)
                {
                    debug("FFDShow has been found (" + ffdshowAPI.FFDShowAPIRemote + " handle used)");
                    debug("FFDShow file played: " + ffdshowAPI.getFileName());
                    try
                    {
                        ffdshowAPI.ActivePreset = fileFfdshowPreset.Preset;
                        DialogInfo("Set ffdshow raw preset:", "\n\"" + fileFfdshowPreset.Preset + "\"");
                        debug("ffdshow raw preset set: " + fileFfdshowPreset.Preset);
                    }
                    catch (Exception ex)
                    {
                        debug("Error while setting ffdshow preset : " + ex.Message + "\n" + ex.StackTrace.ToString());
                    }
                }
                else
                {
                    debug("FFDShow has not been found (" + ffdshowAPI.FFDShowAPIRemote + " handle used)");
                    return;
                }

            }
            else
            {
                debug("Preset not found for episode \"" + curEpisode.EpisodeName + "\"");

            }
        }
Beispiel #5
0
        public List<AnimeEpisodeVM> GetEpisodes()
        {
            List<AnimeEpisodeVM> eps = new List<AnimeEpisodeVM>();

            try
            {
                List<JMMServerBinary.Contract_AnimeEpisode> epContracts = JMMServerVM.Instance.clientBinaryHTTP.GetEpisodesForFile(this.VideoLocalID,
                    JMMServerVM.Instance.CurrentUser.JMMUserID);
                foreach (JMMServerBinary.Contract_AnimeEpisode epcontract in epContracts)
                {
                    AnimeEpisodeVM ep = new AnimeEpisodeVM(epcontract);
                    eps.Add(ep);
                }
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write(ex.ToString());
            }

            return eps;
        }
Beispiel #6
0
        public static String GetEpisodeImageAsFileName(AnimeEpisodeVM ep)
        {
            string imgFileName = ep.EpisodeImageLocation;
            BaseConfig.MyAnimeLog.Write("GetEpisodeImageAsFileName:: {0} : {1}", imgFileName, ep);

            return imgFileName;
        }
        private void SetEpisode(AnimeEpisodeVM ep)
        {
            if (ep == null) return;

            /*AniDB_AnimeVM anime = ep.AnimeSeries.AniDB_Anime;

            Dictionary<int, TvDB_EpisodeVM> dictTvDBEpisodes = anime.DictTvDBEpisodes;
            Dictionary<int, int> dictTvDBSeasons = anime.DictTvDBSeasons;
            Dictionary<int, int> dictTvDBSeasonsSpecials = anime.DictTvDBSeasonsSpecials;
            CrossRef_AniDB_TvDBVM tvDBCrossRef = anime.CrossRefTvDB;
            ep.SetTvDBInfo(dictTvDBEpisodes, dictTvDBSeasons, dictTvDBSeasonsSpecials, tvDBCrossRef);*/

            clearGUIProperty("Watching.Series.Title");
            clearGUIProperty("Watching.Series.Description");
            clearGUIProperty("Watching.Series.LastWatched");
            clearGUIProperty("Watching.Series.EpisodesAvailable");
            clearGUIProperty("Watching.Episode.Title");
            clearGUIProperty("Watching.Episode.AirDate");
            clearGUIProperty("Watching.Episode.RunTime");
            clearGUIProperty("Watching.Episode.FileInfo");
            clearGUIProperty("Watching.Episode.Overview");
            clearGUIProperty("Watching.Episode.Image");
            clearGUIProperty("Watching.Episode.Logos");

            setGUIProperty("Watching.Series.Title", ep.AnimeSeries.SeriesName);
            setGUIProperty("Watching.Series.Description", ep.AnimeSeries.Description);
            setGUIProperty("Watching.Series.LastWatched", ep.AnimeSeries.WatchedDate.HasValue ? ep.AnimeSeries.WatchedDate.Value.ToString("dd MMM yy", Globals.Culture) : "-");
            setGUIProperty("Watching.Series.EpisodesAvailable", ep.AnimeSeries.UnwatchedEpisodeCount.ToString());

            setGUIProperty("Watching.Episode.Title", ep.EpisodeNumberAndNameWithType);
            setGUIProperty("Watching.Episode.AirDate", ep.AirDateAsString);
            setGUIProperty("Watching.Episode.RunTime", Utils.FormatSecondsToDisplayTime(ep.AniDB_LengthSeconds));

            setGUIProperty("Watching.Series.Poster", ImageAllocator.GetSeriesImageAsFileName(ep.AnimeSeries, GUIFacadeControl.Layout.List));

            if (ep.EpisodeImageLocation.Length > 0)
                setGUIProperty("Watching.Episode.Image", ep.EpisodeImageLocation);

            try
            {
                Fanart fanart = new Fanart(ep.AnimeSeries);
                if (!string.IsNullOrEmpty(fanart.FileName))
                    setGUIProperty("Watching.Series.Fanart", fanart.FileName);
                else
                    setGUIProperty("Watching.Series.Fanart", "-");
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write(ep.AnimeSeries.SeriesName + " - "  + ex.ToString());
            }

            // Overview
            string overview = ep.EpisodeOverview;
            if (BaseConfig.Settings.HidePlot)
            {
                if (ep.EpisodeOverview.Trim().Length > 0 && ep.IsWatched == 0)
                    overview = "*** Hidden to prevent spoilers ***";
            }
            setGUIProperty("Watching.Episode.Overview", overview);

            // File Info
            List<VideoDetailedVM>  filesForEpisode = new List<VideoDetailedVM>();
            List<JMMServerBinary.Contract_VideoDetailed> contracts = JMMServerVM.Instance.clientBinaryHTTP.GetFilesForEpisode(ep.AnimeEpisodeID,
                JMMServerVM.Instance.CurrentUser.JMMUserID);

            foreach (JMMServerBinary.Contract_VideoDetailed fi in contracts)
                filesForEpisode.Add(new VideoDetailedVM(fi));

            string finfo = "";
            foreach (VideoDetailedVM vid in filesForEpisode)
                finfo = vid.FileSelectionDisplay;

            if (filesForEpisode.Count > 1)
                finfo = filesForEpisode.Count.ToString() + " Files Available";

            setGUIProperty("Watching.Episode.FileInfo", finfo);

            // Logos
            string logos = Logos.buildLogoImage(ep);

            BaseConfig.MyAnimeLog.Write(logos);
            setGUIProperty("Watching.Episode.Logos", logos);
        }
        protected override void OnShowContextMenu()
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
            if (currentitem == null) return;

            if (currentitem.TVTag.GetType() == typeof(AnimeEpisodeVM))
            {
                AnimeEpisodeVM ep = currentitem.TVTag as AnimeEpisodeVM;
                if (ep != null)
                {
                    GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                    if (dlg == null)
                        return;

                    dlg.Reset();
                    dlg.SetHeading(ep.EpisodeNumberAndName);
                    dlg.Add("Mark as Watched");
                    dlg.Add("Play Previous Episode");
                    dlg.Add("Go To Episode List");
                    dlg.Add("View Series Info");

                    dlg.DoModal(GUIWindowManager.ActiveWindow);

                    switch (dlg.SelectedLabel)
                    {
                        case 0:
                            ep.ToggleWatchedStatus(true);
                            LoadData();
                            break;

                        case 1:
                            if (ep.AnimeSeries == null) return;
                            JMMServerBinary.Contract_AnimeEpisode contract = JMMServerVM.Instance.clientBinaryHTTP.GetPreviousEpisodeForUnwatched(ep.AnimeSeries.AnimeSeriesID.Value,
                                JMMServerVM.Instance.CurrentUser.JMMUserID);

                            if (contract == null)
                            {
                                Utils.DialogMsg("Error", "Previous episode not found");
                                return;
                            }
                            AnimeEpisodeVM epPrev = new AnimeEpisodeVM(contract);
                            MainWindow.vidHandler.ResumeOrPlay(epPrev);
                            break;

                        case 2:

                            if (ep.AnimeSeries == null) return;
                            MainWindow.curGroupFilter = GroupFilterHelper.AllGroupsFilter;

                            // find the group for this series
                            AnimeGroupVM grp = JMMServerHelper.GetGroup(ep.AnimeSeries.AnimeGroupID);
                            if (grp == null)
                            {
                                BaseConfig.MyAnimeLog.Write("Group not found");
                                return;
                            }
                            MainWindow.curAnimeGroup = grp;
                            MainWindow.curAnimeGroupViewed = grp;
                            MainWindow.curAnimeSeries = ep.AnimeSeries;

                            bool foundEpType = false;
                            foreach (AnimeEpisodeTypeVM anEpType in ep.AnimeSeries.EpisodeTypesToDisplay)
                            {
                                if (anEpType.EpisodeType == enEpisodeType.Episode)
                                {
                                    MainWindow.curAnimeEpisodeType = anEpType;
                                    foundEpType = true;
                                    break;
                                }
                            }

                            if (!foundEpType) return;

                            MainWindow.listLevel = Listlevel.Episode;
                            GUIWindowManager.ActivateWindow(Constants.WindowIDs.MAIN, false);

                            break;

                        case 3:

                            if (ep.AnimeSeries == null) return;
                            MainWindow.GlobalSeriesID = ep.AnimeSeries.AnimeSeriesID.Value;
                            GUIWindowManager.ActivateWindow(Constants.WindowIDs.ANIMEINFO, false);

                            break;

                    }
                }
            }
        }
Beispiel #9
0
        void PlaybackOperationEnded(bool countAsWatched, AnimeEpisodeVM ep)
        {
            try
            {
                if (ep == null)
                    return;

                if (ep != null)
                    ep.IncrementEpisodeStats(StatCountType.Stopped);

                //save watched status
                if (countAsWatched || ep.IsWatched == 1)
                {
                    //MPTVSeriesLog.Write("This episode counts as watched");
                    if (countAsWatched)
                    {
                        BaseConfig.MyAnimeLog.Write("Marking episode as watched: " + ep.EpisodeNumberAndNameWithType);
                        MarkEpisodeAsWatched(ep);

                    }
                }

                SetGUIProperties(true); // clear GUI Properties
            }
            catch (Exception e)
            {
                BaseConfig.MyAnimeLog.Write("Error in VideoHandler.PlaybackOperationEnded: {0}", e.ToString());
            }
        }
Beispiel #10
0
 void MarkEpisodeAsWatched(AnimeEpisodeVM episode)
 {
     episode.ToggleWatchedStatus(true, false);
     MainWindow.animeSeriesIDToBeRated = episode.AnimeSeriesID;
 }
Beispiel #11
0
        public bool ResumeOrPlay(AnimeEpisodeVM episode)
        {
            try
            {
                // get the list if FileLocal records for this AnimeEpisode
                List<VideoDetailedVM> fileLocalList = episode.FilesForEpisode;

                if (fileLocalList.Count == 0) return false;
                VideoDetailedVM fileToPlay = null;
                if (fileLocalList.Count == 1)
                    fileToPlay = fileLocalList[0];
                else
                {
                    // ask the user which file they want to play
                    IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                    dlg.Reset();
                    dlg.SetHeading("Select File");
                    GUIListItem pItem = null;

                    foreach (VideoDetailedVM fl in fileLocalList)
                    {
                        pItem = new GUIListItem(fl.FileSelectionDisplay);
                        dlg.Add(pItem);
                    }

                    dlg.DoModal(GUIWindowManager.ActiveWindow);

                    if (dlg.SelectedId > 0)
                    {
                        fileToPlay = fileLocalList[dlg.SelectedId - 1];
                    }

                }

                if (fileToPlay == null) return false;

                BaseConfig.MyAnimeLog.Write("Filetoplay: {0}", fileToPlay.FullPath);

                    if (!File.Exists(fileToPlay.FullPath))
                    {
                        Utils.DialogMsg("Error", "File could not be found!");
                        return false;
                    }
                    BaseConfig.MyAnimeLog.Write("Getting time stopped for : {0}", fileToPlay.FullPath);
                    timeMovieStopped = GetTimeStopped(fileToPlay.FullPath);
                    BaseConfig.MyAnimeLog.Write("Time stopped for : {0} - {1}", fileToPlay.FullPath, timeMovieStopped);

                    prevEpisode = curEpisode;
                    prevFileName = curFileName;

                    curEpisode = episode;
                    curFileName = fileToPlay.FullPath;

                #region Ask user to Resume
                if (timeMovieStopped > 0)
                {
                    //MPTVSeriesLog.Write("Asking user to resume episode from: " + Utils.SecondsToHMSString(timeMovieStopped));
                    GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);

                    if (null != dlgYesNo)
                    {
                        dlgYesNo.SetHeading(GUILocalizeStrings.Get(900)); //resume movie?
                        dlgYesNo.SetLine(1, episode.EpisodeName);
                        dlgYesNo.SetLine(2, GUILocalizeStrings.Get(936) + " " + MediaPortal.Util.Utils.SecondsToHMSString(timeMovieStopped));
                        dlgYesNo.SetDefaultToYes(true);
                        dlgYesNo.DoModal(GUIWindowManager.ActiveWindow);
                        if (!dlgYesNo.IsConfirmed) // reset resume data in DB
                        {
                            timeMovieStopped = 0;
                            //MPTVSeriesLog.Write("User selected to start episode from beginning", MPTVSeriesLog.LogLevel.Debug);
                        }
                    }
                }
                #endregion

                Play(timeMovieStopped, curEpisode.DefaultAudioLanguage, curEpisode.DefaultSubtitleLanguage);
                return true;
            }
            catch (Exception e)
            {
                BaseConfig.MyAnimeLog.Write("ResumeOrPlay: {0}", e.ToString());
                return false;
            }
        }
        public override void OnAction(MediaPortal.GUI.Library.Action action)
        {
            try
              {
            if (action != null && action.m_key != null)
            {
              //BaseConfig.MyAnimeLog.Write("Received action: {0} | keychar: {1}", action.wID, (char) (action.m_key.KeyChar));
            }
            else if (action != null)
            {
              //BaseConfig.MyAnimeLog.Write("Received action: {0}", action.wID);
            }

            if (GUIWindowManager.ActiveWindowEx != this.GetID)
            {
              return;
            }

            switch (action.wID)
            {
              case Action.ActionType.ACTION_SWITCH_HOME:
            string keyChar = "";
            if (action.m_key != null)
              keyChar = KeycodeToString(action.m_key.KeyChar);

            if (keyChar.ToLower() != "h" && !IsFilterActive())
            {
              ReturnToMPHome();
            }
            break;
              case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_DOWN:
              case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_UP:

            //Reset autoclose timer on search
            if (searchTimer != null && searchTimer.Enabled)
            {
              searchTimer.Stop();
              searchTimer.Start();
            }

            base.OnAction(action);
            break;
              case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_LEFT:
              case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_RIGHT:

            base.OnAction(action);
            break;
              case MediaPortal.GUI.Library.Action.ActionType.ACTION_REMOTE_RED_BUTTON:
            OnSearchAction(SearchAction.ToggleMode);
            return;

              case MediaPortal.GUI.Library.Action.ActionType.ACTION_REMOTE_BLUE_BUTTON:
            OnSearchAction(SearchAction.ToggleStartWord);
            return;

              case MediaPortal.GUI.Library.Action.ActionType.ACTION_KEY_PRESSED:
            KeyCommandHandler(action.m_key.KeyChar);
            return;

              case MediaPortal.GUI.Library.Action.ActionType.ACTION_PARENT_DIR:
            return;

              case MediaPortal.GUI.Library.Action.ActionType.ACTION_HOME:
            // BaseConfig.MyAnimeLog.Write("Basic home navgiation = " + BaseConfig.Settings.HomeButtonNavigation);

            if (BaseConfig.Settings.HomeButtonNavigation)
            {
              UpdateSearchPanel(false);
              ImageAllocator.FlushAll();
              GUIWindowManager.ShowPreviousWindow();
            }
            else
            {
              ReturnToMPHome();
            }
            break;

              case MediaPortal.GUI.Library.Action.ActionType.ACTION_PLAY:
            BaseConfig.MyAnimeLog.Write("Received PLAY action");

            try
            {
              IVM ivm = GetCurrent().Selected;
              if (ivm is AnimeGroupVM)
              {
                AnimeGroupVM grp = (AnimeGroupVM) ivm;
                JMMServerBinary.Contract_AnimeEpisode contract =
                  JMMServerVM.Instance.clientBinaryHTTP.GetNextUnwatchedEpisodeForGroup(grp.AnimeGroupID,
                    JMMServerVM.Instance.CurrentUser.JMMUserID);
                if (contract == null) return;
                AnimeEpisodeVM ep = new AnimeEpisodeVM(contract);
                vidHandler.ResumeOrPlay(ep);
              }

              if (ivm is AnimeSeriesVM)
              {
                AnimeSeriesVM ser = (AnimeSeriesVM) ivm;
                //ser = null;
                if ((!ser.AnimeSeriesID.HasValue)) return;
                JMMServerBinary.Contract_AnimeEpisode contract =
                  JMMServerVM.Instance.clientBinaryHTTP.GetNextUnwatchedEpisode(ser.AnimeSeriesID.Value,
                    JMMServerVM.Instance.CurrentUser.JMMUserID);
                if (contract == null) return;
                AnimeEpisodeVM ep = new AnimeEpisodeVM(contract);
                vidHandler.ResumeOrPlay(ep);
              }
            }
            catch (Exception ex)
            {
              BaseConfig.MyAnimeLog.Write(ex.ToString());
            }
            break;

              case MediaPortal.GUI.Library.Action.ActionType.ACTION_PREVIOUS_MENU:
            if (searchTimer != null && searchTimer.Enabled)
            {
              OnSearchAction(SearchAction.EndSearch);
              return;
            }

            // back one level

            //string msg = string.Format("LIST LEVEL:: {0} - GF: {1} ", listLevel, selectedGroupFilter?.GroupFilterName ?? "None");

            //					BaseConfig.MyAnimeLog.Write(msg);

            if (Breadcrumbs.Count == 1)
            {
              BaseConfig.MyAnimeLog.Write("Going HOME");
              goto case MediaPortal.GUI.Library.Action.ActionType.ACTION_HOME;
            }
            Breadcrumbs.Remove(Breadcrumbs[Breadcrumbs.Count - 1]);
            LoadFacade();
            break;

              default:
            base.OnAction(action);
            break;
            }
              }
              catch (Exception ex)
              {
            // On error we just let the action passthru
            BaseConfig.MyAnimeLog.Write("Error occured in OnAction(): " + ex);
            base.OnAction(action);
              }
        }
        private ContextMenuAction ShowContextMenuSeries(string previousMenu)
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
              if (currentitem == null)
            return ContextMenuAction.Exit;

              AnimeSeriesVM ser = currentitem.TVTag as AnimeSeriesVM;
              if (ser == null)
            return ContextMenuAction.Exit;

              ContextMenu cmenu = new ContextMenu(ser.SeriesName, previousmenu: previousMenu);
              cmenu.AddAction(Translation.SeriesInformation, () => ShowAnimeInfoWindow(ser));
              cmenu.AddAction(Translation.MarkAllAsWatched, () =>
              {
            if (ser.AnimeSeriesID.HasValue)
            {
              JMMServerHelper.SetWatchedStatusOnSeries(true, Int32.MaxValue, ser.AnimeSeriesID.Value);
              Contract_AnimeSeries contract = JMMServerVM.Instance.clientBinaryHTTP.GetSeries(ser.AnimeSeriesID.Value, JMMServerVM.Instance.CurrentUser.JMMUserID);
              if (contract != null)
              {
            AnimeSeriesVM serTemp = new AnimeSeriesVM(contract);
            if(serTemp != null)
              Utils.PromptToRateSeriesOnCompletion(serTemp);
              }
              LoadFacade();
            }
              });
              cmenu.AddAction(Translation.MarkAllAsUnwatched, () =>
              {
            if (ser.AnimeSeriesID.HasValue)
            {
              JMMServerHelper.SetWatchedStatusOnSeries(false, Int32.MaxValue, ser.AnimeSeriesID.Value);
              LoadFacade();
            }
              });
              cmenu.AddAction(Translation.RateSeries, () =>
              {
              if (ser == null)
              {
              BaseConfig.MyAnimeLog.Write("Error during rating = series was null!");
              }
              if (ser.AnimeSeriesID.HasValue)
              {
              Utils.PromptToRateSeriesMaually(ser);
              }
              });
              cmenu.Add(Translation.Databases + " ...", () => ShowContextMenuDatabases(ser, ser.SeriesName));
              cmenu.Add(Translation.Images + " ...", () => ShowContextMenuImages(ser.SeriesName));
              cmenu.Add(Translation.EditSeries + " ...", () => ShowContextMenuSeriesEdit(ser.SeriesName));
              // ReSharper disable ImplicitlyCapturedClosure
              cmenu.AddAction(Translation.RandomEpisode, () =>
              // ReSharper restore ImplicitlyCapturedClosure
              {
            RandomWindow_CurrentEpisode = null;
            RandomWindow_CurrentSeries = null;
            RandomWindow_LevelObject = ser;
            RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.Series;
            RandomWindow_RandomType = RandomObjectType.Episode;
            GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
              });
              cmenu.Add(Translation.PostProcessing + " ...", () => ShowContextMenuPostProcessing(ser.SeriesName));
              return cmenu.Show();
        }
        /*
        private bool ShowContextMenuSeriesInfo(string previousMenu)
        {
          GUIListItem currentitem = this.m_Facade.SelectedListItem;
          if (currentitem == null)
        return true;

          GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
          if (dlg == null)
        return true;

          //keep showing the dialog until the user closes it
          int selectedLabel = 0;
          string currentMenu = "Series Information";
          while (true)
          {
        dlg.Reset();
        dlg.SetHeading(currentMenu);

        if (previousMenu != string.Empty)
          dlg.Add("<<< " + previousMenu);
        dlg.Add("Characters/Actors");
        dlg.Add("Related Series");

        dlg.SelectedLabel = selectedLabel;
        dlg.DoModal(GUIWindowManager.ActiveWindow);
        selectedLabel = dlg.SelectedLabel;

        int selection = selectedLabel + ((previousMenu == string.Empty) ? 1 : 0);
        switch (selection)
        {
          case 0:
            //show previous
            return true;
          case 1:
            ShowCharacterWindow();
            return false;
          case 2:
            ShowRelationsWindow();
            return false;
          default:
            //close menu
            return false;
        }
          }
        }
        */
        private ContextMenuAction ShowContextMenuGroupFilter(string previousMenu)
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
              if (currentitem == null)
            return ContextMenuAction.Exit;

              GroupFilterVM gf = currentitem.TVTag as GroupFilterVM;
              if (gf == null)
            return ContextMenuAction.Exit;

              ContextMenu cmenu = new ContextMenu(gf.GroupFilterName, previousmenu: previousMenu);
              cmenu.AddAction(Translation.RandomSeries, () =>
              {
            RandomWindow_CurrentEpisode = null;
            RandomWindow_CurrentSeries = null;
            RandomWindow_LevelObject = gf;
            RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.GroupFilter;
            RandomWindow_RandomType = RandomObjectType.Series;
            GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
              });
              cmenu.AddAction(Translation.RandomEpisode, () =>
              {
            RandomWindow_CurrentEpisode = null;
            RandomWindow_CurrentSeries = null;
            RandomWindow_LevelObject = gf;
            RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.GroupFilter;
            RandomWindow_RandomType = RandomObjectType.Episode;
            GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
              });
              return cmenu.Show();
        }
Beispiel #15
0
        private bool ShowContextMenuSeries(string previousMenu)
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
            if (currentitem == null)
                return true;

            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
            if (dlg == null)
                return true;

            AnimeSeriesVM ser = currentitem.TVTag as AnimeSeriesVM;
            if (ser == null)
                return true;

            //keep showing the dialog until the user closes it
            int selectedLabel = 0;
            string currentMenu = ser.SeriesName;
            while (true)
            {
                dlg.Reset();
                dlg.SetHeading(currentMenu);

                if (previousMenu != string.Empty)
                    dlg.Add("<<< " + previousMenu);
                dlg.Add("Series Information");
                dlg.Add("Mark all as watched");
                dlg.Add("Mark all as unwatched");
                dlg.Add("Databases >>>");
                dlg.Add("Images >>>");
                dlg.Add("Edit Series >>>");
                dlg.Add("Random Episode");
                dlg.Add("Post-processing >>>");

                dlg.SelectedLabel = selectedLabel;
                dlg.DoModal(GUIWindowManager.ActiveWindow);
                selectedLabel = dlg.SelectedLabel;

                int selection = selectedLabel + ((previousMenu == string.Empty) ? 1 : 0);
                switch (selection)
                {
                    case 0:
                        //show previous
                        return true;
                    case 1:
                        ShowAnimeInfoWindow();
                        return false;
                    case 2: // Mark ALL as Watched
                        {
                            JMMServerHelper.SetWatchedStatusOnSeries(true, int.MaxValue, ser.AnimeSeriesID.Value);

                            JMMServerBinary.Contract_AnimeSeries contract = JMMServerVM.Instance.clientBinaryHTTP.GetSeries(ser.AnimeSeriesID.Value,
                                JMMServerVM.Instance.CurrentUser.JMMUserID);
                            if (contract != null)
                            {
                                AnimeSeriesVM serTemp = new AnimeSeriesVM(contract);
                                Utils.PromptToRateSeriesOnCompletion(serTemp);
                            }

                            LoadFacade();
                            return false;
                        }

                    case 3: // Mark ALL as Unwatched
                        {
                            JMMServerHelper.SetWatchedStatusOnSeries(false, int.MaxValue, ser.AnimeSeriesID.Value);
                            LoadFacade();
                            return false;
                        }
                    case 4:
                        if (!ShowContextMenuDatabases(ser, currentMenu))
                            return false;
                        break;
                    case 5:
                        if (!ShowContextMenuImages(currentMenu))
                            return false;
                        break;
                    case 6:
                        if (!ShowContextMenuSeriesEdit(currentMenu))
                            return false;
                        break;
                    case 7:
                        RandomWindow_CurrentEpisode = null;
                        RandomWindow_CurrentSeries = null;

                        RandomWindow_LevelObject = ser;
                        RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.Series;
                        RandomWindow_RandomType = RandomObjectType.Episode;

                        GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
                        return false;

                    case 8:
                        if (!ShowContextMenuPostProcessing(currentMenu))
                            return false;
                        break;

                    default:
                        //close menu
                        return false;
                }
            }
        }
Beispiel #16
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if (actionType == MediaPortal.GUI.Library.Action.ActionType.ACTION_MOUSE_DOUBLECLICK)
            {
                OnShowContextMenu();
                return;
            }

            if (actionType == MediaPortal.GUI.Library.Action.ActionType.ACTION_PLAY)
            {
                if (MediaPortal.Player.g_Player.Playing == false)
                    BaseConfig.MyAnimeLog.Write("Pressed the play button");
            }

            if (this.btnDisplayOptions != null && control == this.btnDisplayOptions)
            {
                hook.IsEnabled = false;

                ShowDisplayOptionsMenu("");
                btnDisplayOptions.Focus = false;

                Thread.Sleep(100); //make sure key-up's from the context menu aren't cought by the hook
                hook.IsEnabled = true;

                this.btnDisplayOptions.IsFocused = false;

                return;
            }

            if (this.btnWindowUtilities != null && control == this.btnWindowUtilities)
            {
                SetGlobalIDs();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.ADMIN);

                this.btnWindowUtilities.IsFocused = false;

                return;
            }

            if (this.btnWindowCalendar != null && control == this.btnWindowCalendar)
            {
                SetGlobalIDs();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.CALENDAR);
                //GUIWindowManager.ActivateWindow(Constants.WindowIDs.BROWSER);

                this.btnWindowCalendar.IsFocused = false;

                return;
            }

            if (this.btnWindowDownloads != null && control == this.btnWindowDownloads)
            {
                SetGlobalIDs();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.DOWNLOADS);

                this.btnWindowDownloads.IsFocused = false;
                return;
            }

            if (this.btnWindowContinueWatching != null && control == this.btnWindowContinueWatching)
            {
                SetGlobalIDs();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.WATCHING);

                this.btnWindowContinueWatching.IsFocused = false;
                return;
            }

            if (this.btnWindowRecommendations != null && control == this.btnWindowRecommendations)
            {
                SetGlobalIDs();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.RECOMMENDATIONS);

                this.btnWindowRecommendations.IsFocused = false;
                return;
            }

            if (this.btnWindowRandom != null && control == this.btnWindowRandom)
            {

                RandomWindow_LevelObject = GroupFilterHelper.AllGroupsFilter;
                RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.GroupFilter;
                RandomWindow_RandomType = RandomObjectType.Series;

                GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);

                this.btnWindowRandom.IsFocused = false;
                return;
            }

            if (this.btnChangeLayout != null && control == this.btnChangeLayout)
            {
                ShowLayoutMenu("");
                this.btnChangeLayout.IsFocused = false;
                return;
            }

            if (this.btnSwitchUser != null && control == this.btnSwitchUser)
            {
                if (JMMServerVM.Instance.PromptUserLogin())
                {
                    listLevel = Listlevel.GroupFilter;
                    curAnimeEpisode = null;
                    curAnimeGroup = null;
                    curAnimeSeries = null;
                    curGroupFilter = null;

                    // user has logged in, so save to settings so we will log in as the same user next time
                    settings.CurrentJMMUserID = JMMServerVM.Instance.CurrentUser.JMMUserID.ToString();
                    settings.Save();

                    LoadFacade();
                }

                this.btnSwitchUser.IsFocused = false;
                return;
            }

            if (this.btnSettings != null && control == this.btnSettings)
            {
                hook.IsEnabled = false;

                ShowOptionsDisplayMenu("");
                btnDisplayOptions.Focus = false;

                Thread.Sleep(100); //make sure key-up's from the context menu aren't cought by the hook
                hook.IsEnabled = true;

                this.btnSettings.IsFocused = false;

                return;
            }

            try
            {
                if (actionType != MediaPortal.GUI.Library.Action.ActionType.ACTION_SELECT_ITEM) return; // some other events raised onClicked too for some reason?
                if (control == this.m_Facade)
                {
                    UpdateSearchPanel(false);

                    if (this.m_Facade.SelectedListItem == null || this.m_Facade.SelectedListItem.TVTag == null)
                        return;

                    switch (listLevel)
                    {
                        case Listlevel.GroupFilter:
                            curGroupFilter = this.m_Facade.SelectedListItem.TVTag as GroupFilterVM;
                            if (curGroupFilter == null) return;

                            if (curGroupFilter.GroupFilterID.Value == Constants.StaticGF.Predefined)
                            {
                                listLevel = Listlevel.GroupFilterSub;
                                curGroupFilterSub2 = null;
                                curGroupFilterSub = null;
                            }
                            else
                            {
                                listLevel = Listlevel.Group;
                                curGroupFilterSub2 = null;
                                curGroupFilterSub = null;
                            }

                            LoadFacade();
                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.GroupFilterSub:
                            curGroupFilterSub = this.m_Facade.SelectedListItem.TVTag as GroupFilterVM;
                            if (curGroupFilterSub == null) return;

                            curGroupFilterSub2 = null;
                            listLevel = Listlevel.GroupFilterSub2;

                            LoadFacade();
                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.GroupFilterSub2:
                            curGroupFilterSub2 = this.m_Facade.SelectedListItem.TVTag as GroupFilterVM;
                            if (curGroupFilterSub2 == null) return;

                            listLevel = Listlevel.Group;

                            LoadFacade();
                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.Group:
                            curAnimeGroup = this.m_Facade.SelectedListItem.TVTag as AnimeGroupVM;
                            if (curAnimeGroup == null) return;
                            curAnimeGroupViewed = curAnimeGroup;

                            // e.g. if there is only one series for the group, show the episode types
                            // if there is only for episode type for the series show the episodes
                            ShowChildrenLevelForGroup();

                            LoadFacade();
                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.Series:

                            if (this.m_Facade.SelectedListItem.TVTag == null) return;

                            // sub groups
                            if (this.m_Facade.SelectedListItem.TVTag.GetType() == typeof(AnimeGroupVM))
                            {
                                curAnimeGroup = this.m_Facade.SelectedListItem.TVTag as AnimeGroupVM;
                                if (curAnimeGroup == null) return;
                                curAnimeGroupViewed = curAnimeGroup;

                                ShowChildrenLevelForGroup();
                            }
                            else if (this.m_Facade.SelectedListItem.TVTag.GetType() == typeof(AnimeSeriesVM))
                            {
                                curAnimeSeries = this.m_Facade.SelectedListItem.TVTag as AnimeSeriesVM;
                                if (curAnimeSeries == null) return;

                                ShowChildrenLevelForSeries();
                            }

                            LoadFacade();
                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.EpisodeTypes:
                            curAnimeEpisodeType = this.m_Facade.SelectedListItem.TVTag as AnimeEpisodeTypeVM;
                            if (curAnimeEpisodeType == null) return;

                            listLevel = Listlevel.Episode;
                            SetFanartForEpisodes();
                            LoadFacade();

                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.Episode:
                            this.curAnimeEpisode = this.m_Facade.SelectedListItem.TVTag as AnimeEpisodeVM;
                            if (curAnimeEpisode == null) return;

                            BaseConfig.MyAnimeLog.Write("Selected to play: {0}", curAnimeEpisode.EpisodeNumberAndName);
                            vidHandler.ResumeOrPlay(curAnimeEpisode);

                            break;
                    }
                }
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("Error in OnClicked: {0} - {1}", ex.Message, ex.ToString());
            }

            base.OnClicked(controlId, control, actionType);
        }
Beispiel #17
0
        public bool ResumeOrPlay(VideoLocalVM fileToPlay)
        {
            try
            {
                curEpisode = null;

                int timeMovieStopped = 0;
                if (!File.Exists(fileToPlay.FullPath))
                {
                    Utils.DialogMsg("Error", "File could not be found!");
                    return false;
                }

                BaseConfig.MyAnimeLog.Write("Getting time stopped for : {0}", fileToPlay.FullPath);
                timeMovieStopped = GetTimeStopped(fileToPlay.FullPath);
                BaseConfig.MyAnimeLog.Write("Time stopped for : {0} - {1}", fileToPlay.FullPath, timeMovieStopped);

                curFileName = fileToPlay.FullPath;

                #region Ask user to Resume
                if (timeMovieStopped > 0)
                {
                    GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);

                    if (null != dlgYesNo)
                    {
                        dlgYesNo.SetHeading(GUILocalizeStrings.Get(900)); //resume movie?
                        dlgYesNo.SetLine(1, fileToPlay.FileName);
                        dlgYesNo.SetLine(2, GUILocalizeStrings.Get(936) + " " + MediaPortal.Util.Utils.SecondsToHMSString(timeMovieStopped));
                        dlgYesNo.SetDefaultToYes(true);
                        dlgYesNo.DoModal(GUIWindowManager.ActiveWindow);
                        if (!dlgYesNo.IsConfirmed) // reset resume data in DB
                        {
                            timeMovieStopped = 0;
                        }
                    }
                }
                #endregion

                Play(timeMovieStopped, fileToPlay.DefaultAudioLanguage, fileToPlay.DefaultSubtitleLanguage);
                return true;
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("Error inResumeOrPlay : {0}", ex.ToString());
            }
            return false;
        }
Beispiel #18
0
        void getDataWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            List<AnimeEpisodeVM> tempEpisodes = new List<AnimeEpisodeVM>();
            List<JMMServerBinary.Contract_AnimeEpisode> epContracts = JMMServerVM.Instance.clientBinaryHTTP.GetContinueWatchingFilter(
                JMMServerVM.Instance.CurrentUser.JMMUserID, 25);

            foreach (JMMServerBinary.Contract_AnimeEpisode contract in epContracts)
            {
                AnimeEpisodeVM ep = new AnimeEpisodeVM(contract);

                AniDB_AnimeVM anime = ep.AnimeSeries.AniDB_Anime;
                ep.SetTvDBInfo(anime.TvSummary);

                tempEpisodes.Add(ep);
            }

            // just doing this to preload the series and anime data
            foreach (AnimeEpisodeVM ep in colEpisodes)
            {
                AniDB_AnimeVM anime = ep.AnimeSeries.AniDB_Anime;
            }

            e.Result = tempEpisodes;
        }
Beispiel #19
0
 public static void SearchEpisode(AnimeEpisodeVM ep)
 {
     MainWindow.currentDownloadSearch = new DownloadSearchCriteria(DownloadSearchType.Episode, ep);
     GUIWindowManager.ActivateWindow(Constants.WindowIDs.DOWNLOADS);
     return;
 }
Beispiel #20
0
        /*
        static string LogoSourceBluRay = mediaFolder + @"BLURAY.png";
        static string LogoSourceDVD = mediaFolder + @"DVD.png";

        static string LogoCodecX264 = mediaFolder + @"AVC.png";
        static string LogoCodecXVid = mediaFolder + @"XVID.png";
        static string LogoCodecDivx = mediaFolder + @"DIVX.png";
        static string LogoCodecMpeg2 = mediaFolder + @"MP2V.png";
        static string LogoCodecAVC = mediaFolder + @"AVC.png";

        static string LogoRes720 = mediaFolder + @"720p.png";
        static string LogoRes1080 = mediaFolder + @"1080p.png";

        static string LogoDim16x9 = mediaFolder + @"WIDESCREEN.png";
        static string LogoDim4x3 = mediaFolder + @"FULLSCREEN.png";
        */
        public static string buildLogoImage(AnimeEpisodeVM ep)
        {
            List<string> logosForBuilding = new List<string>();

            string bestSource = "";
            int bestWidth = 0;
            int bestHeight = 0;
            VideoDetailedVM bestFile = null;

            // blu-ray > dvd
            // dvd > hdtv
            // hdtv > dtv
            // dtv > tv
            // tv > vhs

            foreach (VideoDetailedVM vid in ep.FilesForEpisode)
            {
                //BaseConfig.MyAnimeLog.Write(vid.ToString());

                // get video width
                int videoWidth = vid.GetVideoWidth();
                int videoHeight = vid.GetVideoHeight();

                if (bestFile == null)
                {
                    bestFile = vid;
                    bestSource = vid.AniDB_File_Source;
                    bestWidth = videoWidth;
                    bestHeight = videoHeight;
                }
                else
                {
                    // get best source
                    if ((GetVideoSourceRanking(vid.AniDB_File_Source) > GetVideoSourceRanking(bestSource)) ||
                        (GetVideoSourceRanking(vid.AniDB_File_Source) == GetVideoSourceRanking(bestSource) && videoWidth > bestWidth))
                    {
                        bestFile = vid;
                        bestSource = vid.AniDB_File_Source;
                        bestWidth = videoWidth;
                        bestHeight = videoHeight;
                    }
                }
            }

            if (bestFile == null) return "";

            //MyAnimeLog.Write("Width: {0}, height: {1}", bestWidth, bestHeight);

            if (bestSource.ToUpper().Contains("BLU") && File.Exists(SkinSettings.LogoSourceBluray)) logosForBuilding.Add(SkinSettings.LogoSourceBluray);
            if (bestSource.ToUpper().Contains("DVD") && File.Exists(SkinSettings.LogoSourceDVD)) logosForBuilding.Add(SkinSettings.LogoSourceDVD);

            if (bestWidth >= 1280 && bestWidth < 1920 && File.Exists(SkinSettings.LogoRes720)) logosForBuilding.Add(SkinSettings.LogoRes720);
            if (bestWidth >= 1920 && File.Exists(SkinSettings.LogoRes1080)) logosForBuilding.Add(SkinSettings.LogoRes1080);

            if (bestFile.VideoCodec.ToUpper().Contains("H264") && File.Exists(SkinSettings.LogoCodecAVC))
                logosForBuilding.Add(SkinSettings.LogoCodecAVC);
            if (bestFile.VideoCodec.ToUpper().Contains("DIVX") && File.Exists(SkinSettings.LogoCodecDivx))
                logosForBuilding.Add(SkinSettings.LogoCodecDivx);
            if (bestFile.VideoCodec.ToUpper().Contains("XVID") && File.Exists(SkinSettings.LogoCodecDivx))
                logosForBuilding.Add(SkinSettings.LogoCodecDivx);

            if (bestWidth > 0 && bestHeight > 0)
            {
                double dim = (double)bestWidth / (double)bestHeight;
                if (dim > (double)1.4)
                {
                    if (File.Exists(SkinSettings.LogoWidescreen))
                        logosForBuilding.Add(SkinSettings.LogoWidescreen);
                }
                else
                {
                    if (File.Exists(SkinSettings.LogoFullscreen))
                        logosForBuilding.Add(SkinSettings.LogoFullscreen);
                }
            }

            return buildLogoImage(logosForBuilding, 800, 50);
        }
Beispiel #21
0
        private void Episode_OnItemSelected(GUIListItem item)
        {
            if (m_bQuickSelect)
                return;

            clearGUIProperty("Episode.MyRating");
            clearGUIProperty("Episode.AirDate");
            clearGUIProperty("Episode.Rating");
            clearGUIProperty("Episode.RawRating");
            clearGUIProperty("Episode.Length");
            clearGUIProperty("Episode.FileInfo");
            clearGUIProperty("Episode.EpisodeName");
            clearGUIProperty("Episode.EpisodeDisplayName");
            clearGUIProperty("Episode.Description");
            clearGUIProperty("Episode.Image");
            clearGUIProperty("Episode.SeriesTypeLabel");
            clearGUIProperty("Episode.EpisodeRomanjiName");
            clearGUIProperty("Episode.EpisodeEnglishName");
            clearGUIProperty("Episode.EpisodeKanjiName");
            clearGUIProperty("Episode.EpisodeRotator");
            if (item == null || item.TVTag == null || !(item.TVTag is AnimeEpisodeVM))
                return;

            AnimeEpisodeVM ep = item.TVTag as AnimeEpisodeVM;
            if (ep == null) return;

            curAnimeEpisode = ep;

            if (curAnimeEpisode.EpisodeImageLocation.Length > 0)
                setGUIProperty("Episode.Image", curAnimeEpisode.EpisodeImageLocation);

            if (!settings.HidePlot)
                setGUIProperty("Episode.Description", curAnimeEpisode.EpisodeOverview);
            else
            {
                if (curAnimeEpisode.EpisodeOverview.Trim().Length > 0 && ep.IsWatched == 0)
                    setGUIProperty("Episode.Description", "*** Hidden to prevent spoilers ***");
                else
                    setGUIProperty("Episode.Description", curAnimeEpisode.EpisodeOverview);
            }

            setGUIProperty("Episode.EpisodeName", curAnimeEpisode.EpisodeName);
            setGUIProperty("Episode.EpisodeDisplayName", curAnimeEpisode.DisplayName);
            setGUIProperty("Episode.SeriesTypeLabel", GetSeriesTypeLabel());

            setGUIProperty("Episode.AirDate", curAnimeEpisode.AirDateAsString);
            setGUIProperty("Episode.Length", Utils.FormatSecondsToDisplayTime(curAnimeEpisode.AniDB_LengthSeconds));

            setGUIProperty("Episode.Rating", curAnimeEpisode.AniDBRatingFormatted);
            //setGUIProperty("Episode.RawRating", Utils.FormatAniDBRating(curAnimeEpisode.AniDB_Rating));
            setGUIProperty("Episode.RawRating", curAnimeEpisode.AniDB_Rating);

            if (dummyIsWatched != null) dummyIsWatched.Visible = (ep.IsWatched == 1);

            if (dummyIsAvailable != null) dummyIsAvailable.Visible = true;
            // get all the LocalFile rceords for this episode
            List<VideoDetailedVM> fileLocalList = ep.FilesForEpisode;
            bool norepeat = true;
            string finfo = "";
            foreach (VideoDetailedVM vid in fileLocalList)
                finfo = vid.FileSelectionDisplay;

            if (fileLocalList.Count == 1)
            {
                setGUIProperty("Episode.FileInfo", finfo);
            }
            else if (fileLocalList.Count > 1)
            {
                setGUIProperty("Episode.FileInfo", fileLocalList.Count.ToString() + " Files Available");
            }
            else if (fileLocalList.Count == 0)
            {
                if (dummyIsAvailable != null) dummyIsAvailable.Visible = false;
            }

            string logos = Logos.buildLogoImage(ep);
            //MyAnimeLog.Write(logos);

            BaseConfig.MyAnimeLog.Write(logos);
            setGUIProperty(guiProperty.Logos, logos);
        }
Beispiel #22
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="item"></param>
        /// <param name="ep"></param>
        /// <returns>whether this episode has been watched</returns>
        private bool SetEpisodeListItem(ref GUIListItem item, AnimeEpisodeVM ep)
        {
            try
            {
                if (item == null)
                {
                    item = new GUIListItem();
                    item.Label = ep.EpisodeNumberAndName;
                    item.Label2 = " ";
                    item.DVDLabel = ep.EpisodeNumberAndName;
                    item.TVTag = ep;
                }

                // for each anime episode we may actually have one or more files
                // if one of the files has been watched we consider the episode watched

                View.eLabelStyleEpisodes style = settings.LabelStyleEpisodes;

                // get the AniDB_Episode info for this AnimeEpisode
                /*if (ep.AniDB_EpisodeID.HasValue)
                {
                    AniDB_Episode aniEp = new AniDB_Episode();
                    if (aniEp.Load(ep.AniDB_EpisodeID.Value))
                    {
                        string space = "";
                        if (style == View.eLabelStyleEpisodes.IconsDate)
                            item.Label3 = space + Utils.GetAniDBDateWithShortYear(aniEp.AirDate);
                    }
                }*/

                // get all the LocalFile records for this episode
                bool isWatched = (ep.IsWatched == 1);
                item.IsRemote = ep.LocalFileCount == 0;
                item.IsPlayed = isWatched;
                return isWatched;

            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("Failed to create episode item: {0}", ex);
                return false;
            }
        }
Beispiel #23
0
        private bool ShowContextMenuGroup(string previousMenu)
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
            if (currentitem == null)
                return true;

            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
            if (dlg == null)
                return true;

            AnimeGroupVM grp = currentitem.TVTag as AnimeGroupVM;
            if (grp == null)
                return true;

            int mnuPrev = -1;
            int mnuFave = -1;
            int mnuWatched = -1;
            int mnuUnwatched = -1;
            int mnuEdit = -1;
            int mnuQuickSort = -1;
            int mnuRemoveQuickSort = -1;
            int mnuDatabases = -1;
            int mnuImages = -1;
            int mnuSeries = -1;
            int mnuRandomSeries = -1;
            int mnuRandomEpisode = -1;
            int mnuPostProcessing = -1;

            //keep showing the dialog until the user closes it
            int selectedLabel = 0;
            string currentMenu = grp.GroupName;
            while (true)
            {
                int curMenu = -1;

                dlg.Reset();
                dlg.SetHeading(currentMenu);

                string faveText = "Add to Favorites";
                if (grp.IsFave == 1)
                    faveText = "Remove from Favorites";

                if (previousMenu != string.Empty)
                {
                    dlg.Add("<<< " + previousMenu);
                    curMenu++; mnuPrev = curMenu;
                }
                dlg.Add(faveText);
                curMenu++; mnuFave = curMenu;

                dlg.Add("Mark ALL as Watched");
                curMenu++; mnuWatched = curMenu;

                dlg.Add("Mark ALL as Unwatched");
                curMenu++; mnuUnwatched = curMenu;

                dlg.Add("Edit Group >>>");
                curMenu++; mnuEdit = curMenu;

                dlg.Add("Quick Sort >>>");
                curMenu++; mnuQuickSort = curMenu;

                if (GroupFilterQuickSorts.ContainsKey(curGroupFilter.GroupFilterID.Value))
                {
                    dlg.Add("Remove Quick Sort");
                    curMenu++; mnuRemoveQuickSort = curMenu;
                }

                if (grp.AllSeries.Count == 1)
                {
                    dlg.Add("Databases >>>");
                    curMenu++; mnuDatabases = curMenu;
                    dlg.Add("Images >>>");
                    curMenu++; mnuImages = curMenu;
                    dlg.Add("Series Information");
                    curMenu++; mnuSeries = curMenu;
                }

                dlg.Add("Random Series");
                curMenu++; mnuRandomSeries = curMenu;

                dlg.Add("Random Episode");
                curMenu++; mnuRandomEpisode = curMenu;

                dlg.Add("Post-processing >>>");
                curMenu++; mnuPostProcessing = curMenu;

                dlg.SelectedLabel = selectedLabel;
                dlg.DoModal(GUIWindowManager.ActiveWindow);
                selectedLabel = dlg.SelectedLabel;

                if (selectedLabel == mnuPrev) return true;
                if (selectedLabel == mnuFave)
                {
                    grp.IsFave = grp.IsFave == 1 ? 0 : 1;
                    grp.Save();

                    EvaluateVisibility();
                    return false;
                }

                if (selectedLabel == mnuWatched)
                {
                    foreach (AnimeSeriesVM ser in grp.AllSeries)
                        JMMServerHelper.SetWatchedStatusOnSeries(true, int.MaxValue, ser.AnimeSeriesID.Value);

                    LoadFacade();
                    return false;
                }

                if (selectedLabel == mnuUnwatched)
                {
                    foreach (AnimeSeriesVM ser in grp.AllSeries)
                        JMMServerHelper.SetWatchedStatusOnSeries(false, int.MaxValue, ser.AnimeSeriesID.Value);

                    LoadFacade();
                    return false;
                }

                if (selectedLabel == mnuEdit)
                {
                    if (!ShowContextMenuGroupEdit(currentMenu))
                        return false;
                }

                if (selectedLabel == mnuQuickSort)
                {
                    string sortType = "";
                    GroupFilterSortDirection sortDirection = GroupFilterSortDirection.Asc;
                    if (GroupFilterQuickSorts.ContainsKey(curGroupFilter.GroupFilterID.Value))
                        sortDirection = GroupFilterQuickSorts[curGroupFilter.GroupFilterID.Value].SortDirection;

                    if (!Utils.DialogSelectGFQuickSort(ref sortType, ref sortDirection, curGroupFilter.GroupFilterName))
                    {
                        if (!GroupFilterQuickSorts.ContainsKey(curGroupFilter.GroupFilterID.Value))
                            GroupFilterQuickSorts[curGroupFilter.GroupFilterID.Value] = new QuickSort();
                        GroupFilterQuickSorts[curGroupFilter.GroupFilterID.Value].SortType = sortType;
                        GroupFilterQuickSorts[curGroupFilter.GroupFilterID.Value].SortDirection = sortDirection;
                        LoadFacade();
                        return false;
                    }
                }

                if (selectedLabel == mnuRemoveQuickSort)
                {
                    GroupFilterQuickSorts.Remove(curGroupFilter.GroupFilterID.Value);
                    LoadFacade();
                    return false;
                }

                if (selectedLabel == mnuDatabases)
                {
                    if (!ShowContextMenuDatabases(grp.AllSeries[0], "Group Menu"))
                        return false;
                }

                if (selectedLabel == mnuImages)
                {
                    if (!ShowContextMenuImages(currentMenu))
                        return false;
                }

                if (selectedLabel == mnuSeries)
                {
                    ShowAnimeInfoWindow();
                    return false;
                }

                if (selectedLabel == mnuRandomSeries)
                {
                    RandomWindow_CurrentEpisode = null;
                    RandomWindow_CurrentSeries = null;

                    RandomWindow_LevelObject = grp;
                    RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.Group;
                    RandomWindow_RandomType = RandomObjectType.Series;

                    GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);

                    return false;
                }

                if (selectedLabel == mnuRandomEpisode)
                {
                    RandomWindow_CurrentEpisode = null;
                    RandomWindow_CurrentSeries = null;

                    RandomWindow_LevelObject = grp;
                    RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.Group;
                    RandomWindow_RandomType = RandomObjectType.Episode;

                    GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);

                    return false;
                }

                if (selectedLabel == mnuPostProcessing)
                {
                    ShowContextMenuPostProcessing(currentMenu);
                    return false;
                }

            }
        }
Beispiel #24
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if (MA3WindowManager.HandleWindowChangeButton(control))
                return;

            if (btnViewWatch != null && control == btnViewWatch)
            {
                this.btnViewWatch.IsFocused = false;
                m_Facade.Focus = true;

                if (dummyModeWatch != null) dummyModeWatch.Visible = true;
                if (dummyModeDownload != null) dummyModeDownload.Visible = false;

                setGUIProperty("Recommendations.CurrentView", "Watch");

                LoadData();
            }

            if (btnViewDownload != null && control == btnViewDownload)
            {
                this.btnViewDownload.IsFocused = false;
                m_Facade.Focus = true;

                if (dummyModeWatch != null) dummyModeWatch.Visible = false;
                if (dummyModeDownload != null) dummyModeDownload.Visible = true;

                setGUIProperty("Recommendations.CurrentView", "Download");

                LoadData();
            }

            if (this.btnGetMissingInfo != null && control == this.btnGetMissingInfo)
            {
                MainWindow.ServerHelper.DownloadRecommendedAnime();
                setGUIProperty("Recommendations.DownloadStatus", "Waiting on server...");
                GUIControl.FocusControl(GetID, 50);

                return;
            }

            if (control == this.m_Facade)
            {
                // show the files if we are looking at a torrent
                GUIListItem item = m_Facade.SelectedListItem;
                if (item == null || item.TVTag == null) return;
                if (item.TVTag.GetType() == typeof(RecommendationVM))
                {
                    RecommendationVM rec = item.TVTag as RecommendationVM;
                    if (rec != null)
                    {
                        if (dummyModeWatch != null && dummyModeWatch.Visible)
                        {
                            JMMServerBinary.Contract_AnimeEpisode ep = JMMServerVM.Instance.clientBinaryHTTP.GetNextUnwatchedEpisode(rec.Recommended_AnimeSeries.AnimeSeriesID.Value,
                            JMMServerVM.Instance.CurrentUser.JMMUserID);
                            if (ep != null)
                            {
                                AnimeEpisodeVM aniEp = new AnimeEpisodeVM(ep);
                                MainWindow.vidHandler.ResumeOrPlay(aniEp);
                            }
                            else
                            {
                                Utils.DialogMsg("Error", "Could not find the first episode");
                            }
                        }

                        if (dummyModeDownload != null && dummyModeDownload.Visible)
                        {
                            AniDB_AnimeVM recanime = rec.Recommended_AniDB_Anime;
                            if (recanime != null)
                            {
                                DownloadHelper.SearchAnime(recanime);
                            }
                        }
                    }

                }
            }

            base.OnClicked(controlId, control, actionType);
        }
Beispiel #25
0
        private bool ShowContextMenuGroupFilter(string previousMenu)
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
            if (currentitem == null)
                return true;

            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
            if (dlg == null)
                return true;

            GroupFilterVM gf = currentitem.TVTag as GroupFilterVM;
            if (gf == null)
                return true;

            int mnuPrev = -1;
            int mnuRandomSeries = -1;
            int mnuRandomEpisode = -1;

            //keep showing the dialog until the user closes it
            int selectedLabel = 0;
            string currentMenu = gf.GroupFilterName;
            while (true)
            {
                int curMenu = -1;

                dlg.Reset();
                dlg.SetHeading(currentMenu);

                if (previousMenu != string.Empty)
                {
                    dlg.Add("<<< " + previousMenu);
                    curMenu++; mnuPrev = curMenu;
                }
                dlg.Add("Random Series");
                curMenu++; mnuRandomSeries = curMenu;

                dlg.Add("Random Episode");
                curMenu++; mnuRandomEpisode = curMenu;

                dlg.SelectedLabel = selectedLabel;
                dlg.DoModal(GUIWindowManager.ActiveWindow);
                selectedLabel = dlg.SelectedLabel;

                if (selectedLabel == mnuPrev) return true;
                if (selectedLabel == mnuRandomSeries)
                {
                    RandomWindow_CurrentEpisode = null;
                    RandomWindow_CurrentSeries = null;

                    RandomWindow_LevelObject = gf;
                    RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.GroupFilter;
                    RandomWindow_RandomType = RandomObjectType.Series;

                    GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);

                    return false;
                }

                if (selectedLabel == mnuRandomEpisode)
                {
                    RandomWindow_CurrentEpisode = null;
                    RandomWindow_CurrentSeries = null;

                    RandomWindow_LevelObject = gf;
                    RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.GroupFilter;
                    RandomWindow_RandomType = RandomObjectType.Episode;

                    GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);

                    return false;
                }

            }
        }
 // ASync method to avoid mediaportal video treatment sleep
 public void loadPlayingPresetASync(AnimeEpisodeVM curEpisode, string fileName)
 {
     // Create an instance of the FFDShowHelper class.
     FFDShowHelper ffdshowHelper = new FFDShowHelper();
     // Create the delegate.
     AsyncloadPlayingPresetCaller caller = new AsyncloadPlayingPresetCaller(loadPlayingPreset);
     // Initiate the asychronous call.
     IAsyncResult result = caller.BeginInvoke(curEpisode, fileName, null, null);
     Thread.Sleep(0);
     debug("Main thread " + Thread.CurrentThread.ManagedThreadId + " does some work.");
     // Call EndInvoke to wait for the asynchronous call to complete,
     // and to retrieve the results.
     //            string returnValue = caller.EndInvoke(result);
     //            caller.EndInvoke(result);
 }
Beispiel #27
0
        public override void OnAction(MediaPortal.GUI.Library.Action action)
        {
            //BaseConfig.MyAnimeLog.Write("Received action: {0}/{1}", action.wID, (char)(action.m_key.KeyChar));

            switch (action.wID)
            {
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_DOWN:
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_UP:

                    //Reset autoclose timer on search
                    if (searchTimer.Enabled)
                    {
                        searchTimer.Stop();
                        searchTimer.Start();
                    }

                    base.OnAction(action);
                    break;
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_LEFT:
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_RIGHT:

                    base.OnAction(action);
                    break;
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_KEY_PRESSED:

                    //when the list is selected, search the input
                    if (GUIWindowManager.ActiveWindowEx == this.GetID)
                    {
                        if ((m_Facade.CurrentLayout == GUIFacadeControl.Layout.List && m_Facade.ListLayout.IsFocused)
                            || (m_Facade.CurrentLayout == GUIFacadeControl.Layout.LargeIcons && m_Facade.ThumbnailLayout.IsFocused)
                            || (m_Facade.CurrentLayout == GUIFacadeControl.Layout.Filmstrip && m_Facade.FilmstripLayout.IsFocused)
                            || (m_Facade.CurrentLayout == GUIFacadeControl.Layout.CoverFlow && m_Facade.CoverFlowLayout.IsFocused))
                            OnSearchChar((char)(action.m_key.KeyChar));
                    }
                    break;

                case MediaPortal.GUI.Library.Action.ActionType.ACTION_PARENT_DIR:
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_HOME:
                    UpdateSearchPanel(false);
                    ImageAllocator.FlushAll();
                    GUIWindowManager.ShowPreviousWindow();
                    break;

                case MediaPortal.GUI.Library.Action.ActionType.ACTION_PLAY:
                    BaseConfig.MyAnimeLog.Write("Received PLAY action");

                    try
                    {
                        if (listLevel == Listlevel.Group)
                        {
                            if (curAnimeGroup == null) return;
                            JMMServerBinary.Contract_AnimeEpisode contract = JMMServerVM.Instance.clientBinaryHTTP.GetNextUnwatchedEpisodeForGroup(curAnimeGroup.AnimeGroupID,
                                JMMServerVM.Instance.CurrentUser.JMMUserID);
                            if (contract == null) return;
                            AnimeEpisodeVM ep = new AnimeEpisodeVM(contract);
                            vidHandler.ResumeOrPlay(ep);
                        }

                        if (listLevel == Listlevel.Series)
                        {
                            //curAnimeSeries = null;
                            if (curAnimeSeries == null) return;
                            JMMServerBinary.Contract_AnimeEpisode contract = JMMServerVM.Instance.clientBinaryHTTP.GetNextUnwatchedEpisode(curAnimeSeries.AnimeSeriesID.Value,
                                JMMServerVM.Instance.CurrentUser.JMMUserID);
                            if (contract == null) return;
                            AnimeEpisodeVM ep = new AnimeEpisodeVM(contract);
                            vidHandler.ResumeOrPlay(ep);
                        }
                    }
                    catch (Exception ex)
                    {
                        BaseConfig.MyAnimeLog.Write(ex.ToString());
                    }
                    break;

                case MediaPortal.GUI.Library.Action.ActionType.ACTION_PREVIOUS_MENU:
                    if (searchTimer.Enabled)
                    {
                        OnSearchAction(SearchAction.EndSearch);
                        return;
                    }

                    // back one level
                    if (listLevel == Listlevel.GroupFilter)
                    {
                        goto case MediaPortal.GUI.Library.Action.ActionType.ACTION_HOME;
                    }
                    else
                    {
                        string msg = string.Format("LIST LEVEL:: {0} - GF: {1} - GFSub2: {2}", listLevel, curGroupFilter, curGroupFilterSub2);

                        BaseConfig.MyAnimeLog.Write(msg);
                        if (listLevel == Listlevel.GroupFilterSub)
                        {
                            listLevel = Listlevel.GroupFilter;
                            curGroupFilterSub = null;

                            LoadFacade();
                        }
                        if (listLevel == Listlevel.GroupFilterSub2)
                        {
                            // go back to GROUP FILTERS
                            listLevel = Listlevel.GroupFilterSub;
                            curGroupFilterSub2 = null;

                            LoadFacade();
                        }
                        if (listLevel == Listlevel.Group)
                        {
                            if (curGroupFilterSub2 == null)
                            {
                                // go back to GROUP FILTERS
                                listLevel = Listlevel.GroupFilter;
                            }
                            else
                            {
                                listLevel = Listlevel.GroupFilterSub2;
                            }
                            LoadFacade();
                            curAnimeGroup = null;
                        }

                        if (listLevel == Listlevel.Series)
                        {
                            // go back to GROUP
                            AnimeGroupVM parentGroup = curAnimeGroupViewed.ParentGroup;
                            if (parentGroup == null)
                                listLevel = Listlevel.Group;

                            ShowParentLevelForGroup(parentGroup);

                            LoadFacade();
                            curAnimeEpisodeType = null;
                            curAnimeSeries = null;
                        }

                        if (listLevel == Listlevel.EpisodeTypes)
                        {
                            // go back to SERIES
                            AnimeSeriesVM parentSeries = curAnimeEpisodeType.AnimeSeries;
                            ShowParentLevelForSeries(parentSeries);
                            LoadFacade();
                            return;
                        }

                        if (listLevel == Listlevel.Episode)
                        {
                            AnimeSeriesVM parentSeries = curAnimeEpisodeType.AnimeSeries;
                            if (parentSeries.EpisodeTypesToDisplay.Count == 1)
                                ShowParentLevelForSeries(parentSeries);
                            else
                            {
                                listLevel = Listlevel.EpisodeTypes;
                                curAnimeEpisodeType = null;
                            }

                            LoadFacade();
                            return;
                        }
                    }
                    break;

                default:
                    base.OnAction(action);
                    break;
            }
        }
Beispiel #28
0
 public AnimeEpisodeTypeVM(AnimeSeriesVM series, AnimeEpisodeVM ep)
 {
     AnimeSeries            = series;
     EpisodeType            = (enEpisodeType)ep.EpisodeType;
     EpisodeTypeDescription = AnimeEpisodeTypeVM.EpisodeTypeTranslated(EpisodeType);
 }
Beispiel #29
0
        private void ShowEpisodeDetails(AnimeEpisodeVM ep)
        {
            dummyEpisodeSearch.Visible = false;
            AnimeSeriesVM series = JMMServerHelper.GetSeries(ep.AnimeSeriesID);
            if (series != null && series.AniDB_Anime != null)
            {
                setGUIProperty("SubGroup.AnimeName", series.AniDB_Anime.FormattedTitle);
                setGUIProperty("SubGroup.EpisodeName", ep.EpisodeNumberAndName);
                setGUIProperty("SubGroup.FileDetails", "-");

                List<GroupVideoQualityVM> videoQualityRecords = new List<GroupVideoQualityVM>();
                List<JMMServerBinary.Contract_GroupVideoQuality> summ = JMMServerVM.Instance.clientBinaryHTTP.GetGroupVideoQualitySummary(series.AniDB_Anime.AnimeID);
                foreach (JMMServerBinary.Contract_GroupVideoQuality contract in summ)
                {
                    GroupVideoQualityVM vidQual = new GroupVideoQualityVM(contract);
                    videoQualityRecords.Add(vidQual);
                }

                // apply sorting
                if (videoQualityRecords.Count > 0)
                {
                    List<SortPropOrFieldAndDirection> sortlist = new List<SortPropOrFieldAndDirection>();
                    sortlist.Add(new SortPropOrFieldAndDirection("FileCountNormal", true, SortType.eInteger));
                    videoQualityRecords = Sorting.MultiSort<GroupVideoQualityVM>(videoQualityRecords, sortlist);

                    string fileDetails = "";
                    foreach (GroupVideoQualityVM gvq in videoQualityRecords)
                        fileDetails += string.Format("{0}({1}/{2}/{3}bit) - {4} Files ({5})", gvq.GroupNameShort, gvq.Resolution, gvq.VideoSource, gvq.VideoBitDepth, gvq.FileCountNormal, gvq.NormalEpisodeNumberSummary)
                            + Environment.NewLine;

                    setGUIProperty("SubGroup.FileDetails", fileDetails);
                }

                dummyEpisodeSearch.Visible = true;
            }
        }