Example #1
0
        /// <summary>
        /// Publish progress updates to the skin as they are received.
        /// </summary>
        private void ImporterProgress(int percentDone, int taskCount, int taskTotal, string taskDescription)
        {
            lock (progressSyncToken) {
                if (GUIPropertyManager.GetProperty("#MovingPictures.Importer.Status") != taskDescription)
                {
                    GUIPropertyManager.SetProperty("#MovingPictures.Importer.Status", taskDescription);
                }

                GUIPropertyManager.SetProperty("#MovingPictures.Importer.CurrentTask.Count", taskCount.ToString());
                GUIPropertyManager.SetProperty("#MovingPictures.Importer.CurrentTask.Total", taskTotal.ToString());
                if (taskTotal > 0)
                {
                    GUIPropertyManager.SetProperty("#MovingPictures.Importer.CurrentTask.Percentage", (Convert.ToInt16(((decimal)taskCount / taskTotal) * 100)).ToString());
                }
                GUIPropertyManager.SetProperty("#MovingPictures.Importer.TotalProgressPercent", percentDone.ToString());

                GUIPropertyManager.SetProperty("#MovingPictures.Importer.IsActive", MovingPicturesCore.Importer.IsScanning.ToString());

                int unprocessed = MovingPicturesCore.Importer.PendingMatches.Count + MovingPicturesCore.Importer.PriorityPendingMatches.Count;
                int needInput   = MovingPicturesCore.Importer.MatchesNeedingInput.Count;
                int approved    = MovingPicturesCore.Importer.ApprovedMatches.Count + MovingPicturesCore.Importer.PriorityApprovedMatches.Count;
                int retrieving  = MovingPicturesCore.Importer.RetrievingDetailsMatches.Count;
                int done        = MovingPicturesCore.Importer.CommitedMatches.Count;

                GUIPropertyManager.SetProperty("#MovingPictures.Importer.All.Count", (unprocessed + needInput + approved + retrieving + done).ToString());
                GUIPropertyManager.SetProperty("#MovingPictures.Importer.NeedInput.Count", needInput.ToString());
                GUIPropertyManager.SetProperty("#MovingPictures.Importer.Done.Count", done.ToString());

                GUIPropertyManager.SetProperty("#MovingPictures.Importer.Waiting.Count", unprocessed.ToString());
                GUIPropertyManager.SetProperty("#MovingPictures.Importer.Processing.Count", (approved + retrieving).ToString());
            }
        }
Example #2
0
        protected override void OnPageLoad()
        {
            updateStationLogoTimer.Enabled = true;

            _setting = Settings.Instance;
            grabber.Settings.User      = _setting.User;
            grabber.Settings.Password  = _setting.Password;
            grabber.Settings.PartnerId = _setting.PartnerId;
            LoadLocalPresetStations();

            if (String.IsNullOrEmpty(GUIPropertyManager.GetProperty("#RadioTime.Presets.Folder.Name").Trim()))
            {
                GUIControl.DisableControl(GetID, folderButton.GetID);
            }
            else
            {
                GUIControl.EnableControl(GetID, folderButton.GetID);
            }

            foreach (var name in Translation.Strings.Keys)
            {
                SetProperty("#RadioTime.Translation." + name + ".Label", Translation.Strings[name]);
            }

            GUIControl.FocusControl(GetID, GetFocusControlId());

            base.OnPageLoad();
        }
Example #3
0
        private static bool GetShowMediaItem(ref MediaItem currentMediaItem)
        {
            FileLog.Info("Getting selected show information from Trakt.");

            currentMediaItem.MediaType = MediaItemType.Show;

            // get title
            currentMediaItem.Title = GUIPropertyManager.GetProperty("#Trakt.Show.Title");

            // get year
            int year;

            if (int.TryParse(GUIPropertyManager.GetProperty("#Trakt.Show.Year"), out year))
            {
                currentMediaItem.Year = year;
            }

            // get air date
            currentMediaItem.AirDate = GUIPropertyManager.GetProperty("#Trakt.Show.FirstAired");

            // get IMDb ID
            string imdbid = GUIPropertyManager.GetProperty("#Trakt.Show.Imdb");

            if (!string.IsNullOrEmpty(imdbid) && imdbid.Length == 9)
            {
                currentMediaItem.IMDb = imdbid;
            }

            // get TMDb ID
            int iTMDbId;

            if (int.TryParse(GUIPropertyManager.GetProperty("#Trakt.Show.TmdbId"), out iTMDbId))
            {
                currentMediaItem.TMDb = iTMDbId.ToString();
            }

            // get TVDb ID
            int iTVDbID;

            if (int.TryParse(GUIPropertyManager.GetProperty("#Trakt.Show.TvdbId"), out iTVDbID))
            {
                currentMediaItem.TVDb = iTVDbID.ToString();
            }

            // get TVRage ID
            int iTVRageID;

            if (int.TryParse(GUIPropertyManager.GetProperty("#Trakt.Show.TvRageId"), out iTVRageID))
            {
                currentMediaItem.TVRage = iTVRageID.ToString();
            }

            // get poster
            currentMediaItem.Poster = GUIPropertyManager.GetProperty("#Trakt.Show.PosterImageFilename");

            // get overview
            currentMediaItem.Plot = GUIPropertyManager.GetProperty("#Trakt.Show.Overview");

            return(true);
        }
