Esempio n. 1
0
 private void ArtistActions(Action.ActionType actionType)
 {
     if ((actionType == Action.ActionType.ACTION_MUSIC_PLAY) || (actionType == Action.ActionType.ACTION_PLAY) || (actionType == Action.ActionType.ACTION_PAUSE))
     {
         if ((actionType == Action.ActionType.ACTION_MUSIC_PLAY) || (actionType == Action.ActionType.ACTION_PLAY) || (actionType == Action.ActionType.ACTION_PAUSE && !g_Player.HasVideo))
         {
             DBArtistInfo       currArtist        = DBArtistInfo.Get(facadeLayout.SelectedListItem.Label);
             List <DBTrackInfo> allTracksByArtist = DBTrackInfo.GetEntriesByArtist(currArtist);
             AddToPlaylist(allTracksByArtist, true, mvCentralCore.Settings.ClearPlaylistOnAdd, mvCentralCore.Settings.GeneratedPlaylistAutoShuffle);
         }
     }
     else if (actionType == Action.ActionType.REMOTE_0 ||
              actionType == Action.ActionType.REMOTE_1 ||
              actionType == Action.ActionType.REMOTE_2 ||
              actionType == Action.ActionType.REMOTE_3 ||
              actionType == Action.ActionType.REMOTE_4 ||
              actionType == Action.ActionType.REMOTE_5 ||
              actionType == Action.ActionType.REMOTE_6 ||
              actionType == Action.ActionType.REMOTE_7 ||
              actionType == Action.ActionType.REMOTE_8 ||
              actionType == Action.ActionType.REMOTE_9)
     {
         DoSpell(actionType);
     }
     else
     {
         _currentView = MvView.Artist;
         artistID     = facadeLayout.SelectedListItem.ItemId;
         logger.Debug("Calling loadCurrent from ArtistActions");
         loadCurrent();
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Play tracks by selected Genre
        /// </summary>
        private void playByGenre()
        {
            GUIDialogMenu dlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlgMenu != null)
            {
                dlgMenu.Reset();
                dlgMenu.SetHeading(mvCentralUtils.PluginName() + " - " + Localization.SmartPlaylistOptions);

                List <DBGenres> genreList = DBGenres.GetAll();
                genreList.Sort(delegate(DBGenres p1, DBGenres p2) { return(p1.Genre.CompareTo(p2.Genre)); });

                foreach (DBGenres genre in genreList)
                {
                    if (genre.Enabled)
                    {
                        dlgMenu.Add(genre.Genre);
                    }
                }
                dlgMenu.DoModal(GetID);

                if (dlgMenu.SelectedLabel == -1) // Nothing was selected
                {
                    return;
                }

                //dlgMenu.SelectedLabelText
                PlayList playlist = Player.playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MVCENTRAL);
                playlist.Clear();
                List <DBArtistInfo> allArtists = DBArtistInfo.GetAll();

                foreach (DBArtistInfo artist in allArtists)
                {
                    if (tagMatched(dlgMenu.SelectedLabelText, artist))
                    {
                        logger.Debug("Matched Artist {0} with Tag {1}", artist.Artist, dlgMenu.SelectedLabelText);
                        List <DBTrackInfo> theTracks = DBTrackInfo.GetEntriesByArtist(artist);
                        foreach (DBTrackInfo artistTrack in theTracks)
                        {
                            playlist.Add(new PlayListItem(artistTrack));
                        }
                    }
                }
                Player.playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_MVCENTRAL;

                if (mvCentralCore.Settings.GeneratedPlaylistAutoShuffle)
                {
                    playlist.Shuffle();
                }

                Player.playlistPlayer.Play(0);
                if (mvCentralCore.Settings.AutoFullscreen)
                {
                    GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO);
                }
            }
        }
