Пример #1
0
        private void LoadChannelsForGroup(ChannelGroup group)
        {
            _channelsInGroupList.Clear();
            _channelIdsInList.Clear();

            if (group != null)
            {
                var channels = Proxies.SchedulerService.GetChannelsInGroup(group.ChannelGroupId, false).Result;
                if (channels != null && channels.Count > 0)
                {
                    foreach (Channel channel in channels)
                    {
                        _channelIdsInList.Add(channel.ChannelId);
                        GUIListItem item = new GUIListItem();
                        item.Label = channel.DisplayName;
                        item.TVTag = channel;

                        string logo = Utility.GetLogoImage(channel);
                        if (!string.IsNullOrEmpty(logo))
                        {
                            item.IconImage = logo;
                        }
                        if (!channel.VisibleInGuide)
                        {
                            item.IsPlayed = true;
                        }
                        _channelsInGroupList.Add(item);
                    }
                }
            }
        }
Пример #2
0
        private void LoadAllChannels()
        {
            _allChannelsList.Clear();

            Channel[] channels = SchedulerAgent.GetAllChannels(_currentChannelType, false);
            if (channels != null && channels.Length > 0)
            {
                foreach (Channel channel in channels)
                {
                    if (!_channelIdsInList.Contains(channel.ChannelId))
                    {
                        GUIListItem item = new GUIListItem();
                        item.Label = channel.DisplayName;
                        item.TVTag = channel;

                        string logo = Utility.GetLogoImage(channel, SchedulerAgent);
                        if (!string.IsNullOrEmpty(logo))
                        {
                            item.IconImage = logo;
                        }
                        if (!channel.VisibleInGuide)
                        {
                            item.IsPlayed = true;
                        }
                        _allChannelsList.Add(item);
                    }
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Updates the contacts facade.
        /// </summary>
        private void UpdateContactsFacade()
        {
            if (ctrlListControlContacts != null)
            {
                ctrlListControlContacts.Clear();
                foreach (Session currentSession in History.Instance.ChatSessions)
                {
                    currentSession.UpdateItemInfo();
                    currentSession.OnItemSelected -= new GUIListItem.ItemSelectedHandler(OnSessionItemSelected);
                    currentSession.OnItemSelected += new GUIListItem.ItemSelectedHandler(OnSessionItemSelected);

                    try {
                        if (StatusFilter.HasValue)
                        {
                            if (StatusFilter.Value == currentSession.IsActiveSession)
                            {
                                ctrlListControlContacts.Add(currentSession);
                            }
                        }
                        else
                        {
                            ctrlListControlContacts.Add(currentSession);
                        }
                    } catch (Exception e) {
                        Log.Error(e);
                    }
                }
                ctrlListControlContacts.DoUpdate();
            }
        }
Пример #4
0
        private void LoadAllChannels()
        {
            _allChannelsList.Clear();

            var channels = Proxies.SchedulerService.GetAllChannels(_currentChannelType, false).Result;

            foreach (Channel channel in channels)
            {
                if (!_channelIdsInList.Contains(channel.ChannelId))
                {
                    GUIListItem item = new GUIListItem();
                    item.Label = channel.DisplayName;
                    item.TVTag = channel;

                    string logo = Utility.GetLogoImage(channel);
                    if (!string.IsNullOrEmpty(logo))
                    {
                        item.IconImage = logo;
                    }
                    if (!channel.VisibleInGuide)
                    {
                        item.IsPlayed = true;
                    }
                    _allChannelsList.Add(item);
                }
            }
        }
 private void FillList()
 {
     listView.Clear();
     foreach (var plugin in PluginManager.IncompatiblePluginAssemblies)
     {
         listView.Add(CreateListItem(plugin));
     }
     foreach (var plugin in PluginManager.IncompatiblePlugins)
     {
         listView.Add(CreateListItem(plugin));
     }
 }
Пример #6
0
        private void LoadDirectory()
        {
            int total = 0;

            GUIWaitCursor.Show();
            GUIControl.ClearControl(GetID, listConflicts.GetID);

            if (selectedItem == null)
            {
                IList <Conflict> conflictsList = Conflict.ListAll();
                foreach (Conflict conflict in conflictsList)
                {
                    Schedule schedule            = Schedule.Retrieve(conflict.IdSchedule);
                    Schedule conflictingSchedule = Schedule.Retrieve(conflict.IdConflictingSchedule);

                    GUIListItem item = Schedule2ListItem(schedule);
                    item.MusicTag = conflictingSchedule;
                    item.Label3   = conflictingSchedule.ProgramName;
                    item.IsFolder = true;
                    listConflicts.Add(item);
                    total++;
                }
            }
            else
            {
                Schedule schedule            = selectedItem.TVTag as Schedule;
                Schedule conflictingSchedule = selectedItem.MusicTag as Schedule;

                GUIListItem item = new GUIListItem();
                item.Label    = "..";
                item.IsFolder = true;
                listConflicts.Add(item);
                total++;

                item = Schedule2ListItem(schedule);
                listConflicts.Add(item);
                total++;

                item = Schedule2ListItem(conflictingSchedule);
                listConflicts.Add(item);
                SetLabels();
                total++;
            }

            //set object count label
            GUIPropertyManager.SetProperty("#itemcount", Utils.GetObjectCountLabel(total));

            GUIWaitCursor.Hide();
            if (listConflicts.Count == 0)
            {
                GUIWindowManager.ShowPreviousWindow();
            }
        }
Пример #7
0
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            if (control == btnAdd)
            {
                string ext = string.Empty;
                GetStringFromKeyboard(ref ext);
                if (string.IsNullOrEmpty(ext))
                {
                    return;
                }
                ext = "." + ext.Replace(".", string.Empty).ToLowerInvariant();

                foreach (var lItem in extensionsListcontrol.ListItems)
                {
                    if (ext.Equals(lItem.Label, StringComparison.InvariantCultureIgnoreCase))
                    {
                        return;
                    }
                }

                GUIListItem item = new GUIListItem();
                item.Label = ext.Trim();
                extensionsListcontrol.Add(item);
                SaveExtensions();
                OnExtensions();
            }
            if (control == btnRemove)
            {
                extensionsListcontrol.RemoveItem(extensionsListcontrol.SelectedListItemIndex);
                SaveExtensions();
                OnExtensions();
            }
            if (control == btnDefault)
            {
                using (Profile.Settings xmlwriter = new MPSettings())
                {
                    xmlwriter.SetValue("movies", "extensions", Util.Utils.VideoExtensionsDefault);
                }
                // update internal plugins settings
                if (VirtualDirectories.Instance.Movies != null)
                {
                    VirtualDirectories.Instance.Movies.LoadSettings(_section);
                }
                OnExtensions();
            }

            base.OnClicked(controlId, control, actionType);
        }
Пример #8
0
        private void AddToList(GUIListItem listItem, FilterMode mode)
        {
            GUIListControl     listControl  = allFilesListControl;
            List <GUIListItem> internalList = allItems;

            switch (mode)
            {
            case FilterMode.ALL:
                listControl  = allFilesListControl;
                internalList = allItems;
                break;

            case FilterMode.PENDING:
                listControl  = pendingFilesListControl;
                internalList = pendingItems;
                break;

            case FilterMode.COMPLETED:
                listControl  = completedFileListControl;
                internalList = completedItems;
                break;
            }

            if (!internalList.Contains(listItem))
            {
                internalList.Add(listItem);
                listControl.Add(listItem);
            }
        }
Пример #9
0
        private void Refresh()
        {
            if (Settings.NowPlayingStation == null)
            {
                return;
            }

            facadeGenres.ListItems.Clear();
            GUIControl.ClearControl(GetID, facadeGenres.GetID);
            foreach (var station in Settings.NowPlayingStation.Genres)
            {
                var listItem = new GUIListItem();
                listItem.MusicTag = station;
                listItem.Label    = station.Text;
                facadeGenres.Add(listItem);
            }
            facadeSimilar.ListItems.Clear();
            GUIControl.ClearControl(GetID, facadeSimilar.GetID);
            foreach (var station in Settings.NowPlayingStation.Similar)
            {
                var listItem = new GUIListItem();
                listItem.MusicTag = station;
                listItem.Label    = station.Text;
                facadeSimilar.Add(listItem);
            }
        }
Пример #10
0
        private void LoadChannelGroups(ChannelGroup groupToSelect)
        {
            _channelGroupsList.Clear();

            ChannelGroup[] groups = GetAllChannelGroups();
            if (groups != null && groups.Length > 0)
            {
                foreach (ChannelGroup group in groups)
                {
                    GUIListItem item = new GUIListItem();
                    item.Label = group.GroupName;
                    item.TVTag = group;

                    if (!group.VisibleInGuide)
                    {
                        item.IsPlayed = true;
                    }
                    if (group.ChannelGroupId == groupToSelect.ChannelGroupId)
                    {
                        item.IsRemote = true;
                    }
                    _channelGroupsList.Add(item);
                }
            }
        }
Пример #11
0
        private void UpdateSimilarTrackWorker(string filename, MusicTag tag)
        {
            if (tag == null)
            {
                return;
            }

            lstSimilarTracks.Clear();

            List <LastFMSimilarTrack> tracks;

            try
            {
                Log.Debug("GUIMusicPlayingNow: Calling Last.FM to get similar Tracks");
                tracks = LastFMLibrary.GetSimilarTracks(tag.Title, tag.Artist);
            }
            catch (Exception ex)
            {
                Log.Error("Error getting similar tracks in now playing");
                Log.Error(ex);
                return;
            }

            Log.Debug("GUIMusicPlayingNow: Number of similar tracks returned from Last.FM: {0}", tracks.Count);

            var dbTracks = GetSimilarTracksInDatabase(tracks);

            for (var i = 0; i < 3; i++)
            {
                if (dbTracks.Count > 0)
                {
                    var trackNo = Randomizer.Next(0, dbTracks.Count);
                    var song    = dbTracks[trackNo];

                    var t    = song.ToMusicTag();
                    var item = new GUIListItem
                    {
                        AlbumInfoTag = song,
                        MusicTag     = tag,
                        IsFolder     = false,
                        Label        = song.Title,
                        Path         = song.FileName
                    };
                    item.AlbumInfoTag = song;
                    item.MusicTag     = t;

                    GUIMusicBaseWindow.SetTrackLabels(ref item, MusicSort.SortMethod.Album);
                    dbTracks.RemoveAt(trackNo); // remove song after adding to playlist to prevent the same sone being added twice

                    if (g_Player.currentFileName != filename)
                    {
                        return;                             // track has changed since request so ignore
                    }
                    lstSimilarTracks.Add(item);
                }
            }
            Log.Debug("GUIMusicPlayingNow: Tracks returned after matching Last.FM results with database tracks: {0}", lstSimilarTracks.Count);
        }
Пример #12
0
        private void AddRangeToList(GUIListControl listControl, List <GUIListItem> listItems)
        {
            listControl.Clear();

            foreach (var item in listItems)
            {
                listControl.Add(item);
            }
        }
Пример #13
0
        private void UpdateTorrentList(bool timed)
        {
            if (torrentList == null)
            {
                return;
            }
            List <GUIListItem> CurItems = new List <GUIListItem>(torrentList.ListItems);

            foreach (Torrent torrent in TorrentEngine.Instance().TorrentSession.TorrentsAll)
            {
                if (torrent.Progress < 100.0)
                {
                    GUIListItem item = FindItemByHash(torrentList, torrent);
                    if (item == null)
                    {
                        item = new GUIListItem(string.Format("{0}", Ellipsis(torrent.Name, 75)));
                        item.AlbumInfoTag = torrent;
                        torrentList.Add(item);
                    }
                    else
                    {
                        CurItems.Remove(item);
                    }
                    item.Label2 = string.Format("{0} ({1:F2}%)", UnitConvert.SizeToString(torrent.Size), torrent.Progress);
                    //item.Label3 = ((T.fETA == "-1s") || (T.fETA == "0s")) ? "" : T.fETA.ToLower();
                }
            }
            foreach (var i in CurItems)
            {
                torrentList.ListItems.Remove(i);
            }

            if (torrentList.ListItems.Count == 0)
            {
                GUIPropertyManager.SetProperty("#MyTorrents.Count", "0");
                GUIListItem item = new GUIListItem();
                item.Label = "No torrents.";
                torrentList.Add(item);
            }
            else
            {
                GUIPropertyManager.SetProperty("#MyTorrents.Count", String.Format("{0}", torrentList.ListItems.Count));
            }
        }
Пример #14
0
        private void LoadDirectory()
        {
            GUIControl.ClearControl(GetID, listPriorities.GetID);
            SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Schedule));

            sb.AddOrderByField(false, "priority");
            SqlStatement stmt     = sb.GetStatement(true);
            IList        itemlist = ObjectFactory.GetCollection(typeof(Schedule), stmt.Execute());

            int total = 0;

            foreach (Schedule rec in itemlist)
            {
                if (rec.IsSerieIsCanceled(rec.StartTime, rec.IdChannel))
                {
                    continue;
                }
                GUIListItem item = new GUIListItem();
                item.Label = String.Format("{0}.{1}", total, rec.ProgramName);
                item.TVTag = rec;
                string strLogo = Utils.GetCoverArt(Thumbs.TVChannel, rec.ReferencedChannel().DisplayName);
                if (string.IsNullOrEmpty(strLogo))
                {
                    strLogo = "defaultVideoBig.png";
                }
                TvServer    server = new TvServer();
                VirtualCard card;
                if (server.IsRecordingSchedule(rec.IdSchedule, out card))
                {
                    if (rec.ScheduleType != (int)ScheduleRecordingType.Once)
                    {
                        item.PinImage = Thumbs.TvRecordingSeriesIcon;
                    }
                    else
                    {
                        item.PinImage = Thumbs.TvRecordingIcon;
                    }
                }
                else if (rec.ReferringConflicts().Count > 0)
                {
                    item.PinImage = Thumbs.TvConflictRecordingIcon;
                }
                item.ThumbnailImage = strLogo;
                item.IconImageBig   = strLogo;
                item.IconImage      = strLogo;
                listPriorities.Add(item);
                total++;
            }

            //set object count label
            GUIPropertyManager.SetProperty("#itemcount", Utils.GetObjectCountLabel(total));

            GUIControl.SelectItemControl(GetID, listPriorities.GetID, m_iSelectedItem);
        }
        /// <summary>
        /// Populates GUIListControl with titles from the search. the searchLevel defines if it's the first search, thus the manual search button is needed
        /// or a subsequent search, inserting the back button instead.
        /// </summary>
        /// <param name="search"></param>
        /// <param name="searchLevel"></param>
        private void PopulateListControl(IEnumerable <TraktSearchResult> search, int searchLevel = 0)
        {
            resultListControl.Clear();
            GUIListItem item;

            if (searchlevel < 1)
            {
                //manualSearch button, it's first search
                item       = new GUIListItem("Manual Search");
                item.TVTag = "FirstButton";
                resultListControl.Add(item);
            }
            else
            {
                item       = new GUIListItem("Back");
                item.TVTag = "FirstButton";
                resultListControl.Add(item);
            }
            //Now populating items
            IEnumerator <TraktSearchResult> p = search.GetEnumerator();

            while (p.MoveNext())
            {
                if (p.Current.Type == "show")
                {
                    item       = new GUIListItem(p.Current.Show.Title);
                    item.TVTag = p.Current.Show;
#if DEBUG
                    TraktLogger.Info("Adding '{0}' to item '{1}'. Type detected: '{2}'", p.Current.Show.Title, item.Label, p.Current.Type);
#endif
                    resultListControl.Add(item);
                }
                if (p.Current.Type == "season")
                {
                    item       = new GUIListItem(string.Format("Season {0}", p.Current.Season.Number));
                    item.TVTag = p.Current.Season;
#if DEBUG
                    TraktLogger.Info("adding Season '{0}' to the list as {1}. Object type: {2}", p.Current.Season.Number, p.Current.Type, p.Current.Season.ToString());
#endif
                    resultListControl.Add(item);
                }
                if (p.Current.Type == "episode")
                {
                    item       = new GUIListItem(string.Format("Episode {0}: {1} ", p.Current.Episode.Number, p.Current.Episode.Title));
                    item.TVTag = p.Current.Episode;
#if DEBUG
                    TraktLogger.Info("adding Episode '{0}' to the list", p.Current.Episode.Number);
#endif
                    resultListControl.Add(item);
                }
                if (p.Current.Type == "movie")
                {
                    item       = new GUIListItem(p.Current.Movie.Title);
                    item.TVTag = p.Current.Movie;
                    resultListControl.Add(item);
                }
            }
            currentSearch = search;
        }
        private void LoadSettings()
        {
            using (Settings xmlreader = new MPSettings())
            {
                btnEnableDynamicRefreshRate.Selected = xmlreader.GetValueAsBool("general", "autochangerefreshrate", false);
                btnNotify.Selected = xmlreader.GetValueAsBool("general", "notify_on_refreshrate", false);
                btnUseDefaultRefreshRate.Selected  = xmlreader.GetValueAsBool("general", "use_default_hz", false);
                btnUseDeviceReset.Selected         = xmlreader.GetValueAsBool("general", "devicereset", false);
                btnForceRefreshRateChange.Selected = xmlreader.GetValueAsBool("general", "force_refresh_rate", false);
                _sDefaultHz = xmlreader.GetValueAsString("general", "default_hz", "");

                String[] p = null;
                _defaultHzIndex = -1;
                _defaultHz.Clear();

                for (int i = 1; i < 100; i++)
                {
                    string extCmd = xmlreader.GetValueAsString("general", "refreshrate0" + Convert.ToString(i) + "_ext", "");
                    string name   = xmlreader.GetValueAsString("general", "refreshrate0" + Convert.ToString(i) + "_name", "");

                    if (string.IsNullOrEmpty(name))
                    {
                        continue;
                    }

                    string fps = xmlreader.GetValueAsString("general", name + "_fps", "");
                    string hz  = xmlreader.GetValueAsString("general", name + "_hz", "");

                    p    = new String[4];
                    p[0] = name;
                    p[1] = fps;    // fps
                    p[2] = hz;     //hz
                    p[3] = extCmd; //action
                    RefreshRateData refreshRateData = new RefreshRateData(name, fps, hz, extCmd);
                    GUIListItem     item            = new GUIListItem();
                    item.Label           = p[0];
                    item.AlbumInfoTag    = refreshRateData;
                    item.OnItemSelected += OnItemSelected;
                    lcRefreshRatesList.Add(item);
                    _defaultHz.Add(p[0]);

                    if (_sDefaultHz == hz)
                    {
                        _defaultHzIndex = i - 1;
                    }
                }

                if (lcRefreshRatesList.Count == 0)
                {
                    InsertDefaultValues();
                }
                lcRefreshRatesList.SelectedListItemIndex = 0;
            }
        }