Example #4
0
        protected override void OnPageLoad()
        {
            base.OnPageLoad();
            if (Youtube2MP.NowPlayingEntry == null)
            {
                return;
            }
            GUIPropertyManager.SetProperty("#currentmodule", "Youtube.Fm/Now Playing");
            if (Monitor.TryEnter(locker, 5000))
            {
                try
                {
                    FillRelatedList();
                    FillSimilarList();
                    string file = GetFanArtImage(GUIPropertyManager.GetProperty("#Youtube.fm.NowPlaying.Artist.Name").Trim());

                    if (File.Exists(file))
                    {
                        GUIPropertyManager.SetProperty("#Youtube.fm.NowPlaying.Video.FanArt", file);
                    }
                    else
                    {
                        GUIPropertyManager.SetProperty("#Youtube.fm.NowPlaying.Video.FanArt", " ");
                    }
                }
                finally
                {
                    Monitor.Exit(locker);
                }
            }
            OnDownloadTimedEvent(null, null);
        }
Example #5
0
        public static bool GetCurrentMediaItem(out MediaItem currentMediaItem, out bool isDetailsView)
        {
            ///
            /// Netflix currently uses MovingPictures skin properties, this may change in future.
            ///

            FileLog.Info("Getting selected movie information from Netflix.");

            isDetailsView    = true;
            currentMediaItem = new MediaItem();

            // check if we're in details view or main list
            var facade = GUIWindowManager.GetWindow(GUIWindowManager.ActiveWindow).GetControl(50);

            if (facade != null && facade.IsVisible)
            {
                isDetailsView = false;
            }

            // get all movie properties
            currentMediaItem.Title  = GUIPropertyManager.GetProperty("#MovingPictures.SelectedMovie.title").Trim();
            currentMediaItem.Plot   = GUIPropertyManager.GetProperty("#MovingPictures.SelectedMovie.summary").Trim();
            currentMediaItem.Poster = GUIPropertyManager.GetProperty("#MovingPictures.Coverart").Trim();

            int iYear;

            if (int.TryParse(GUIPropertyManager.GetProperty("#MovingPictures.SelectedMovie.year").Trim(), out iYear))
            {
                currentMediaItem.Year = iYear;
            }

            return(true);
        }
Example #6
0
        /// <summary>
        /// Reads the GUI properties to determine the CD's details
        /// </summary>
        /// <returns>Whether a song could be found</returns>
        private bool GetCurrentCDASong()
        {
            bool found = false;

            try
            {
                if (g_Player.CurrentFile.IndexOf("Track") > 0 && g_Player.CurrentFile.IndexOf(".cda") > 0)
                {
                    AudioscrobblerBase.CurrentPlayingSong.Artist = GUIPropertyManager.GetProperty("#Play.Current.Artist");
                    AudioscrobblerBase.CurrentPlayingSong.Title  = GUIPropertyManager.GetProperty("#Play.Current.Title");
                    AudioscrobblerBase.CurrentPlayingSong.Album  = GUIPropertyManager.GetProperty("#Play.Current.Album");
                    //AudioscrobblerBase.CurrentPlayingSong.Track = Int32.Parse(GUIPropertyManager.GetProperty("#Play.Current.Track"), System.Globalization.NumberStyles.Integer, new System.Globalization.CultureInfo("en-US"));
                    AudioscrobblerBase.CurrentPlayingSong.Duration = Convert.ToInt32(g_Player.Duration);
                    AudioscrobblerBase.CurrentPlayingSong.Genre    = GUIPropertyManager.GetProperty("#Play.Current.Genre");
                    AudioscrobblerBase.CurrentPlayingSong.FileName = g_Player.CurrentFile;

                    found = AudioscrobblerBase.CurrentPlayingSong.Artist != String.Empty ? true : false;
                }
            }
            catch (Exception ex)
            {
                Log.Error("Audioscrobbler plugin: Error getting CDDA track - {0}", ex.Message);
            }
            return(found);
        }
