/// <summary>
        /// Resolves the video.
        /// </summary>
        /// <typeparam name="TVideoType">The type of the T video type.</typeparam>
        /// <param name="args">The args.</param>
        /// <returns>``0.</returns>
        protected TVideoType ResolveVideo <TVideoType>(ItemResolveArgs args)
            where TVideoType : Video, new()
        {
            // If the path is a file check for a matching extensions
            if (!args.IsDirectory)
            {
                // http://wiki.xbmc.org/index.php?title=Media_stubs
                var isPlaceHolder = EntityResolutionHelper.IsVideoPlaceHolder(args.Path);

                var extension = Path.GetExtension(args.Path);

                var isShortcut = string.Equals(extension, ".strm", StringComparison.OrdinalIgnoreCase);

                if (EntityResolutionHelper.IsVideoFile(args.Path) || isPlaceHolder || isShortcut)
                {
                    var type = string.Equals(extension, ".iso", StringComparison.OrdinalIgnoreCase) || string.Equals(extension, ".img", StringComparison.OrdinalIgnoreCase) ?
                               VideoType.Iso : VideoType.VideoFile;

                    var path = args.Path;

                    var video = new TVideoType
                    {
                        VideoType       = type,
                        Path            = args.Path,
                        IsInMixedFolder = true,
                        IsPlaceHolder   = isPlaceHolder,
                        IsShortcut      = isShortcut
                    };

                    if (isPlaceHolder)
                    {
                        if (args.Path.EndsWith("dvd.disc", StringComparison.OrdinalIgnoreCase))
                        {
                            video.VideoType = VideoType.Dvd;
                        }
                        else if (args.Path.EndsWith("hddvd.disc", StringComparison.OrdinalIgnoreCase))
                        {
                            video.VideoType = VideoType.HdDvd;
                        }
                        else if (args.Path.EndsWith("bluray.disc", StringComparison.OrdinalIgnoreCase) ||
                                 args.Path.EndsWith("brrip.disc", StringComparison.OrdinalIgnoreCase) ||
                                 args.Path.EndsWith("bd25.disc", StringComparison.OrdinalIgnoreCase) ||
                                 args.Path.EndsWith("bd50.disc", StringComparison.OrdinalIgnoreCase))
                        {
                            video.VideoType = VideoType.BluRay;
                        }
                    }

                    return(video);
                }
            }

            return(null);
        }
        /// <summary>
        /// Resolves the specified args.
        /// </summary>
        /// <param name="args">The args.</param>
        /// <returns>`0.</returns>
        protected override T Resolve(ItemResolveArgs args)
        {
            // If the path is a file check for a matching extensions
            if (!args.IsDirectory)
            {
                if (EntityResolutionHelper.IsVideoFile(args.Path))
                {
                    var extension = Path.GetExtension(args.Path);

                    var type = string.Equals(extension, ".iso", StringComparison.OrdinalIgnoreCase) || string.Equals(extension, ".img", StringComparison.OrdinalIgnoreCase) ?
                               VideoType.Iso : VideoType.VideoFile;

                    return(new T
                    {
                        VideoType = type,
                        Path = args.Path
                    });
                }
            }

            return(null);
        }
Example #3
0
        /// <summary>
        /// Resolves the video.
        /// </summary>
        /// <typeparam name="TVideoType">The type of the T video type.</typeparam>
        /// <param name="args">The args.</param>
        /// <returns>``0.</returns>
        protected TVideoType ResolveVideo <TVideoType>(ItemResolveArgs args)
            where TVideoType : Video, new()
        {
            // If the path is a file check for a matching extensions
            if (!args.IsDirectory)
            {
                if (EntityResolutionHelper.IsVideoFile(args.Path))
                {
                    var extension = Path.GetExtension(args.Path);

                    var type = string.Equals(extension, ".iso", StringComparison.OrdinalIgnoreCase) || string.Equals(extension, ".img", StringComparison.OrdinalIgnoreCase) ?
                               VideoType.Iso : VideoType.VideoFile;

                    return(new TVideoType
                    {
                        VideoType = type,
                        Path = args.Path,
                        IsInMixedFolder = true
                    });
                }
            }

            return(null);
        }