public override bool Init() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { _enableScrobbling = MediaPortal.GUI.Library.PluginManager.IsPluginNameEnabled("Audioscrobbler"); _currentScrobbleUser = xmlreader.GetValueAsString("audioscrobbler", "user", "Username"); _useSimilarRandom = xmlreader.GetValueAsBool("audioscrobbler", "usesimilarrandom", true); _playlistFolder = xmlreader.GetValueAsString("music", "playlists", ""); _savePlaylistOnExit = xmlreader.GetValueAsBool("musicfiles", "savePlaylistOnExit", false); _resumePlaylistOnEnter = xmlreader.GetValueAsBool("musicfiles", "resumePlaylistOnMusicEnter", false); _autoShuffleOnLoad = xmlreader.GetValueAsBool("musicfiles", "autoshuffle", false); playlistPlayer.RepeatPlaylist = xmlreader.GetValueAsBool("musicfiles", "repeat", true); } if (_resumePlaylistOnEnter) { Log.Info("GUIMusicPlaylist: Loading default playlist {0}", _defaultPlaylist); //LoadPlayList(Path.Combine(_playlistFolder, _defaultPlaylist), false); bw = new BackgroundWorker(); bw.WorkerSupportsCancellation = true; bw.WorkerReportsProgress = false; bw.DoWork += new DoWorkEventHandler(bw_DoWork); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); bw.RunWorkerAsync(); } else { defaultPlaylistLoaded = true; } _scrobbleUsers = m_database.GetAllScrobbleUsers(); // no users in database if (_scrobbleUsers.Count > 0 && _enableScrobbling) { LoadScrobbleUserSettings(); } ascrobbler = AudioscrobblerUtils.Instance; // ScrobbleLock = new object(); //added by Sam GUIWindowManager.Receivers += new SendMessageHandler(this.OnThreadMessage); GUIWindowManager.OnNewAction += new OnActionHandler(this.OnNewAction); playlistPlayer.PlaylistChanged += playlistPlayer_Changed; return Load(GUIGraphicsContext.GetThemedSkinFile(@"\myMusicplaylist.xml")); }
public override bool Init() { mdb = MusicDatabase.Instance; m_strDirectory = System.IO.Directory.GetCurrentDirectory(); using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { _enableScrobbling = xmlreader.GetValueAsBool("plugins", "Audioscrobbler", false); _currentScrobbleUser = xmlreader.GetValueAsString("audioscrobbler", "user", "Username"); _useSimilarRandom = xmlreader.GetValueAsBool("audioscrobbler", "usesimilarrandom", true); _announceNowPlaying = xmlreader.GetValueAsBool("audioscrobbler", "EnableNowPlaying", true); } _scrobbleUsers = mdb.GetAllScrobbleUsers(); // no users in database if (_scrobbleUsers.Count > 0 && _enableScrobbling) LoadScrobbleUserSettings(); ascrobbler = AudioscrobblerUtils.Instance; // ScrobbleLock = new object(); //added by Sam GUIWindowManager.Receivers += new SendMessageHandler(this.OnThreadMessage); GUIWindowManager.OnNewAction += new OnActionHandler(this.OnNewAction); g_Player.PlayBackStopped += new g_Player.StoppedHandler(g_Player_PlayBackStopped); Youtube2MP.player.PlayBegin += new YoutubePlaylistPlayer.EventHandler(player_PlayBegin); return Load(GUIGraphicsContext.Skin + @"\youtubeplaylist.xml"); }
protected override void OnPageLoad() { base.OnPageLoad(); // Get notification, that an Internet Stream has changed // Moved out of the constructor, since it would cause loading of BASS in the Main thread, // because it is called by the Plugin Manager BassMusicPlayer.Player.InternetStreamSongChanged += OnInternetStreamSongChanged; if (facadeAlbumInfo != null) { facadeAlbumInfo.Clear(); } if (facadeSimilarTrackInfo != null) { facadeSimilarTrackInfo.Clear(); } ImagePathContainer.Clear(); _trackChanged = true; ToggleTopTrackRatings(false, PopularityRating.unknown); GUIPropertyManager.SetProperty("#currentmodule", String.Format("{0}/{1}", GUILocalizeStrings.Get(100005), GUILocalizeStrings.Get(4540))); if (LblUpNext != null) { LblUpNext.Label = GUILocalizeStrings.Get(4541); } if (GUIPropertyManager.GetProperty("#Play.Next.Title") == string.Empty && LblUpNext != null) { LblUpNext.Visible = false; } if (LblBestAlbumTracks != null) { LblBestAlbumTracks.Visible = false; } if (LblBestSimilarTracks != null) { LblBestSimilarTracks.Visible = false; } ControlsInitialized = true; InfoScrobbler = AudioscrobblerUtils.Instance; if (ImageChangeTimer == null) { ImageChangeTimer = new Timer(); ImageChangeTimer.Interval = 3600 * 1000; ImageChangeTimer.Elapsed += new ElapsedEventHandler(OnImageTimerTickEvent); ImageChangeTimer.Start(); } // Start the VUMeter Update Timer, when it is enabled in skin file GUIPropertyManager.SetProperty("#VUMeterL", @"VU1.png"); GUIPropertyManager.SetProperty("#VUMeterR", @"VU1.png"); if (VUMeterTimer == null && _usingBassEngine && _vuMeter.ToLower() != "none") { VUMeterTimer = new Timer(); VUMeterTimer.Interval = 200; VUMeterTimer.Elapsed += new ElapsedEventHandler(OnVUMterTimerTickEvent); VUMeterTimer.Start(); } UpdateImagePathContainer(); if (g_Player.Playing) { OnPlayBackStarted(g_Player.MediaType.Music, g_Player.CurrentFile); SetVisualizationWindow(); } else { CurrentTrackTag = null; NextTrackTag = null; UpdateTrackInfo(); ClearVisualizationImages(); // notify user what he's lost here? } }
public override bool Init() { bool bResult = Load(GUIGraphicsContext.GetThemedSkinFile(@"\MyRadioLastFM.xml")); using (Profile.Settings xmlreader = new Profile.MPSettings()) { _configShowTrayIcon = xmlreader.GetValueAsBool("audioscrobbler", "showtrayicon", false); _configShowBallonTips = xmlreader.GetValueAsBool("audioscrobbler", "showballontips", false); _configDirectSkip = xmlreader.GetValueAsBool("audioscrobbler", "directskip", false); _configListEntryCount = xmlreader.GetValueAsInt("audioscrobbler", "listentrycount", 24); _configOneClickStart = xmlreader.GetValueAsBool("audioscrobbler", "oneclickstart", false); } PlaylistPlayer = PlayListPlayer.SingletonPlayer; LastFMStation = new StreamControl(); InfoScrobbler = AudioscrobblerUtils.Instance; _usersTopArtists = new List<string>(_configListEntryCount); _usersOwnTags = new List<string>(_configListEntryCount); _usersFriends = new List<string>(_configListEntryCount); _radioTrackList = new List<Song>(5); _similarArtistCache = new List<string>(5); _trackTagsCache = new List<string>(5); _streamSong = new Song(); _scrobbleUsers = new List<string>(1); if (_configShowTrayIcon) { InitTrayIcon(); } g_Player.PlayBackStarted += new g_Player.StartedHandler(PlayBackStartedHandler); g_Player.PlayBackStopped += new g_Player.StoppedHandler(PlayBackStoppedHandler); g_Player.PlayBackEnded += new g_Player.EndedHandler(PlayBackEndedHandler); LastFMStation.RadioSettingsSuccess += new StreamControl.RadioSettingsLoaded(OnRadioSettingsSuccess); LastFMStation.RadioSettingsError += new StreamControl.RadioSettingsFailed(OnRadioSettingsError); this.PlaylistUpdateSuccess += new PlaylistUpdated(OnPlaylistUpdateSuccess); this.PlaylistUpdateError += new PlaylistEmpty(OnPlaylistUpdateError); return bResult; }