Example #7
0
        public override bool DoesPostRender()
        {
            if (!g_Player.Playing)
            {
                _fileName = string.Empty;
                OnUpdateState(false);
                return(base.IsAnimating(AnimationType.WindowClose));
            }
            if ((g_Player.IsRadio || g_Player.IsMusic))
            {
                _fileName = string.Empty;
                OnUpdateState(false);
                return(base.IsAnimating(AnimationType.WindowClose));
            }
            if (!g_Player.IsVideo && !g_Player.IsDVD && !g_Player.IsTVRecording && !g_Player.IsTV)
            {
                _fileName = string.Empty;
                OnUpdateState(false);
                return(base.IsAnimating(AnimationType.WindowClose));
            }

            if (g_Player.CurrentFile != _fileName)
            {
                _fileName = g_Player.CurrentFile;
                SetCurrentFile(_fileName);
            }

            if (g_Player.IsTV && (_program != GUIPropertyManager.GetProperty("#TV.View.title")) && g_Player.IsTimeShifting)
            {
                _program = GUIPropertyManager.GetProperty("#TV.View.title");
                GUIPropertyManager.SetProperty("#Play.Current.Title", GUIPropertyManager.GetProperty("#TV.View.channel"));
                GUIPropertyManager.SetProperty("#Play.Current.Genre", _program);
                GUIPropertyManager.SetProperty("#Play.Current.Year", GUIPropertyManager.GetProperty("#TV.View.genre"));
                GUIPropertyManager.SetProperty("#Play.Current.Director",
                                               GUIPropertyManager.GetProperty("#TV.View.start") + " - " +
                                               GUIPropertyManager.GetProperty("#TV.View.stop"));
            }

            if (GUIGraphicsContext.IsFullScreenVideo)
            {
                // Too late to schedule a fade out animation. We are already rendering full screen video
                //OnUpdateState(false);
                //return base.IsAnimating(AnimationType.WindowClose);
                return(false);
            }
            if (GUIGraphicsContext.Calibrating)
            {
                OnUpdateState(false);
                return(base.IsAnimating(AnimationType.WindowClose));
            }
            if (!GUIGraphicsContext.Overlay)
            {
                OnUpdateState(false);
                return(base.IsAnimating(AnimationType.WindowClose));
            }

            OnUpdateState(true);
            return(true);
        }
Example #8
0
 internal static void ClearProperty(string property)
 {
     if (String.IsNullOrEmpty(GUIPropertyManager.GetProperty(property)))
     {
         GUIPropertyManager.SetProperty(property, " ");
     }
     GUIPropertyManager.SetProperty(property, String.Empty);
 }
        public static string FromGuiProperties()
        {
            List <string> paramsFromGuiProps = new List <string>();

            if (!string.IsNullOrEmpty(GUIPropertyManager.GetProperty("#OnlineVideos.startparams.Group")))
            {
                paramsFromGuiProps.Add("group:" + GUIPropertyManager.GetProperty("#OnlineVideos.startparams.Group"));
                GUIPropertyManager.SetProperty("#OnlineVideos.startparams.Group", string.Empty);
            }
            if (!string.IsNullOrEmpty(GUIPropertyManager.GetProperty("#OnlineVideos.startparams.Site")))
            {
                paramsFromGuiProps.Add("site:" + GUIPropertyManager.GetProperty("#OnlineVideos.startparams.Site"));
                GUIPropertyManager.SetProperty("#OnlineVideos.startparams.Site", string.Empty);
            }
            if (!string.IsNullOrEmpty(GUIPropertyManager.GetProperty("#OnlineVideos.startparams.Category")))
            {
                paramsFromGuiProps.Add("category:" + GUIPropertyManager.GetProperty("#OnlineVideos.startparams.Category"));
                GUIPropertyManager.SetProperty("#OnlineVideos.startparams.Category", string.Empty);
            }
            if (!string.IsNullOrEmpty(GUIPropertyManager.GetProperty("#OnlineVideos.startparams.Search")))
            {
                paramsFromGuiProps.Add("search:" + GUIPropertyManager.GetProperty("#OnlineVideos.startparams.Search"));
                GUIPropertyManager.SetProperty("#OnlineVideos.startparams.Search", string.Empty);
            }
            if (!string.IsNullOrEmpty(GUIPropertyManager.GetProperty("#OnlineVideos.startparams.VKonfail")))
            {
                paramsFromGuiProps.Add("VKonfail:" + GUIPropertyManager.GetProperty("#OnlineVideos.startparams.VKonfail"));
                GUIPropertyManager.SetProperty("#OnlineVideos.startparams.VKonfail", string.Empty);
            }
            if (!string.IsNullOrEmpty(GUIPropertyManager.GetProperty("#OnlineVideos.startparams.Return")))
            {
                paramsFromGuiProps.Add("return:" + GUIPropertyManager.GetProperty("#OnlineVideos.startparams.Return"));
                GUIPropertyManager.SetProperty("#OnlineVideos.startparams.Return", string.Empty);
            }
            if (!string.IsNullOrEmpty(GUIPropertyManager.GetProperty("#OnlineVideos.startparams.Downloaddir")))
            {
                paramsFromGuiProps.Add("downloaddir:" + GUIPropertyManager.GetProperty("#OnlineVideos.startparams.Downloaddir"));
                GUIPropertyManager.SetProperty("#OnlineVideos.startparams.Downloaddir", string.Empty);
            }
            if (!string.IsNullOrEmpty(GUIPropertyManager.GetProperty("#OnlineVideos.startparams.Downloadfilename")))
            {
                paramsFromGuiProps.Add("downloadfilename:" + GUIPropertyManager.GetProperty("#OnlineVideos.startparams.Downloadfilename"));
                GUIPropertyManager.SetProperty("#OnlineVideos.startparams.Downloadfilename", string.Empty);
            }
            if (!string.IsNullOrEmpty(GUIPropertyManager.GetProperty("#OnlineVideos.startparams.Downloadmenuentry")))
            {
                paramsFromGuiProps.Add("downloadmenuentry:" + GUIPropertyManager.GetProperty("#OnlineVideos.startparams.Downloadmenuentry"));
                GUIPropertyManager.SetProperty("#OnlineVideos.startparams.Downloadmenuentry", string.Empty);
            }
            if (paramsFromGuiProps.Count > 0)
            {
                return(string.Join("|", paramsFromGuiProps.ToArray()));
            }
            else
            {
                return(null);
            }
        }
