Пример #1
0
        public static string FileNameWithQualityNameExtention(this NicoVideoQuality quality, string filename)
        {
            var toQualityNameExtention = filename;

            switch (quality)
            {
            case NicoVideoQuality.Original:
                toQualityNameExtention = Path.ChangeExtension(filename, ".mp4");
                break;

            case NicoVideoQuality.Low:
                toQualityNameExtention = Path.ChangeExtension(filename, ".low.mp4");
                break;

            case NicoVideoQuality.Dmc_Low:
                toQualityNameExtention = Path.ChangeExtension(filename, ".xlow.mp4");
                break;

            case NicoVideoQuality.Dmc_Midium:
                toQualityNameExtention = Path.ChangeExtension(filename, ".xmid.mp4");
                break;

            case NicoVideoQuality.Dmc_High:
                toQualityNameExtention = Path.ChangeExtension(filename, ".xhigh.mp4");
                break;

            default:
                throw new NotSupportedException(quality.ToString());
            }

            return(toQualityNameExtention);
        }
 public LocalVideoStreamingSession(IStorageFile file, NicoVideoQuality requestQuality, NiconicoSession niconicoSession)
     : base(niconicoSession, null)
 {
     File      = file;
     Quality   = requestQuality;
     QualityId = requestQuality.ToString();
 }
 public CachedVideoStreamingSession(VideoCacheItem videoCacheItem, NiconicoSession niconicoSession)
     : base(niconicoSession, null)
 {
     Quality         = videoCacheItem.DownloadedVideoQuality;
     QualityId       = Quality.ToString();
     _videoCacheItem = videoCacheItem;
 }
Пример #4
0
        public DividedQualityNicoVideo GetDividedQualityNicoVideo(NicoVideoQuality quality)
        {
            DividedQualityNicoVideo qualityDividedVideo = null;

            if (_InterfaceByQuality.ContainsKey(quality))
            {
                qualityDividedVideo = _InterfaceByQuality[quality];
            }
            else
            {
                switch (quality)
                {
                case NicoVideoQuality.Original:
                    qualityDividedVideo = new OriginalQualityNicoVideo(this, _NiconicoMediaManager);
                    break;

                case NicoVideoQuality.Low:
                    qualityDividedVideo = new LowQualityNicoVideo(this, _NiconicoMediaManager);
                    break;

                case NicoVideoQuality.Dmc_High:
                    qualityDividedVideo = new DmcQualityNicoVideo(quality, this, _NiconicoMediaManager);
                    break;

                case NicoVideoQuality.Dmc_Midium:
                    qualityDividedVideo = new DmcQualityNicoVideo(quality, this, _NiconicoMediaManager);
                    break;

                case NicoVideoQuality.Dmc_Low:
                    qualityDividedVideo = new DmcQualityNicoVideo(quality, this, _NiconicoMediaManager);
                    break;

                case NicoVideoQuality.Dmc_Mobile:
                    qualityDividedVideo = new DmcQualityNicoVideo(quality, this, _NiconicoMediaManager);
                    break;

                default:
                    throw new NotSupportedException(quality.ToString());
                }

                _InterfaceByQuality.Add(quality, qualityDividedVideo);
                _QualityDividedVideos.Add(qualityDividedVideo);
            }

            return(qualityDividedVideo);
        }
Пример #5
0
        public static string MakeCacheVideoFileName(string title, string videoId, MovieType videoType, NicoVideoQuality quality)
        {
            string toQualityNameExtention;
            // Note: 後尾に.mp4はダミー拡張子
            // Path.ChangeExtention実行時に動画タイトルにドットが含まれている場合に問題が発生しないようにするためのもの
            var filename = $"{title.ToSafeFilePath()} - [{videoId}].mp4";

            switch (quality)
            {
            case NicoVideoQuality.Smile_Original:
                toQualityNameExtention = Path.ChangeExtension(filename, $".{videoType.ToString().ToLower()}");
                break;

            case NicoVideoQuality.Smile_Low:
                toQualityNameExtention = Path.ChangeExtension(filename, $".low.{videoType.ToString().ToLower()}");
                break;

            case NicoVideoQuality.Dmc_High:
                toQualityNameExtention = Path.ChangeExtension(filename, $".dmc_high.{videoType.ToString().ToLower()}");
                break;

            case NicoVideoQuality.Dmc_Midium:
                toQualityNameExtention = Path.ChangeExtension(filename, $".dmc_midium.{videoType.ToString().ToLower()}");
                break;

            case NicoVideoQuality.Dmc_Low:
                toQualityNameExtention = Path.ChangeExtension(filename, $".dmc_low.{videoType.ToString().ToLower()}");
                break;

            case NicoVideoQuality.Dmc_Mobile:
                toQualityNameExtention = Path.ChangeExtension(filename, $".dmc_mobile.{videoType.ToString().ToLower()}");
                break;

            default:
                throw new NotSupportedException(quality.ToString());
            }

            return(toQualityNameExtention);
        }
Пример #6
0
 public DownloadProgressVideoStreamingSession(IRandomAccessStreamReference streamRef, NicoVideoQuality requestQuality)
 {
     StreamRef = streamRef;
     Quality   = requestQuality;
     QualityId = requestQuality.ToString();
 }