private void UpdateSearchResults()
        {
            try
            {
                SearchResults.Clear();
            }
            catch (Exception ex)
            {
            }
            IconMapping iconMapping = Configuration.Instance().Settings["MyTorrents.GlobalIconMapping"] as IconMapping;
            Regex       re          = null;

            if (_filter != "")
            {
                re = new Regex(_filter, RegexOptions.IgnoreCase);
            }
            foreach (TorrentMatch match in _matches)
            {
                if (re != null)
                {
                    if (!re.IsMatch(match.Title))
                    {
                        continue;
                    }
                }

                GUIListItem item = new GUIListItem();
                //item.PinImage = iconMapping.GetIcon(match.Title);
                item.PinImage        = match.Icon;
                item.Label           = String.Format("{0}- {1} - {2} ({3}:{4})", match.Category, match.SubCategory, match.Title, match.Seed, match.Leech);
                item.Label2          = match.Date.ToShortDateString();
                item.Label3          = UnitConvert.SizeToString(match.Size);
                item.OnItemSelected += OnSearchResultSelected;
                item.AlbumInfoTag    = match;
                SearchResults.Add(item);
            }

            GUIDialogProgress dlg = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS);

            dlg.Close();

            _progressDlg = null;
            GUIPropertyManager.SetProperty("#MyTorrents.Count", String.Format("{0}", SearchResults.Count));
        }
Beispiel #2
0
        public List <GUIListItem> ShowSelectedRSS(IRSSChannel channel)
        {
            _selectedRSSChannel = channel;
            List <GUIListItem> rsslist = new List <GUIListItem>();

            rsslist.Clear();
            IconMapping iconMapping = Configuration.Instance().Settings["MyTorrents.GlobalIconMapping"] as IconMapping;

            foreach (RSSItem item in channel.Items)
            {
                GUIListItem listItem = new GUIListItem();
                listItem.PinImage     = iconMapping.GetIcon(item.Title);
                listItem.Label        = (item.Title.Length > 130 ? item.Title.Substring(0, 130) : item.Title);
                listItem.Label2       = item.PublishDate.ToShortDateString() + " " + item.PublishDate.ToShortTimeString();
                listItem.AlbumInfoTag = item;
                rsslist.Add(listItem);
            }

            return(rsslist);
        }
Beispiel #3
0
        public bool LoadIconMappings(ConfigData _config)
        {
            XmlDocument xmlDoc = _config.MyTorrentsConfiguration;

            IconMapping rssIconMapping = new IconMapping();

            foreach (XmlNode iconMapping in xmlDoc.SelectNodes("config/iconmapping/map"))
            {
                XmlNode key  = iconMapping.SelectSingleNode("key");
                XmlNode icon = iconMapping.SelectSingleNode("icon");

                if (key != null && icon != null)
                {
                    rssIconMapping.Add(key.InnerText, icon.InnerText);
                }
            }

            Configuration.Instance().Settings.Add("MyTorrents.GlobalIconMapping", rssIconMapping);
            Log.Instance().Print("Loaded Icon Mappings");

            return(true);
        }