Example #10
0
        protected override void OnPageLoad()
        {
            base.OnPageLoad();

            if (m_bNewBehaviour)
            {
                m_strLastSelectedItem = GUIPropertyManager.GetProperty("#selecteditem");
            }
        }
Example #11
0
        public static bool GetCurrentMediaItem(out MediaItem currentMediaItem, out bool isDetailsView)
        {
            FileLog.Info("Getting selected movie information from ShowTimes.");

            // check if we're in details view
            isDetailsView = GUIWindowManager.GetWindow(GUIWindowManager.ActiveWindow).GetControl(24).IsVisible;

            // get title
            currentMediaItem = new MediaItem();

            if (isDetailsView)
            {
                currentMediaItem.Title = GUIPropertyManager.GetProperty("#st_title").Trim();
            }
            else
            {
                currentMediaItem.Title = GUIPropertyManager.GetProperty("#selecteditem").Trim();
            }

            // clean the title
            currentMediaItem.Title = currentMediaItem.Title.Replace("3D", string.Empty).Trim();

            // get year
            DateTime releaseDate;
            var      strReleaseDate = GUIPropertyManager.GetProperty("#st_releasedate").Trim();

            if (DateTime.TryParse(strReleaseDate, out releaseDate))
            {
                // get the year component
                currentMediaItem.Year = releaseDate.Year;
            }

            // get IMDb ID
            string imdbid = GUIPropertyManager.GetProperty("#st_imdb").Trim();

            if (!string.IsNullOrEmpty(imdbid) && imdbid.Length == 9)
            {
                currentMediaItem.IMDb = imdbid;
            }

            // get TMDb ID
            int iTMDbID;

            if (int.TryParse(GUIPropertyManager.GetProperty("#st_tmdb").Trim(), out iTMDbID))
            {
                currentMediaItem.TMDb = iTMDbID.ToString();
            }

            // get poster
            currentMediaItem.Poster = GUIPropertyManager.GetProperty("#st_poster").Trim();

            // get overview
            currentMediaItem.Plot = GUIPropertyManager.GetProperty("#st_plot").Trim();

            return(true);
        }
