Exemple #1
0
        public void UpdatePlayProps()
        {
            // Log.Debug("*** UpdatePlayProps");
            try
            {
                if (!g_Player.Playing)
                {
                    return;
                }

                PlayGuidId = (string.IsNullOrEmpty(PlayGuidId)) ? GUIPropertyManager.GetProperty("#RadioTime.Play.GuidId") : PlayGuidId;
                if (string.IsNullOrEmpty(PlayGuidId))
                {
                    return;
                }

                _station         = new RadioTimeStation();
                _station.Grabber = grabber;
                _station.Get(PlayGuidId);

                if (!string.IsNullOrEmpty(PlayGuidId) && _station.IsAvailable)
                {
                    //var nowPlaying = Settings.NowPlaying;
                    _nowPlaying         = new RadioTimeNowPlaying();
                    _nowPlaying.Grabber = grabber;
                    _nowPlaying.Get(PlayGuidId, _station.HasSong);
                    //
                    if (_nowPlaying.IsShow && !string.IsNullOrEmpty(_nowPlaying.ShowGuidId))
                    {
                        _show         = new RadioTimeShow();
                        _show.Grabber = grabber;
                        _show.Get(_nowPlaying.ShowGuidId);
                    }
                    //
                    Settings.NowPlaying        = _nowPlaying.Clone();
                    Settings.NowPlayingStation = _station.Clone();
                    if (_show != null)
                    {
                        Settings.NowPlayingShow = _show.Clone();
                    }
                    else
                    {
                        Settings.NowPlayingShow = null;
                    }
                    //
                    UpdateProps();
                }
            }
            catch (Exception ex)
            {
                Log.Debug("UpdatePlayProps: " + ex.Message);
            }
        }
Exemple #2
0
        protected void g_Player_PlayBackStarted(g_Player.MediaType type, string filename)
        {
            // Log.Debug("_currentItem is assigned: " + (_currentItem != null).ToString());
            // Log.Debug("_nowPlaying is assigned: " + (_nowPlaying != null).ToString());
            // Log.Debug("_station is assigned: " + (_station != null).ToString());
            // Log.Debug("g_player FILE    1: " + g_Player.CurrentFile);
            // Log.Debug("_currentFileName 2: " + _currentFileName);
            // Log.Debug("*** g_Player_PlayBackStarted: "+PlayGuidId);

            if (_currentItem == null || _nowPlaying == null || _station == null)
            {
                return;
            }

            if (g_Player.CurrentFile == _currentFileName || string.IsNullOrEmpty(g_Player.CurrentFile))
            {
                Settings.NowPlaying        = _nowPlaying.Clone();
                Settings.NowPlayingStation = _station.Clone();
                if (_show != null)
                {
                    Settings.NowPlayingShow = _show.Clone();
                }
                else
                {
                    Settings.NowPlayingShow = null;
                }
                PlayGuidId = _station.GuideId;

                GUIPropertyManager.SetProperty("#Play.Current.Thumb", DownloadStationLogo(_currentItem));

                // GUIPropertyManager.SetProperty("#RadioTime.Play.Station", _nowPlaying.Name);
                // GUIPropertyManager.SetProperty("#RadioTime.Play.Station", _station.Name + " " + _station.Frequency + " " + _station.Band););
                GUIPropertyManager.SetProperty("#RadioTime.Play.Station", _station.Name + " " + _station.Frequency +
                                               (!string.IsNullOrEmpty(_station.Name) && !string.IsNullOrEmpty(_station.Band) && _station.Name.IndexOf(_station.Band) < 0 ? " " + _station.Band : ""));
                // GUIPropertyManager.SetProperty("#RadioTime.Play.StationLogo", GetStationLogoFileName(nowPlaying.Image));
                GUIPropertyManager.SetProperty("#RadioTime.Play.Description", _station.Description);
                GUIPropertyManager.SetProperty("#RadioTime.Play.Station.Description", _station.Description);
                GUIPropertyManager.SetProperty("#RadioTime.Play.Slogan", _station.Slogan);
                GUIPropertyManager.SetProperty("#RadioTime.Play.Language", _station.Language);
                GUIPropertyManager.SetProperty("#RadioTime.Play.GuidId", PlayGuidId);
                //
                UpdateProps();
                //
                GUIPropertyManager.SetProperty("#RadioTime.Play.Image", DownloadStationLogo(_currentItem));
                //
                doAdditionalStuffOnStarted();
                //
                ClearInternalVariables();
            }
        }