Пример #17
0
        private void LoadSettings()
        {
            videosShareListcontrol.Clear();
            SettingsSharesHelper settingsSharesHelper = new SettingsSharesHelper();

            // Load share settings
            settingsSharesHelper.LoadSettings(_section);

            // ToggleButtons
            btnAddOpticalDrives.Selected     = settingsSharesHelper.AddOpticalDiskDrives;
            btnRemeberLastFolder.Selected    = settingsSharesHelper.RememberLastFolder;
            btnAutoSwitchRemovables.Selected = settingsSharesHelper.SwitchRemovableDrives;


            foreach (var item in settingsSharesHelper.ShareListControl)
            {
                item.OnItemSelected += OnItemSelected;
                videosShareListcontrol.Add(item);

                if (item.IsPlayed)
                {
                    _defaultShare = FolderInfo(item).Name;
                }
            }

            Sort();

            if (videosShareListcontrol.Count > 0)
            {
                videosShareListcontrol.SelectedListItemIndex = 0;
                _shareFolderListItem      = videosShareListcontrol.SelectedListItem;
                _folderDefaultLayoutIndex = SettingsSharesHelper.ProperDefaultFromLayout(FolderInfo(_shareFolderListItem).DefaultLayout);
            }

            using (Profile.Settings xmlreader = new MPSettings())
            {
                _globalVideoThumbsEnaled = xmlreader.GetValueAsBool("thumbnails", "videoondemand", true);
            }
        }
