コード例 #1
0
ファイル: Model.cs プロジェクト: ChrisKolan/AudioDownloader
        public void FolderButtonClick()
        {
            var pathToAudioFolder = ApplicationPaths.GetAudioPath();

            Directory.CreateDirectory(pathToAudioFolder);
            Process.Start(pathToAudioFolder);
        }
コード例 #2
0
        private static string GenerateConstantCommand(string date, string escapedDownloadLink, string quality, string selectedQuatiy)
        {
            var metadata               = " --ignore-errors --no-mtime --add-metadata ";
            var title                  = "-%(playlist_index)s-%(title)s-%(id)s.%(ext)s ";
            var pathToAudioFolder      = ApplicationPaths.GetAudioPath();
            var pathToAudioVideoFolder = ApplicationPaths.AudioVideoPath;

            if (selectedQuatiy != null)
            {
                return(metadata + "--restrict-filenames -o " + pathToAudioVideoFolder + date + title + escapedDownloadLink);
            }
            if (quality == null)
            {
                return(metadata + "--restrict-filenames -o " + pathToAudioFolder + date + title + escapedDownloadLink);
            }
            return(metadata + "--audio-quality " + quality + " --restrict-filenames -o " + pathToAudioFolder + date + "Q" + quality + title + escapedDownloadLink);
        }
コード例 #3
0
ファイル: Model.cs プロジェクト: ChrisKolan/AudioDownloader
        private (string fileName, double fileSize) GetFileNameAndSize(string selectedQuality)
        {
            string path      = selectedQuality.Contains("video") ? ApplicationPaths.AudioVideoPath : ApplicationPaths.GetAudioPath();
            var    directory = new DirectoryInfo(path);
            var    myFile    = directory.GetFiles()
                               .OrderByDescending(f => f.LastWriteTime)
                               .FirstOrDefault();

            var length = new FileInfo(path + myFile.ToString()).Length;

            return(fileName : myFile.ToString(), fileSize : ConvertBytesToMegabytes(length));
        }