Example #12
0
        private void DoOnStarted(g_Player.MediaType type, string filename)
        {
            Log.Debug("GUIMusicPlayingNow: g_Player_PlayBackStarted for {0}", filename);

            ImagePathContainer.Clear();
            CurrentTrackFileName = filename;
            GetTrackTags();

            if (g_Player.IsRadio)
            {
                string strLogo = GUIPropertyManager.GetProperty("#Play.Current.Thumb");
                if (!string.IsNullOrEmpty(strLogo))
                {
                    CurrentThumbFileName = strLogo;
                }
                else
                {
                    CurrentThumbFileName = string.Empty;
                }
            }
            else
            {
                CurrentThumbFileName = GUIMusicBaseWindow.GetCoverArt(false, CurrentTrackFileName, CurrentTrackTag);
            }

            if (string.IsNullOrEmpty(CurrentThumbFileName))
            // no LOCAL Thumb found because user has bad settings -> check if there is a folder.jpg in the share
            {
                CurrentThumbFileName = Util.Utils.GetFolderThumb(CurrentTrackFileName);
                if (!Util.Utils.FileExistsInCache(CurrentThumbFileName))
                {
                    CurrentThumbFileName = string.Empty;
                }
            }

            if (!string.IsNullOrEmpty(CurrentThumbFileName))
            {
                // let us test if there is a larger cover art image
                string strLarge = Util.Utils.ConvertToLargeCoverArt(CurrentThumbFileName);
                if (Util.Utils.FileExistsInCache(strLarge))
                {
                    CurrentThumbFileName = strLarge;
                }
                AddImageToImagePathContainer(CurrentThumbFileName);
            }

            UpdateImagePathContainer();
            UpdateTrackInfo();

            // Do last.fm updates
            if (g_Player.IsMusic && _lookupSimilarTracks && g_Player.CurrentPosition >= 10.0 && lstSimilarTracks.Count == 0)
            {
                Log.Debug("GUIMusicPlayingNow: Do Last.FM lookup for similar tracks");
                UpdateSimilarTracks(CurrentTrackFileName);
            }
        }
Example #13
0
            protected int Time2Int(string _property)
            {
                int    totalSeconds = -1;
                string property     = GUIPropertyManager.GetProperty(_property);

                if (property.Length > 0)
                {
                    totalSeconds = (int)DateTime.Parse(property).TimeOfDay.TotalSeconds;
                }
                return(totalSeconds);
            }
Example #14
0
        public override void PostRender(float timePassed, int iLayer)
        {
            if (iLayer != 2)
            {
                return;
            }
            if (!base.IsAnimating(AnimationType.WindowClose))
            {
                if (GUIPropertyManager.GetProperty("#Play.Current.Thumb") != _thumbLogo)
                {
                    _thumbLogo = GUIPropertyManager.GetProperty("#Play.Current.Thumb");
                    if (g_Player.CurrentFile != _fileName)
                    {
                        _fileName = g_Player.CurrentFile;
                        SetCurrentFile(_fileName);
                    }
                }

                //        int speed = g_Player.Speed;
                //        double pos = g_Player.CurrentPosition;    // Should not called from this thread. !
                if (_imagePlayLogo != null)
                {
                    _imagePlayLogo.Visible = (g_Player.Paused == false);
                }

                if (_imagePauseLogo != null)
                {
                    _imagePauseLogo.Visible = false; // (g_Player.Paused == true);
                }

                if (_imageFastForward != null)
                {
                    _imageFastForward.Visible = false; // (g_Player.Speed>1);
                }

                if (_imageRewind != null)
                {
                    _imageRewind.Visible = false; // (g_Player.Speed<0);
                }

                if (_videoRectangle != null)
                {
                    if (g_Player.Playing)
                    {
                        _videoRectangle.Visible = GUIGraphicsContext.ShowBackground;
                    }
                    else
                    {
                        _videoRectangle.Visible = false;
                    }
                }
            }
            base.Render(timePassed);
        }
Example #15
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);
            }
        }