Пример #18
0
        public void ShowTorrents()
        {
            if (torrentList == null)
            {
                return;
            }
            List <GUIListItem> tl = new List <GUIListItem>();
            var TA = TorrentEngine.Instance().GetTorrents(TorrentView, SortOrder, LabelFilter);

            foreach (Torrent torrent in TA)
            {
                GUIListItem item = new GUIListItem(string.Format("{0}", Ellipsis(torrent.Name, 75)));
                //GUIImage image = new GUIImage(5678);
                //item.Icon = image;
                //item.IconImage = System.IO.Path.Combine(GUIGraphicsContext.Skin, @"\Media\icon_empty_focus1.png");
                item.AlbumInfoTag = torrent;
                tl.Add(item);

                if (item.Label2 != string.Format("{0} ({1:F2}%)", UnitConvert.SizeToString(torrent.Size), torrent.Progress))
                {
                    item.Label2 = string.Format("{0} ({1:F2}%)", UnitConvert.SizeToString(torrent.Size), torrent.Progress);
                }
            }

            torrentList.ListItems = tl;

            if (torrentList.ListItems.Count == 0)
            {
                GUIPropertyManager.SetProperty("#MyTorrents.Count", "0");
                GUIListItem item = new GUIListItem();
                item.Label = "No items.";
                torrentList.Add(item);
            }
            else
            {
                GUIPropertyManager.SetProperty("#MyTorrents.Count", String.Format("{0}", torrentList.ListItems.Count));
            }
        }
