Exemple #1
0
        /// <summary>
        /// Called when a dynamic virtual folder is browsed to and allows it to be loaded if needed.
        /// The Root folder is always dynamic to permit on demand first time loading.
        /// </summary>
        /// <param name="vf">VirtualFolder that is being loaded (currently browsed to).</param>
        protected override void LoadDynamicVirtualFolder(VirtualFolder vf)
        {
            // We need to load the root folder as a special case
            if (vf == VFS.Root)
            {
                // Don't reload Root ever again
                vf.Dynamic = true;

                var service = new FullEpisodeService(new PlayOnHttpClient());

                foreach (var source in sources)
                {
                    VirtualFolder vfc      = VFS.CreateFolder(vf, source.Name, "", true);
                    var           playlist = service.FetchPlaylist(source.JsonUrl);
                    foreach (var item in playlist.Collections.Episodes.Content)
                    {
                        VFS.CreateVideoFile(vfc, item.Title, source.BaseVideoUrl + item.Id, item.Description, item.Images != null ? item.Images.Mezzanine : null, item.AirDate.Date, source.BaseVideoUrl + item.Id, null, item.DurationSeconds * 1000, 0, null, null);
                    }
                }
            }
        }
        /// <summary>
        /// Called when a dynamic virtual folder is browsed to and allows it to be loaded if needed.
        /// The Root folder is always dynamic to permit on demand first time loading.
        /// </summary>
        /// <param name="vf">VirtualFolder that is being loaded (currently browsed to).</param>
        protected override void LoadDynamicVirtualFolder(VirtualFolder vf)
        {
            // We need to load the root folder as a special case
            if (vf == VFS.Root)
            {
                // Don't reload Root ever again
                vf.Dynamic = true;

                var service = new FullEpisodeService();

                foreach (var source in sources)
                {
                    VirtualFolder vfc      = VFS.CreateFolder(vf, source.Name, "", false);
                    var           playlist = service.FetchPlaylist(source.JsonUrl);
                    foreach (var item in playlist.Collections.Episodes.Content)
                    {
                        VFS.CreateVideoFile(vfc, item.Title, source.BaseVideoUrl + item.Id, item.Description, item.Images != null ? item.Images.Mezzanine : null, DateTime.Today, "http://pbskids.org/video/daniel-tigers-neighborhood/" + item.Id, null, 25 * 60, 0, null, null);
                    }
                }
            }
        }