Example #16
0
        void playBeginWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                GUIPropertyManager.SetProperty("#Play.Current.Artist",
                                               GUIPropertyManager.GetProperty("#Youtube.fm.NowPlaying.Artist.Name"));
                GUIPropertyManager.SetProperty("#Play.Current.Title",
                                               GUIPropertyManager.GetProperty("#Youtube.fm.NowPlaying.Video.Title"));

                if (Youtube2MP.NowPlayingEntry.Media != null)
                {
                    GUIPropertyManager.SetProperty("#Play.Current.Thumb", Youtube2MP.GetLocalImageFileName(
                                                       GetBestUrl(Youtube2MP.NowPlayingEntry.Media.Thumbnails)));
                }

                if (Youtube2MP.NowPlayingEntry.Rating != null)
                {
                    GUIPropertyManager.SetProperty("#Play.Current.Rating",
                                                   (Youtube2MP.NowPlayingEntry.Rating.Average * 2).ToString());
                }

                SetLabels(Youtube2MP.NowPlayingEntry, "NowPlaying");
                SetLabels(Youtube2MP.NextPlayingEntry, "Next");
                DatabaseProvider.InstanInstance.SavePlayData(Youtube2MP.NowPlayingEntry, DateTime.Now);
                ArtistManager.Instance.SetSkinProperties(Youtube2MP.NowPlayingEntry, "NowPlaying", true, true);
                ArtistManager.Instance.SetSkinProperties(Youtube2MP.NextPlayingEntry, "Next", true, true);
                relatated.Clear();
                similar.Clear();
                if (GUIWindowManager.ActiveWindow == (int)GetID)
                {
                    if (listControl != null)
                    {
                        GUIControl.ClearControl(GetID, listControl.GetID);
                    }
                    if (listsimilar != null)
                    {
                        GUIControl.ClearControl(GetID, listsimilar.GetID);
                    }
                }
                if (Youtube2MP._settings.LastFmNowPlay)
                {
                    Youtube2MP.LastFmProfile.NowPlaying(Youtube2MP.NowPlayingEntry);
                }
                infoTimer.Enabled = true;
                _lastFmTimer.Stop();
                _lastFmTimer.Start();
                Track.TrackPlay();
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }
        }
 private void SaveListState(bool clear)
 {
     if (listControl.ListView.ListItems.Count > 0)
     {
         NavigationStack.Push(new NavigationObject(listControl.ListView, GUIPropertyManager.GetProperty("#header.title"), listControl.SelectedListItemIndex, (View)mapSettings.ViewAs));
     }
     if (clear)
     {
         GUIControl.ClearControl(GetID, listControl.GetID);
         Youtube2MP.temp_player.Reset();
         Youtube2MP.temp_player.GetPlaylist(PlayListType.PLAYLIST_MUSIC_VIDEO).Clear();
     }
 }
 public override void OnAction(Action action)
 {
     switch (action.wID)
     {
     case Action.ActionType.ACTION_PREVIOUS_MENU:
         if (GUIPropertyManager.GetProperty("#Trakt.Settings.Account.Dialog.Visible") == "true")
         {
             HideAccountControls();
             return;
         }
         break;
     }
     base.OnAction(action);
 }
Example #19
0
            public RadioSession()
            {
                Log.Info("MCEDisplay.RadioSession: Creating Radio session");
                string property = GUIPropertyManager.GetProperty("#Play.Current.Title");

                MediaStatusPropertyTag[] tags = new MediaStatusPropertyTag[]
                { MediaStatusPropertyTag.Radio, MediaStatusPropertyTag.RadioFrequency };
                object[] vals = new object[] { true, property };
                base.SetStatus(tags, vals);
                Log.Info("MCEDisplay.RadioSession: Playing radio station {0}", new object[] { property });
                tags = new MediaStatusPropertyTag[] { MediaStatusPropertyTag.Play };
                vals = new object[] { true };
                base.SetStatus(tags, vals);
            }
Example #20
0
            public override void Process()
            {
                MediaStatusPropertyTag[] tags = new MediaStatusPropertyTag[0];
                object[] vals     = new object[0];
                string   property = GUIPropertyManager.GetProperty("#Play.Current.Title");

                base.GetDuration2Int("#currentplaytime");
                if (!property.Equals(this.LastStation))
                {
                    tags = new MediaStatusPropertyTag[] { MediaStatusPropertyTag.RadioFrequency };
                    vals = new object[] { property };
                    base.SetStatus(tags, vals);
                    Log.Info("MCEDisplay.RadioSession.Process(): Updating currentStation to \"{0}\" ", new object[] { property });
                    this.LastStation = property;
                }
            }
Example #21
0
 public override void Process()
 {
     // Set the date & time
     if (DateTime.Now.Second != _updateTimer.Second)
     {
         _updateTimer = DateTime.Now;
         if (lblDate != null)
         {
             lblDate.Label = GUIPropertyManager.GetProperty("#date");
         }
         if (lblTime != null)
         {
             lblTime.Label = GUIPropertyManager.GetProperty("#time");
         }
     }
 }
Example #22
0
        private static bool GetSeasonMediaItem(ref MediaItem currentMediaItem)
        {
            // first get show info
            GetShowMediaItem(ref currentMediaItem);

            FileLog.Info("Getting selected season information from Trakt.");

            currentMediaItem.MediaType = MediaItemType.Season;

            // get season
            currentMediaItem.Season = int.Parse(GUIPropertyManager.GetProperty("#Trakt.Season.Number"));

            // get poster
            currentMediaItem.Poster = GUIPropertyManager.GetProperty("#Trakt.Season.PosterImageFilename");

            return(true);
        }
Example #23
0
 public VideoSession()
 {
     Log.Info("MCEDisplay.VideoSession: Creating Video session");
     MediaStatusPropertyTag[] tags = null;
     object[] vals = null;
     tags = new MediaStatusPropertyTag[]
     {
         MediaStatusPropertyTag.StreamingContentVideo, MediaStatusPropertyTag.MediaName,
         MediaStatusPropertyTag.MediaTime, MediaStatusPropertyTag.TrackTime
     };
     vals = new object[]
     { true, GUIPropertyManager.GetProperty("#Play.Current.Title"), base.GetDuration2Int("#duration"), 0 };
     base.SetStatus(tags, vals);
     tags = new MediaStatusPropertyTag[] { MediaStatusPropertyTag.Play };
     vals = new object[] { true };
     base.SetStatus(tags, vals);
 }
