Beispiel #1
0
        public void DownloadVideo()
        {
            //GetStream
            Progress.StatusMsg = "GetStream...";
            string Errlabel = "";

            string[] TidalVideoUrls = TidalTool.getVideoDLUrls(TidalVideo.ID.ToString(), Resolution, out Errlabel);
            if (Errlabel.IsNotBlank())
            {
                goto ERR_RETURN;
            }
            string TsFilePath = TidalTool.getVideoPath(OutputDir, TidalVideo, TidalAlbum, ".ts", hyphen: AddHyphen, plist: TidalPlaylist, artistBeforeTitle: ArtistBeforeTitle, addYear: AddYear);

            //Download
            Progress.StatusMsg = "Start...";
            if (!(bool)M3u8Helper.Download(TidalVideoUrls, TsFilePath, ProgressNotify, Proxy: TidalTool.PROXY))
            {
                Errlabel = "Download failed!";
                goto ERR_RETURN;
            }

            //Convert
            FilePath = TidalTool.getVideoPath(OutputDir, TidalVideo, TidalAlbum, hyphen: AddHyphen, plist: TidalPlaylist, artistBeforeTitle: ArtistBeforeTitle, addYear: AddYear);
            if (!FFmpegHelper.IsExist())
            {
                Errlabel = "FFmpeg is not exist!";
                goto ERR_RETURN;
            }
            if (!FFmpegHelper.Convert(TsFilePath, FilePath))
            {
                Errlabel = "Convert failed!";
                goto ERR_RETURN;
            }
            System.IO.File.Delete(TsFilePath);

            //SetMetaData
            string sLabel = TidalTool.SetMetaData(FilePath, null, null, null, null, TidalVideo);

            if (sLabel.IsNotBlank())
            {
                Errlabel = "Set metadata failed!";
                goto ERR_RETURN;
            }

            Progress.SetStatus(ProgressHelper.STATUS.COMPLETE);
            return;

ERR_RETURN:
            if (Progress.GetStatus() == ProgressHelper.STATUS.CANCLE)
            {
                return;
            }

            ErrlabelHeight = 15;
            Progress.SetStatus(ProgressHelper.STATUS.ERROR);
            Progress.Errmsg = Errlabel;
        }
Beispiel #2
0
        public void DownloadVideo()
        {
            //GetStream
            Progress.StatusMsg = "GetStream...";
            string Errlabel = "";

            string[] TidalVideoUrls = TidalTool.getVideoDLUrls(TidalVideo.ID.ToString(), Resolution, out Errlabel);
            if (Errlabel.IsNotBlank())
            {
                goto ERR_RETURN;
            }
            string TsFilePath = TidalTool.getVideoPath(OutputDir, TidalVideo, TidalAlbum, ".ts");

            //Download
            Progress.StatusMsg = "Start...";
            if (!(bool)M3u8Helper.Download(TidalVideoUrls, TsFilePath, ProgressNotify))
            {
                Errlabel = "Download failed!";
                goto ERR_RETURN;
            }

            //Convert
            FilePath = TidalTool.getVideoPath(OutputDir, TidalVideo, TidalAlbum);
            if (!FFmpegHelper.IsExist())
            {
                Errlabel = "FFmpeg is not exist!";
                goto ERR_RETURN;
            }
            if (!FFmpegHelper.Convert(TsFilePath, FilePath))
            {
                Errlabel = "Convert failed!";
                goto ERR_RETURN;
            }
            System.IO.File.Delete(TsFilePath);
            Progress.SetStatus(ProgressHelper.STATUS.COMPLETE);
            return;

ERR_RETURN:
            if (Progress.GetStatus() == ProgressHelper.STATUS.CANCLE)
            {
                return;
            }

            ErrlabelHeight = 15;
            Progress.SetStatus(ProgressHelper.STATUS.ERROR);
            Progress.Errmsg = Errlabel;
        }