Exemple #3
0
        protected void g_Player_PlayBackStarted(g_Player.MediaType type, string filename)
        {
            //Log.Debug("_currentItem is assigned: " + (_currentItem != null).ToString());
            //Log.Debug("_nowPlaying is assigned: " + (_nowPlaying != null).ToString());
            //Log.Debug("_station is assigned: " + (_station != null).ToString());
            //Log.Debug("g_player FILE    1: " + g_Player.CurrentFile);
            //Log.Debug("_currentFileName 2: " + _currentFileName);

            if (_currentItem == null || _nowPlaying == null || _station == null)
            {
                return;
            }

            if (g_Player.CurrentFile == _currentFileName || string.IsNullOrEmpty(g_Player.CurrentFile))
            {
                Settings.NowPlaying        = _nowPlaying.Clone();
                Settings.NowPlayingStation = _station.Clone();

                GUIPropertyManager.SetProperty("#Play.Current.Thumb", DownloadStationLogo(_currentItem));

                GUIPropertyManager.SetProperty("#RadioTime.Play.Station", _nowPlaying.Name);
                //GUIPropertyManager.SetProperty("#RadioTime.Play.StationLogo", GetStationLogoFileName(nowPlaying.Image));
                GUIPropertyManager.SetProperty("#RadioTime.Play.Duration", _nowPlaying.Duration.ToString());
                GUIPropertyManager.SetProperty("#RadioTime.Play.Description", _nowPlaying.Description);
                GUIPropertyManager.SetProperty("#duration", ToMinutes(_nowPlaying.Duration.ToString()));
                GUIPropertyManager.SetProperty("#RadioTime.Play.Location", _nowPlaying.Location);
                GUIPropertyManager.SetProperty("#RadioTime.Play.Slogan", _station.Slogan);
                GUIPropertyManager.SetProperty("#RadioTime.Play.Language", _station.Slogan);

                string titleString = _nowPlaying.Name;
                if (!string.IsNullOrEmpty(_nowPlaying.Description))
                {
                    if (!string.IsNullOrEmpty(titleString))
                    {
                        titleString = titleString + " / " + _nowPlaying.Description;
                    }
                    else
                    {
                        titleString = _nowPlaying.Description;
                    }
                }
                if (!string.IsNullOrEmpty(_nowPlaying.Location))
                {
                    if (!string.IsNullOrEmpty(titleString))
                    {
                        titleString = titleString + " / " + _nowPlaying.Location;
                    }
                    else
                    {
                        titleString = _nowPlaying.Location;
                    }
                }

                //Log.Debug("#Play.Current.Album: " + GUIPropertyManager.GetProperty("#Play.Current.Album"));
                //Log.Debug("titleString: " + titleString);

                if (string.IsNullOrEmpty(GUIPropertyManager.GetProperty("#Play.Current.Album").Trim()))
                {
                    GUIPropertyManager.SetProperty("#Play.Current.Album", titleString);
                }
                //_nowPlaying.Name + "/" + _nowPlaying.Description + "/" + _nowPlaying.Location);

                if (_setting.FormatNames.ContainsKey(_currentItem.Formats))
                {
                    GUIPropertyManager.SetProperty("#RadioTime.Play.Format", _setting.FormatNames[_currentItem.Formats]);
                }
                else
                {
                    GUIPropertyManager.SetProperty("#RadioTime.Play.Format", " ");
                }

                GUIPropertyManager.SetProperty("#RadioTime.Play.Image", DownloadStationLogo(_currentItem));

                doAdditionalStuffOnStarted();

                ClearInternalVariables();
            }
        }