Beispiel #1
0
        public static void DownloadAndPrepareLinuxFiles(AudioExternalLibFiles downloadUrls)
        {
            Logger.Log("Downloading files for Linux...");

            //Download all audio service files for Linux
            Logger.Log($"Downloading ffmpeg from {downloadUrls.FfmpegDownloadUrl}");
            WebUtils.DownloadFileAsync(downloadUrls.FfmpegDownloadUrl, "Temp/ffmpeg.zip").GetAwaiter().GetResult();
            Logger.Log($"Downloading needed DLLs from {downloadUrls.LibsDownloadUrl}");
            WebUtils.DownloadFileAsync(downloadUrls.LibsDownloadUrl, "Temp/dlls.zip").GetAwaiter().GetResult();

            //Extract required files
            Logger.Log("Extracting files...");
            ZipFile.ExtractToDirectory("Temp/dlls.zip", "./", true);
            ZipFile.ExtractToDirectory("Temp/ffmpeg.zip", "Temp/ffmpeg/", true);

            //Copy the needed parts of ffmpeg to the right directory
            Logger.Log("Setting up ffmpeg");
            Global.DirectoryCopy("Temp/ffmpeg/ffmpeg-linux-64/", "External/", true);

            //Because linux, we need the right permissions
            ChmodFile("External/ffmpeg", "700");

            //Delete unnecessary files
            Logger.Log("Cleaning up...");
            File.Delete("Temp/dlls.zip");
            File.Delete("Temp/ffmpeg.zip");
            Directory.Delete("Temp/ffmpeg", true);
        }
Beispiel #2
0
        public void DownloadFiles(AudioExternalLibFiles libsUrls)
        {
            try
            {
                Logger.Info("Downloading files for {@Platform}...", libsUrls.OsPlatform);

                //Download all audio service files for Windows
                Logger.Info("Downloading ffmpeg from {@FfmpegDownloadUrl}", libsUrls.FfmpegDownloadUrl);
                WebUtils.DownloadFileAsync(libsUrls.FfmpegDownloadUrl, "Temp/ffmpeg.zip").GetAwaiter().GetResult();
                Logger.Info("Downloading needed DLLs from {@LibsDownloadUrl}", libsUrls.LibsDownloadUrl);
                WebUtils.DownloadFileAsync(libsUrls.LibsDownloadUrl, "Temp/dlls.zip").GetAwaiter().GetResult();

                //Extract required files
                Logger.Info("Extracting files...");
                ZipFile.ExtractToDirectory("Temp/dlls.zip", "./", true);
                ZipFile.ExtractToDirectory("Temp/ffmpeg.zip", "Temp/ffmpeg/", true);

                //Copy the needed parts of ffmpeg to the right directory
                Logger.Info("Setting up ffmpeg");
                Global.DirectoryCopy("Temp/ffmpeg/", Config.bot.AudioSettings.ExternalDirectory, true);

                //Delete unnecessary files
                Logger.Info("Cleaning up...");
                File.Delete("Temp/dlls.zip");
                File.Delete("Temp/ffmpeg.zip");
                Directory.Delete("Temp/ffmpeg/", true);
            }
            catch (Exception ex)
            {
                Logger.Error("An error occured while preparing music services: {@Exception}\nMusic services has now been disabled!", ex);

                Config.bot.AudioSettings.AudioServicesEnabled = false;
                Config.SaveConfig();
            }
        }
Beispiel #3
0
        /// <summary>
        /// Downloads files for Windows
        /// </summary>
        /// <param name="downloadUrls"></param>
        public static void DownloadAndPrepareWindowsFiles(AudioExternalLibFiles downloadUrls)
        {
            Logger.Log("Downloading files for Windows...");

            //Download all audio service files for Windows
            Logger.Log($"Downloading ffmpeg from {downloadUrls.FfmpegDownloadUrl}");
            WebUtils.DownloadFileAsync(downloadUrls.FfmpegDownloadUrl, "Temp/ffmpeg.zip").GetAwaiter().GetResult();
            Logger.Log($"Downloading needed DLLs from {downloadUrls.LibsDownloadUrl}");
            WebUtils.DownloadFileAsync(downloadUrls.LibsDownloadUrl, "Temp/dlls.zip").GetAwaiter().GetResult();

            //Extract required files
            Logger.Log("Extracting files...");
            ZipFile.ExtractToDirectory("Temp/dlls.zip", "./", true);
            ZipFile.ExtractToDirectory("Temp/ffmpeg.zip", "Temp/ffmpeg/", true);

            //Copy the needed parts of ffmpeg to the right directory
            Logger.Log("Setting up ffmpeg");
            Global.DirectoryCopy("Temp/ffmpeg/ffmpeg-latest-win64-static/bin/", "External/", true);
            File.Copy("Temp/ffmpeg/ffmpeg-latest-win64-static/LICENSE.txt", "External/ffmpeg-license.txt", true);

            //Delete unnecessary files
            Logger.Log("Cleaning up...");
            File.Delete("Temp/dlls.zip");
            File.Delete("Temp/ffmpeg.zip");
            Directory.Delete("temp/ffmpeg", true);
        }