Example #24
0
        private void PropertyBrowser_Load(object sender, EventArgs e)
        {
            this.properties = new DataTable("Properties");
            DataColumn column = this.properties.Columns.Add("Key", typeof(string));

            this.properties.Columns.Add("Value", typeof(string));
            this.properties.PrimaryKey            = new DataColumn[] { column };
            this.dataGrid1.DataSource             = this.properties;
            GUIPropertyManager.OnPropertyChanged -=
                new GUIPropertyManager.OnPropertyChangedHandler(this.GUIPropertyManager_OnPropertyChanged);
            GUIPropertyManager.OnPropertyChanged +=
                new GUIPropertyManager.OnPropertyChangedHandler(this.GUIPropertyManager_OnPropertyChanged);
            this.GUIPropertyManager_OnPropertyChanged("#currentmodule", GUIPropertyManager.GetProperty("#currentmodule"));
            if (this.DoDebug)
            {
                Log.Info("MiniDisplay.PropertyBrowser_Load(): PropertyBrowser loaded.");
            }
        }
Example #25
0
 private static void GetSetCurrentTune()
 {
     if (Settings.publishTuneInfo)
     {
         Tune currentTune = new Tune();
         currentTune.artist = GUIPropertyManager.GetProperty("#Play.Current.Artist");
         currentTune.title  = GUIPropertyManager.GetProperty("#Play.Current.Title");
         currentTune.source = GUIPropertyManager.GetProperty("#Play.Current.Album");
         try {
             currentTune.track  = int.Parse(GUIPropertyManager.GetProperty("#Play.Current.Track"));
             currentTune.length = (int)TimeSpan.Parse(GUIPropertyManager.GetProperty("#Play.Current.Duration")).TotalSeconds;
             currentTune.rating = int.Parse(GUIPropertyManager.GetProperty("#Play.Current.Rating"));
         } catch (Exception e) {
             Log.Error(e);
         }
         SetTune(currentTune);
     }
 }
Example #26
0
        protected override string DoEvaluate()
        {
            string strEval = GUIPropertyManager.GetProperty(base.value);

            if (!string.IsNullOrEmpty(strEval) && (strEval.IndexOf('#') > -1))
            {
                strEval = GUIPropertyManager.Parse(strEval) ?? string.Empty;
            }
            if (!string.IsNullOrEmpty(strEval) && (strEval.IndexOf('#') > -1))
            {
                strEval = GUIPropertyManager.Parse(strEval) ?? string.Empty;
            }
            if (!string.IsNullOrEmpty(strEval) && (strEval.IndexOf('#') > -1))
            {
                strEval = GUIPropertyManager.Parse(strEval) ?? string.Empty;
            }
            return(strEval);
        }