Пример #19
0
        private void GetAddress(string url)
        {
            string json = Util.Utils.DownLoadString(url);

            if (string.IsNullOrEmpty(json))
            {
                return;
            }

            Regex regex = new Regex(@"display_name.:.(.+?)\""");
            Match match = regex.Match(json);

            if (!match.Success)
            {
                return;
            }

            string address = match.Groups[1].Value;

            if (string.IsNullOrWhiteSpace(address))
            {
                return;
            }

            if (listExifProperties != null)
            {
                GUIListItem fileitem = new GUIListItem();
                fileitem.Label           = address;
                fileitem.Label2          = GUILocalizeStrings.Get(9039);
                fileitem.IconImage       = Thumbs.Pictures + @"\exif\data\address.png";
                fileitem.ThumbnailImage  = fileitem.IconImage;
                fileitem.OnItemSelected += OnItemSelected;
                listExifProperties.Add(fileitem);
                GUIPropertyManager.SetProperty("#itemcount", listExifProperties.Count.ToString());
            }
        }
Пример #20
0
        public override bool OnMessage(GUIMessage message)
        {
            //      needRefresh = true;
            switch (message.Message)
            {
            case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT:
            {
                lblHeading.Label = string.Empty;
                if (lblHeading2 != null)
                {
                    lblHeading2.Label = string.Empty;
                }

                base.OnMessage(message);
                return(true);
            }

            case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT:
            {
                base.OnMessage(message);

                listView.Clear();
                for (int i = 0; i < listItems.Count; i++)
                {
                    GUIListItem pItem = (GUIListItem)listItems[i];
                    listView.Add(pItem);
                }

                if (selectedItemIndex >= 0)
                {
                    GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECT, GetID, 0, listView.GetID,
                                                    selectedItemIndex, 0, null);
                    OnMessage(msg);
                }
                else if (listItems.Count > 0)
                {
                    GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECT, GetID, 0, listView.GetID,
                                                    0, 0, null);
                    OnMessage(msg);
                }
                selectedItemIndex = -1;
                selectedId        = -1;
                string wszText = String.Format("{0} {1}", listItems.Count, GUILocalizeStrings.Get(127));
            }
                return(true);
            }
            return(base.OnMessage(message));
        }
