Example #1
0
 public ArchiveItemContainer(ItemContainer parent, P2pProxyDevice device) : base(parent, device)
 {
     Type        = MediaType.Video;
     _childItems = new List <Item>();
     IconUrl     = "";
     Id          = "archives";
     Title       = "Архив";
     ParentId    = parent.GetIds();
     this.parent = parent;
 }
Example #2
0
 public ChannelItemContainer(ItemContainer parent, P2pProxyDevice device) : base(parent, device)
 {
     Type        = MediaType.Video;
     _childItems = new List <Item>();
     IconUrl     = "";
     Id          = "channels";
     Title       = "Каналы";
     ParentId    = parent.GetIds();
     this.parent = parent;
 }
Example #3
0
 public PluginContainer(ItemContainer parent, P2pProxyDevice device, IPluginProxy plugin) : base(parent, device)
 {
     _plugin = plugin;
     Id      = _plugin.Id;
     Title   = _plugin.Name;
     if (parent != null)
     {
         ParentId = parent.GetIds();
     }
     Type = MediaType.Video;
 }
Example #4
0
 private void UpdatePlaylist(string host)
 {
     if (_lastUpdate + _maxAge < DateTime.Now)
     {
         _childItems.Clear();
         var res = new TTVApi.TranslationList(TTVApi.FilterType.all).Run(_device.Proxy.SessionState.session);
         if (!res.IsSuccess)
         {
             while (!_device.Proxy.Login() || _device.Proxy.SessionState.Error == TTVApi.ApiError.noconnect)
             {
             }
             if (!_device.Proxy.SessionState.IsSuccess)
             {
                 throw new Exception("No authorized");
             }
         }
         foreach (var cat in res.categories)
         {
             ItemContainer container = new ItemContainer(this, _device)
             {
                 Type     = MediaType.Video,
                 IconUrl  = "RandomFromChild",
                 Id       = cat.id.ToString(),
                 Title    = cat.name,
                 ParentId = ParentId + "_" + Id
             };
             TTVApi.ChannelGroup cat1 = cat;
             foreach (var source in res.channels.Where(channel => channel.group == cat1.id))
             {
                 container.AddChild(new ItemStream(container, MediaType.Video, _device)
                 {
                     IconUrl    = source.ObsaluteLogo,
                     Id         = source.id.ToString(),
                     Title      = source.name,
                     ParentId   = container.GetIds(),
                     ContentUrl = String.Format("{0}/channels/play?id={1}", host, source.id) + (!string.IsNullOrEmpty(_device.UpnpSettings.Profile.Live.Info[0].TranscodingProfile) ? "&transcode=" + _device.UpnpSettings.Profile.Live.Info[0].TranscodingProfile : "")
                 });
             }
             AddChild(container);
         }
         _lastUpdate = DateTime.Now;
     }
 }
Example #5
0
 public PluginContainer(ItemContainer parent, P2pProxyDevice device, IPluginProxy plugin) : base(parent, device)
 {
     _plugin = plugin;
     Id = _plugin.Id;
     Title = _plugin.Name;
     if (parent != null)
         ParentId = parent.GetIds();
     Type = MediaType.Video;
 }
Example #6
0
 public ArchiveItemContainer(ItemContainer parent, P2pProxyDevice device) : base(parent, device)
 {
     Type = MediaType.Video;
     _childItems = new List<Item>();
     IconUrl = "";
     Id = "archives";
     Title = "Архив";
     ParentId = parent.GetIds();
     this.parent = parent;
     
 }
Example #7
0
        private void UpdatePlaylist(string host)
        {
            if (_lastUpdate + _maxAge < DateTime.Now)
            {
                _childItems.Clear();
                var res = new TTVApi.TranslationList(TTVApi.FilterType.all).Run(_device.Proxy.SessionState.session);
                if (!res.IsSuccess)
                {
                    while (!_device.Proxy.Login() || _device.Proxy.SessionState.Error == TTVApi.ApiError.noconnect)
                    {

                    }
                    if (!_device.Proxy.SessionState.IsSuccess)
                        throw new Exception("No authorized");
                }
                foreach (var cat in res.categories)
                {
                    ItemContainer container = new ItemContainer(this, _device)
                                                  {
                                                      Type = MediaType.Video,
                                                      IconUrl = "RandomFromChild",
                                                      Id = cat.id.ToString(),
                                                      Title = cat.name,
                                                      ParentId = ParentId + "_" + Id
                                                  };
                    TTVApi.ChannelGroup cat1 = cat;
                    foreach (var source in res.channels.Where(channel => channel.group == cat1.id))
                    {
                        container.AddChild(new ItemStream(container, MediaType.Video, _device)
                                               {
                                                   IconUrl = source.ObsaluteLogo,
                                                   Id = source.id.ToString(),
                                                   Title = source.name,
                                                   ParentId = container.GetIds(),
                                                   ContentUrl = String.Format("{0}/channels/play?id={1}", host, source.id) + (!string.IsNullOrEmpty(_device.UpnpSettings.Profile.Live.Info[0].TranscodingProfile) ? "&transcode=" + _device.UpnpSettings.Profile.Live.Info[0].TranscodingProfile : "")
                                               });
                    }
                    AddChild(container);
                }
                _lastUpdate = DateTime.Now;
            }
        }
Example #8
0
 public ChannelItemContainer(ItemContainer parent, P2pProxyDevice device) : base(parent, device)
 {
     Type = MediaType.Video;
     _childItems = new List<Item>();
     IconUrl = "";
     Id = "channels";
     Title = "Каналы";
     ParentId = parent.GetIds();
     this.parent = parent;
 }