Esempio n. 3
0
        private void GenreActions(MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if ((actionType == Action.ActionType.ACTION_MUSIC_PLAY) || (actionType == Action.ActionType.ACTION_PLAY) || (actionType == Action.ActionType.ACTION_PAUSE))
            {
                if ((actionType == Action.ActionType.ACTION_MUSIC_PLAY) || (actionType == Action.ActionType.ACTION_PLAY) || (actionType == Action.ActionType.ACTION_PAUSE && !g_Player.HasVideo))
                {
                    List <DBArtistInfo> artistList     = new List <DBArtistInfo>();
                    List <DBArtistInfo> artistFullList = DBArtistInfo.GetAll();


                    logger.Debug("Checking for matches for Genre : " + facadeLayout.SelectedListItem.Label);
                    foreach (DBArtistInfo artistInfo in artistFullList)
                    {
                        if (tagMatched(facadeLayout.SelectedListItem.Label, artistInfo))
                        {
                            logger.Debug("Matched Artist {0} with Tag {1}", artistInfo.Artist, facadeLayout.SelectedListItem.Label);
                            if (!artistList.Contains(artistInfo))
                            {
                                artistList.Add(artistInfo);
                            }
                        }
                    }

                    if (mvCentralCore.Settings.ClearPlaylistOnAdd)
                    {
                        ClearPlaylist();
                    }

                    foreach (DBArtistInfo currArtist in artistList)
                    {
                        List <DBTrackInfo> artistTracks = DBTrackInfo.GetEntriesByArtist(currArtist);
                        AddToPlaylist(artistTracks, false, false, mvCentralCore.Settings.GeneratedPlaylistAutoShuffle);
                    }
                    Player.playlistPlayer.Play(0);
                    if (mvCentralCore.Settings.AutoFullscreen)
                    {
                        GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO);
                    }
                }
                else
                {
                    _currentView = MvView.Genres;
                    artistID     = facadeLayout.SelectedListItem.ItemId;
                    logger.Debug("Calling loadCurrent from GenreActions");
                    loadCurrent();
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Play by Selected Tag
        /// </summary>
        private void playByTag()
        {
            GUIDialogMenu dlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlgMenu != null)
            {
                dlgMenu.Reset();
                dlgMenu.SetHeading(mvCentralUtils.PluginName() + " - " + Localization.SmartPlaylistOptions);
                foreach (string artistTag in artistTags)
                {
                    dlgMenu.Add(artistTag);
                }
                dlgMenu.DoModal(GetID);

                if (dlgMenu.SelectedLabel == -1) // Nothing was selected
                {
                    return;
                }

                //dlgMenu.SelectedLabelText
                PlayList playlist = Player.playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MVCENTRAL);
                playlist.Clear();
                List <DBArtistInfo> allArtists = DBArtistInfo.GetAll();
                foreach (DBArtistInfo artist in allArtists)
                {
                    if (artist.Tag.Contains(dlgMenu.SelectedLabelText))
                    {
                        List <DBTrackInfo> theTracks = DBTrackInfo.GetEntriesByArtist(artist);
                        foreach (DBTrackInfo artistTrack in theTracks)
                        {
                            playlist.Add(new PlayListItem(artistTrack));
                        }
                    }
                }
                Player.playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_MVCENTRAL;
                playlist.Shuffle();
                Player.playlistPlayer.Play(0);
                if (mvCentralCore.Settings.AutoFullscreen)
                {
                    GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO);
                }
            }
        }