Пример #21
0
        private void Search()
        {
            Log.Info("newsearch Search:{0} {1}", _searchKeyword, SearchFor);
            GUIControl.ClearControl(GetID, listResults.GetID);
            TvBusinessLayer layer        = new TvBusinessLayer();
            IList <Program> listPrograms = null;

            switch (SearchFor)
            {
            case SearchType.Genres:
                listPrograms = layer.SearchProgramsPerGenre("%" + _searchKeyword + "%", "");
                break;

            case SearchType.KeyWord:
                listPrograms = layer.SearchProgramsByDescription("%" + _searchKeyword);
                break;

            case SearchType.Title:
                listPrograms = layer.SearchPrograms("%" + _searchKeyword);
                break;
            }
            if (listPrograms == null)
            {
                return;
            }
            if (listPrograms.Count == 0)
            {
                return;
            }
            Log.Info("newsearch found:{0} progs", listPrograms.Count);
            foreach (Program program in listPrograms)
            {
                GUIListItem item = new GUIListItem();
                item.Label = TVUtil.GetDisplayTitle(program);
                string logo = Utils.GetCoverArt(Thumbs.TVChannel, program.ReferencedChannel().DisplayName);
                if (string.IsNullOrEmpty(logo))
                {
                    logo = "defaultVideoBig.png";
                }
                item.ThumbnailImage = logo;
                item.IconImageBig   = logo;
                item.IconImage      = logo;
                item.TVTag          = program;
                listResults.Add(item);
            }
        }
Пример #22
0
        private void UpdateAlbumCoverList()
        {
            if (listView == null)
            {
                return;
            }

            listView.Clear();

            Console.WriteLine("Current cover art image: " + imgCoverArt.FileName);
            imgCoverArt.SetFileName("");
            imgCoverArt.SetFileName(_ThumbPath);
            Console.WriteLine("New cover art image: " + imgCoverArt.FileName);

            if (amazonWS.HasAlbums)
            {
                for (int i = 0; i < amazonWS.AlbumCount; i++)
                {
                    AlbumInfo   albuminfo = (AlbumInfo)amazonWS.AlbumInfoList[i];
                    GUIListItem item      = new GUIListItem(albuminfo.Album);
                    item.Label2       = albuminfo.Artist;
                    item.IconImageBig = albuminfo.Image;
                    item.IconImage    = albuminfo.Image;
                    listView.Add(item);
                }

                //listView.Focus = true;
                //btnCancel.Focus = false;

                listView.Focus  = true;
                btnCancel.Focus = false;
                btnSkip.Focus   = false;
            }

            else
            {
                listView.Focus = false;
                //btnCancel.Focus = true;
                //btnSkip.Focus = false;
                btnCancel.Focus = false;
                btnSkip.Focus   = true;
            }
        }