Example #27
0
 public override void Process()
 {
     try
     {
         this.program  = GUIPropertyManager.GetProperty("#TV.RecordedTV.Title");
         this.time     = base.GetDuration2Int("#currentplaytime");
         this.duration = base.GetDuration2Int("#duration");
         Log.Info("MCEDisplay.RecordedTVSession: Playing TV Recording: {0} ({1} of {2})",
                  new object[] { this.program, this.time, this.duration });
         if (((this.program.Length != 0) && (this.time >= 0)) && (this.duration > 0))
         {
             MediaStatusPropertyTag[] tagArray;
             object[] objArray;
             if (this.oldProgram != this.program)
             {
                 tagArray = new MediaStatusPropertyTag[] { MediaStatusPropertyTag.ParentalAdvisoryRating };
                 objArray = new object[] { GUIPropertyManager.GetProperty("#TV.RecordedTV.Time") };
                 base.SetStatus(tagArray, objArray);
                 tagArray = new MediaStatusPropertyTag[] { MediaStatusPropertyTag.TrackTime };
                 objArray = new object[] { this.time };
                 base.SetStatus(tagArray, objArray);
                 tagArray = new MediaStatusPropertyTag[] { MediaStatusPropertyTag.MediaName };
                 objArray = new object[] { this.program };
                 base.SetStatus(tagArray, objArray);
                 tagArray = new MediaStatusPropertyTag[] { MediaStatusPropertyTag.MediaTime };
                 objArray = new object[] { this.duration };
                 base.SetStatus(tagArray, objArray);
                 this.oldProgram = this.program;
             }
             if (this.time != this.oldTime)
             {
                 tagArray = new MediaStatusPropertyTag[] { MediaStatusPropertyTag.TrackTime };
                 objArray = new object[] { this.time };
                 base.SetStatus(tagArray, objArray);
                 this.oldTime = this.time;
             }
         }
     }
     catch (ApplicationException exception)
     {
         Log.Info("MCEDisplay.RecordedTVSession: Exception occurred: {0}\nStackTrace:{1} ",
                  new object[] { exception.Message, exception.StackTrace });
     }
 }
        /// <summary>
        /// Constructor
        /// </summary>
        public NowPlayingRadio()
        {
            TvPlugin.TVHome.Navigator.UpdateCurrentChannel();
            TvDatabase.Channel current = TvPlugin.Radio.CurrentChannel;

            if (current != null && current.IsWebstream())
            {
                if (current.ReferringTuningDetail() != null && current.ReferringTuningDetail().Count > 0)
                {
                    IList <TuningDetail> details = current.ReferringTuningDetail();
                    TuningDetail         detail  = details[0];
                    CurrentProgramName = detail.Name;
                    CurrentProgramId   = detail.IdChannel;
                    CurrentUrl         = detail.Url;
                    ChannelName        = GUIPropertyManager.GetProperty("#Play.Current.Album");
                    ArtistName         = GUIPropertyManager.GetProperty("#Play.Current.Artist");
                }
            }
            else if (current != null && !current.IsWebstream())
            {
                ChannelId   = current.IdChannel;
                ChannelName = current.DisplayName;
                ArtistName  = GUIPropertyManager.GetProperty("#Play.Current.Artist");

                if (current.CurrentProgram != null)
                {
                    CurrentProgramId          = current.CurrentProgram.IdProgram;
                    CurrentProgramName        = current.CurrentProgram.Title;
                    CurrentProgramDescription = current.CurrentProgram.Description;
                    CurrentProgramBegin       = current.CurrentProgram.StartTime;
                    CurrentProgramEnd         = current.CurrentProgram.EndTime;
                }

                if (current.NextProgram != null)
                {
                    NextProgramId          = current.NextProgram.IdProgram;
                    NextProgramName        = current.NextProgram.Title;
                    NextProgramDescription = current.NextProgram.Description;
                    NextProgramBegin       = current.NextProgram.StartTime;
                    NextProgramEnd         = current.NextProgram.EndTime;
                }
            }
        }
Example #29
0
 private void GUIPropertyManager_OnPropertyChanged(string tag, string tagValue)
 {
     Log.Info(
         "MCEDisplay.GUIPropertyManager_OnPropertyChanged(): received notification TAG = \"{0}\", value = \"{1}\"",
         new object[] { tag, tagValue });
     if (tag == "#Play.Current.File")
     {
         Log.Info("MCEDisplay.GUIPropertyManager_OnPropertyChanged(): Play switch detected");
         this.playSwitched = true;
         if (GUIPropertyManager.GetProperty("#duration").Length == 0)
         {
             Log.Info("MCEDisplay.GUIPropertyManager_OnPropertyChanged(): duration not filled yet");
         }
     }
     else if (tag == "#currentmodule")
     {
         Log.Info("MCEDisplay.GUIPropertyManager_OnPropertyChanged(): menu switch detected");
         this.playSwitched = true;
     }
 }
Example #30
0
        public static bool GetCurrentMediaItem(out MediaItem currentMediaItem)
        {
            FileLog.Info("Getting selected movie information from MyVideos");

            currentMediaItem       = new MediaItem();
            currentMediaItem.Title = GUIPropertyManager.GetProperty("#title").Trim();

            int year;
            var strYear = GUIPropertyManager.GetProperty("#year").Trim();

            if (int.TryParse(strYear, out year))
            {
                currentMediaItem.Year = year;
            }

            // Get IMDb ID
            string imdbid = GUIPropertyManager.GetProperty("#imdbnumber").Trim();

            if (!string.IsNullOrEmpty(imdbid) && imdbid.Length == 9)
            {
                currentMediaItem.IMDb = imdbid;
            }

            currentMediaItem.Plot   = GUIPropertyManager.GetProperty("#plot").Trim();
            currentMediaItem.Poster = GUIPropertyManager.GetProperty("#thumb").Trim();

            // Get Local File Info
            currentMediaItem.FullPath = GUIPropertyManager.GetProperty("#file").Trim();

            // At the very least we should have a file
            if (string.IsNullOrEmpty(currentMediaItem.FullPath))
            {
                // try get the selected item on the facade
                if (SelectedItem != null && !SelectedItem.IsFolder)
                {
                    currentMediaItem.FullPath = SelectedItem.Path;
                }
            }

            return(true);
        }