Ejemplo n.º 1
0
        public TorrentItem GetItem(TorrentItem item)
        {
            TorrentItem m;
            var         theTitle = TitleNormaliser.NormaliseTitle(item.Title, item.Type);

            if (TheHt.ContainsKey(theTitle))
            {
                m = (TorrentItem)TheHt[item.Title.ToUpper()];
                CacheHits++;
            }
            else
            {
                //  new it up
                m = new TorrentItem
                {
                    Filename    = item.Filename,
                    Title       = TitleNormaliser.NormaliseTitle(item.Title, item.Type),
                    LibraryDate = item.LibraryDate,
                    Type        = item.Type
                };
                PutItem(m);
                CacheMisses++;
            }
            return(m);
        }
 private void AddFromTsunamiCore(object sender, EventsArgs.OnTorrentAddedEventArgs e)
 {
     TorrentItem ob = new TorrentItem(e.QueuePosition, e.Name, e.Hash, 0, 0, e.Status, e.Progress, 0, 0, 0);
     System.Windows.Application.Current.Dispatcher.Invoke(() => {
         _torrentList.Add(ob);
     });
 }
        private TorrentItem GetTorrentsByHorribleSubsOutput(HorribleSubsOutput data)
        {
            TorrentSource output = new TorrentItem();

            output.DateCreated = data.

                                 return(output);
        }
Ejemplo n.º 4
0
 private void WriteMediaNode(XmlTextWriter writer, TorrentItem m)
 {
     writer.WriteStartElement("media-item");
     WriteElement(writer, "filename", m.Filename);
     WriteElement(writer, "type", m.Type);
     WriteElement(
         writer,
         "title", TitleNormaliser.NormaliseTitle(
             m.Title,
             m.Type,
             false));
     WriteElement(writer, "libdate", m.LibraryDate.ToShortDateString());
     writer.WriteEndElement();
 }
Ejemplo n.º 5
0
        public void PutItem(TorrentItem m)
        {
            var title = m.Title;

            if (!TheHt.ContainsKey(title))
            {
                TheHt.Add(title, m);
                IsDirty = true;
                Logger.Trace($"    {title} added to HT");
            }
            else
            {
                Logger.Trace($"    {title} already in HT");
            }
        }
Ejemplo n.º 6
0
 public void AddTorrentItem(TorrentItem m)
 {
     PutItem(m);
 }