Пример #23
0
 protected void FillSimilarList()
 {
     //if (GUIWindowManager.ActiveWindow != GetID)
     //  return;
     if (listsimilar == null)
     {
         return;
     }
     GUIControl.ClearControl(GetID, listsimilar.GetID);
     if (similar == null || similar.Count < 1)
     {
         return;
     }
     foreach (GUIListItem item in similar)
     {
         listsimilar.Add(item);
     }
     listsimilar.SelectedListItemIndex = 0;
 }
Пример #24
0
        public void AddConflictRecording(GUIListItem item)
        {
            string logo = MediaPortal.Util.Utils.GetCoverArt(Thumbs.TVChannel, item.Label3);

            if (!MediaPortal.Util.Utils.FileExistsInCache(logo))
            {
                logo = "defaultVideoBig.png";
            }
            item.ThumbnailImage  = logo;
            item.IconImageBig    = logo;
            item.IconImage       = logo;
            item.OnItemSelected += OnListItemSelected;

            GUIListControl list = (GUIListControl)GetControl((int)Controls.LIST);

            if (list != null)
            {
                list.Add(item);
            }
        }
        private void LoadSettings()
        {
            using (Profile.Settings xmlreader = new Profile.MPSettings())
            {
                _noLargeThumbnails = xmlreader.GetValueAsBool("thumbnails", "picturenolargethumbondemand", true);

                lcFolders.Clear();
                _scanShare = 0;
                SettingsSharesHelper settingsSharesHelper = new SettingsSharesHelper();
                // Load share settings
                settingsSharesHelper.LoadSettings("pictures");

                foreach (GUIListItem item in settingsSharesHelper.ShareListControl)
                {
                    string driveLetter = FolderInfo(item).Folder.Substring(0, 3).ToUpperInvariant();

                    if (driveLetter.StartsWith("\\\\") || Util.Utils.getDriveType(driveLetter) == 3 ||
                        Util.Utils.getDriveType(driveLetter) == 4)
                    {
                        item.IsPlayed = false;

                        if (FolderInfo(item).ScanShare)
                        {
                            item.IsPlayed = true;
                            item.Label2   = GUILocalizeStrings.Get(193); // Scan
                            _scanShare++;
                        }
                        item.OnItemSelected += OnItemSelected;
                        item.Label           = FolderInfo(item).Folder;

                        item.Path = FolderInfo(item).Folder;
                        lcFolders.Add(item);
                    }
                }
                _defaultShare              = xmlreader.GetValueAsString("pictures", "default", "");
                _rememberLastFolder        = xmlreader.GetValueAsBool("pictures", "rememberlastfolder", false);
                _addOpticalDiskDrives      = xmlreader.GetValueAsBool("pictures", "AddOpticalDiskDrives", true);
                _autoSwitchRemovableDrives = xmlreader.GetValueAsBool("pictures", "SwitchRemovableDrives", true);
            }
        }
Пример #26
0
        private void FillList()
        {
            string url = string.Format("http://opml.radiotime.com/Browse.ashx?c=schedule&id={0}", GuidId);

            grabber.GetData(url, true, false);
            foreach (var body in grabber.Body)
            {
                GUIListItem item = new GUIListItem("");
                item.Label2   = ToMinutes(body.Duration);
                item.Label    = body.Start;
                item.Label3   = body.Text;
                item.MusicTag = body;
                DownloadFile(body);
                item.OnRetrieveArt += item_OnRetrieveArt;
                lstChannelsWithStateIcons.Add(item);
            }
            if (lstChannelsWithStateIcons.GetID == 37)
            {
                var msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SETFOCUS, GetID, 0, 37, 0, 0, null);
                OnMessage(msg);
            }
        }