Esempio n. 5
0
        protected override void OnPageLoad()
        {
            base.OnPageLoad();

            // Listen for background events
            mvCentralCore.ProcessManager.Progress += new ProcessProgressDelegate(ProcessManager_Progress);
            // Set initial propery valuesus
            GUIPropertyManager.SetProperty("#mvCentral.Metadata.Update.Progress", Localization.Inactive);
            GUIPropertyManager.SetProperty("#mvCentral.Artwork.Update.Progress", Localization.Inactive);

            GUILabelControl.SetControlLabel(GetID, (int)GUIControls.versionLabel, System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
            List <DBTrackInfo>  videoList  = DBTrackInfo.GetAll();
            List <DBArtistInfo> artistList = DBArtistInfo.GetAll();

            // Set stats
            GUILabelControl.SetControlLabel(GetID, (int)GUIControls.videoCountLabel, string.Format(Localization.VideoCount, videoList.Count, artistList.Count));
            // Set Hierachy
            GUIPropertyManager.SetProperty("#mvCentral.Hierachy", Localization.History);
            // Get the most viewed video
            videoList.Sort(delegate(DBTrackInfo p1, DBTrackInfo p2) { return(p2.ActiveUserSettings.WatchedCount.CompareTo(p1.ActiveUserSettings.WatchedCount)); });
            if (videoList[0].ActiveUserSettings.WatchedCount == 0)
            {
                GUIPropertyManager.SetProperty("#mvCentral.MostPlayed", " ");
            }
            else
            {
                GUIPropertyManager.SetProperty("#mvCentral.MostPlayed", videoList[0].Track);
            }

            favVideoImage.FileName = videoList[0].ArtFullPath;

            try
            {
                // Set the Top ten list - sure there is a neater way of doing this....
                if (videoList[0].ActiveUserSettings.WatchedCount > 0)
                {
                    topTen1.Label = string.Format(" 1 - {0} - {1}", videoList[0].ArtistInfo[0].Artist.ToString(), videoList[0].Track.ToString());
                }

                if (videoList[1].ActiveUserSettings.WatchedCount > 0)
                {
                    topTen2.Label = string.Format(" 2 - {0} - {1}", videoList[1].ArtistInfo[0].Artist, videoList[1].Track);
                }

                if (videoList[2].ActiveUserSettings.WatchedCount > 0)
                {
                    topTen3.Label = string.Format(" 3 - {0} - {1}", videoList[2].ArtistInfo[0].Artist, videoList[2].Track);
                }

                if (videoList[3].ActiveUserSettings.WatchedCount > 0)
                {
                    topTen4.Label = string.Format(" 4 - {0} - {1}", videoList[3].ArtistInfo[0].Artist, videoList[3].Track);
                }

                if (videoList[4].ActiveUserSettings.WatchedCount > 0)
                {
                    topTen5.Label = string.Format(" 5 - {0} - {1}", videoList[4].ArtistInfo[0].Artist, videoList[4].Track);
                }

                if (videoList[5].ActiveUserSettings.WatchedCount > 0)
                {
                    topTen6.Label = string.Format(" 6 - {0} - {1}", videoList[5].ArtistInfo[0].Artist, videoList[5].Track);
                }

                if (videoList[6].ActiveUserSettings.WatchedCount > 0)
                {
                    topTen7.Label = string.Format(" 7 - {0} - {1}", videoList[6].ArtistInfo[0].Artist, videoList[6].Track);
                }

                if (videoList[7].ActiveUserSettings.WatchedCount > 0)
                {
                    topTen8.Label = string.Format(" 8 - {0} - {1}", videoList[7].ArtistInfo[0].Artist, videoList[7].Track);
                }

                if (videoList[8].ActiveUserSettings.WatchedCount > 0)
                {
                    topTen9.Label = string.Format(" 9 - {0} - {1}", videoList[8].ArtistInfo[0].Artist, videoList[8].Track);
                }

                if (videoList[9].ActiveUserSettings.WatchedCount > 0)
                {
                    topTen10.Label = string.Format("10 - {0} - {1}", videoList[9].ArtistInfo[0].Artist, videoList[9].Track);
                }
            }
            catch { }

            // Get the most viewed artist
            int          watchedCount      = 0;
            int          higestWatchCount  = 0;
            DBArtistInfo mostWatchedArtist = null;

            foreach (DBArtistInfo artist in artistList)
            {
                List <DBTrackInfo> artistTracks = DBTrackInfo.GetEntriesByArtist(artist);
                watchedCount = 0;
                foreach (DBTrackInfo track in artistTracks)
                {
                    watchedCount += track.ActiveUserSettings.WatchedCount;
                }
                if (watchedCount > higestWatchCount)
                {
                    higestWatchCount  = watchedCount;
                    mostWatchedArtist = artist;
                }
            }
            if (mostWatchedArtist != null)
            {
                GUIPropertyManager.SetProperty("#mvCentral.FavArtist", mostWatchedArtist.Artist);
                favArtistImage.FileName = mostWatchedArtist.ArtThumbFullPath;
            }
            else
            {
                GUIPropertyManager.SetProperty("#mvCentral.FavArtist", " ");
            }
        }