Пример #27
0
        public void InsertTVProgs(ref GUIListControl lcProgramList, DateTime start, DateTime stop)
        {
            IList list = PersonalTVGuideMap.ListAll();

            foreach (PersonalTVGuideMap map in list)
            {
                Program prog = Program.Retrieve(map.IdProgram);
                if ((prog.StartTime >= start) && (prog.StartTime < stop))
                {
                    GUIListItem item = new GUIListItem();
                    item.Label = prog.Title;
                    if (prog.EpisodeNum != String.Empty)
                    {
                        item.Label += "\n" + prog.EpisodeNum;
                    }
                    item.Label2 = String.Format("{0} {1} - {2}",
                                                Utils.GetShortDayString(prog.StartTime),
                                                prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                                prog.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
                    string strLogo = Utils.GetCoverArt(Thumbs.TVChannel, prog.ReferencedChannel().Name);
                    if (!System.IO.File.Exists(strLogo))
                    {
                        strLogo = "defaultVideoBig.png";
                    }
                    item.ThumbnailImage = strLogo;
                    item.IconImage      = strLogo;
                    item.IconImageBig   = strLogo;
                    //item.PinImage = RecordingIconStr(prog);
                    item.DVDLabel = prog.Description;
                    item.TVTag    = prog;
                    item.MusicTag = map;
                    //item.Rating = Ranking;
                    //item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnProgItemSelected);
                    lcProgramList.Add(item);
                }
            }
        }
Пример #28
0
        private void Update(Schedule _schedule)
        {
            _upcomingEpsiodesList.Clear();
            if (_programTimeLabel != null && _programTitleFadeLabel != null)
            {
                if (_upcomingProgram != null)
                {
                    string strTime = String.Format("{0} {1} - {2}",
                                                   Utility.GetShortDayDateString(_upcomingProgram.StartTime),
                                                   _upcomingProgram.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                                   _upcomingProgram.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                    _programTimeLabel.Label      = strTime;
                    _programTitleFadeLabel.Label = _upcomingProgram.Title;
                }
                else
                {
                    _programTimeLabel.Label      = string.Empty;
                    _programTitleFadeLabel.Label = string.Empty;
                }
            }

            if (_schedule != null)
            {
                if (_schedule.ScheduleType == ScheduleType.Recording)
                {
                    var recordings = Proxies.ControlService.GetUpcomingRecordings(_schedule.ScheduleId, true).Result;
                    foreach (UpcomingRecording recording in recordings)
                    {
                        GUIListItem item  = new GUIListItem();
                        string      title = recording.Title;
                        item.Label = title;
                        string logoImagePath = Utility.GetLogoImage(recording.Program.Channel);
                        if (logoImagePath == null ||
                            !System.IO.File.Exists(logoImagePath))
                        {
                            item.Label    = String.Format("[{0}] {1}", recording.Program.Channel.DisplayName, title);
                            logoImagePath = "defaultVideoBig.png";
                        }

                        item.PinImage = Utility.GetIconImageFileName(ScheduleType.Recording, recording.Program.IsPartOfSeries,
                                                                     recording.Program.CancellationReason, recording);

                        item.TVTag          = recording;
                        item.ThumbnailImage = logoImagePath;
                        item.IconImageBig   = logoImagePath;
                        item.IconImage      = logoImagePath;
                        item.Label2         = String.Format("{0} {1} - {2}",
                                                            Utility.GetShortDayDateString(recording.StartTime),
                                                            recording.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                                            recording.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                        _upcomingEpsiodesList.Add(item);
                    }
                }
                else
                {
                    var _progs = Proxies.SchedulerService.GetUpcomingPrograms(_schedule, true).Result;
                    foreach (UpcomingProgram program in _progs)
                    {
                        GUIListItem item  = new GUIListItem();
                        string      title = program.Title;
                        item.Label = title;
                        //item.OnItemSelected += new global::MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected);
                        string logoImagePath = Utility.GetLogoImage(program.Channel);
                        if (logoImagePath == null ||
                            !System.IO.File.Exists(logoImagePath))
                        {
                            item.Label    = String.Format("[{0}] {1}", program.Channel.DisplayName, title);
                            logoImagePath = "defaultVideoBig.png";
                        }

                        if (_schedule.ScheduleType == ScheduleType.Alert)
                        {
                            item.PinImage = item.PinImage = Utility.GetIconImageFileName(ScheduleType.Alert, program.IsPartOfSeries,
                                                                                         program.CancellationReason, null);
                        }
                        item.TVTag          = program;
                        item.ThumbnailImage = logoImagePath;
                        item.IconImageBig   = logoImagePath;
                        item.IconImage      = logoImagePath;
                        item.Label2         = String.Format("{0} {1} - {2}",
                                                            Utility.GetShortDayDateString(program.StartTime),
                                                            program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                                            program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                        _upcomingEpsiodesList.Add(item);
                    }
                }
            }
            _upcomingEpisodesLabel.IsVisible = (_upcomingEpsiodesList != null && _upcomingEpsiodesList.Count > 0);
        }
        private void LoadSettings()
        {
            using (Profile.Settings xmlreader = new Profile.MPSettings())
            {
                btnExtractthumbs.Selected      = xmlreader.GetValueAsBool("musicfiles", "extractthumbs", true);
                btnCreateartistthumbs.Selected = xmlreader.GetValueAsBool("musicfiles", "createartistthumbs", false);
                btnCreategenrethumbs.Selected  = xmlreader.GetValueAsBool("musicfiles", "creategenrethumbs", true);
                btnUseFolderThumbs.Selected    = xmlreader.GetValueAsBool("musicfiles", "useFolderThumbs", false);
                btnUseAllImages.Selected       = xmlreader.GetValueAsBool("musicfiles", "useAllImages",
                                                                          btnUseFolderThumbs.Selected);
                btnTreatFolderAsAlbum.Selected = xmlreader.GetValueAsBool("musicfiles", "treatFolderAsAlbum", false);

                if (btnTreatFolderAsAlbum.Selected)
                {
                    btnCreateMissingFolderThumbs.IsEnabled = true;
                }
                else
                {
                    btnCreateMissingFolderThumbs.IsEnabled = false;
                }

                btnCreateMissingFolderThumbs.Selected = xmlreader.GetValueAsBool("musicfiles", "createMissingFolderThumbs",
                                                                                 btnTreatFolderAsAlbum.Selected);
                btnMonitorShares.Selected         = xmlreader.GetValueAsBool("musicfiles", "monitorShares", false);
                btnUpdateSinceLastImport.Selected = xmlreader.GetValueAsBool("musicfiles", "updateSinceLastImport", true);
                _updateSinceLastImport            = String.Format("Only update files after {0}",
                                                                  xmlreader.GetValueAsString("musicfiles", "lastImport",
                                                                                             "1900-01-01 00:00:00"));
                btnStripartistprefixes.Selected = xmlreader.GetValueAsBool("musicfiles", "stripartistprefixes", false);
                _prefixes = xmlreader.GetValueAsString("musicfiles", "artistprefixes", "The, Les, Die");
                _dateAddedSelectedIndex = xmlreader.GetValueAsInt("musicfiles", "dateadded", 0);

                lcFolders.Clear();
                _scanShare = 0;
                SettingsSharesHelper settingsSharesHelper = new SettingsSharesHelper();
                // Load share settings
                settingsSharesHelper.LoadSettings("music");

                foreach (GUIListItem item in settingsSharesHelper.ShareListControl)
                {
                    string driveLetter = FolderInfo(item).Folder.Substring(0, 3).ToUpper();

                    if (driveLetter.StartsWith("\\\\") || Util.Utils.getDriveType(driveLetter) == 3 ||
                        Util.Utils.getDriveType(driveLetter) == 4)
                    {
                        item.IsPlayed = false;

                        if (FolderInfo(item).ScanShare)
                        {
                            item.IsPlayed = true;
                            item.Label2   = GUILocalizeStrings.Get(193);
                            _scanShare++;
                        }
                        item.OnItemSelected += OnItemSelected;
                        item.Label           = FolderInfo(item).Folder;

                        item.Path = FolderInfo(item).Folder;
                        lcFolders.Add(item);
                    }
                }
                _defaultShare              = xmlreader.GetValueAsString("music", "default", "");
                _rememberLastFolder        = xmlreader.GetValueAsBool("music", "rememberlastfolder", false);
                _addOpticalDiskDrives      = xmlreader.GetValueAsBool("music", "AddOpticalDiskDrives", true);
                _autoSwitchRemovableDrives = xmlreader.GetValueAsBool("music", "SwitchRemovableDrives", true);
            }
        }
Пример #30
0
        private void LoadDirectory()
        {
            IList <Conflict> conflictsList = Conflict.ListAll();

            btnConflicts.Visible = conflictsList.Count > 0;
            GUIControl.ClearControl(GetID, listSchedules.GetID);
            IList <Schedule> schedulesList = Schedule.ListAll();
            int  total      = 0;
            bool showSeries = btnSeries.Selected;

            if ((selectedItem != null) && (showSeries))
            {
                IList <Schedule> seriesList = TVHome.Util.GetRecordingTimes(selectedItem);

                GUIListItem item = new GUIListItem();
                item.Label    = "..";
                item.IsFolder = true;
                listSchedules.Add(item);
                //don't increment total for ".."
                //total++;

                foreach (Schedule schedule in seriesList)
                {
                    if (DateTime.Now > schedule.EndTime)
                    {
                        continue;
                    }
                    if (schedule.Canceled != Schedule.MinSchedule)
                    {
                        continue;
                    }

                    item       = Schedule2ListItem(schedule);
                    item.TVTag = schedule;
                    listSchedules.Add(item);
                    total++;
                }
            }
            else
            {
                foreach (Schedule rec in schedulesList)
                {
                    GUIListItem item = new GUIListItem();
                    if (rec.ScheduleType != (int)ScheduleRecordingType.Once)
                    {
                        if (showSeries)
                        {
                            item          = Schedule2ListItem(rec);
                            item.TVTag    = rec;
                            item.IsFolder = true;
                            listSchedules.Add(item);
                            total++;
                        }
                        else
                        {
                            IList <Schedule> seriesList = TVHome.Util.GetRecordingTimes(rec);
                            for (int serieNr = 0; serieNr < seriesList.Count; ++serieNr)
                            {
                                Schedule recSeries = (Schedule)seriesList[serieNr];
                                if (DateTime.Now > recSeries.EndTime)
                                {
                                    continue;
                                }
                                if (recSeries.Canceled != Schedule.MinSchedule)
                                {
                                    continue;
                                }

                                item          = Schedule2ListItem(recSeries);
                                item.MusicTag = rec;
                                item.TVTag    = recSeries;
                                listSchedules.Add(item);
                                total++;
                            }
                        }
                    } //if (recs.Count > 1 && currentSortMethod == SortMethod.Date)
                    else
                    {
                        //single recording
                        if (showSeries)
                        {
                            continue; // do not show single recordings if showSeries is enabled
                        }
                        if (rec.IsSerieIsCanceled(rec.StartTime, rec.IdChannel))
                        {
                            continue;
                        }

                        //Test if this is an instance of a series recording, if so skip it.
                        if (rec.ReferencedSchedule() != null)
                        {
                            continue;
                        }
                        item       = Schedule2ListItem(rec);
                        item.TVTag = rec;
                        listSchedules.Add(item);
                        total++;
                    }
                } //foreach (Schedule rec in itemlist)
            }

            //set object count label
            GUIPropertyManager.SetProperty("#itemcount", Utils.GetObjectCountLabel(total));
            if (total == 0)
            {
                SetProperties(null, null);
            }

            OnSort();
            UpdateButtonStates();
        }