Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.IO;
- using System.Diagnostics;
- using System.Runtime;
- using System.Threading;
- namespace flacToAlac
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Please enter the folder where your .flacs are");
- string location = Console.ReadLine();
- string[] files = Directory.GetFiles(@location, "*.flac", SearchOption.AllDirectories);
- foreach (string s in files)
- {
- if (!File.Exists(Path.GetDirectoryName(s) + "\\" + "itunes\\" + Path.GetFileNameWithoutExtension(s) + ".m4a"))
- {
- string directory = Path.GetDirectoryName(s);
- string filename = Path.GetFileNameWithoutExtension(s);
- string process = @"ffmpeg\bin\ffmpeg.exe";
- string codec = "\" -acodec alac ";
- if (!Directory.Exists(directory + "\\" + "itunes"))
- {
- Directory.CreateDirectory(directory + "\\" + "itunes");
- Console.WriteLine("Created directory: " + directory + "\\" + "itunes");
- Console.WriteLine(Environment.NewLine);
- }
- Console.WriteLine("Converting " + @s + Environment.NewLine + "To " + directory + "\\" + "itunes\\" + filename + ".m4a");
- Process ffmpeg = Process.Start(process, "-i \"" + @s + codec + "\"" + directory + "\\" + "itunes\\" + filename + ".m4a" + "\"");
- while (ffmpeg.HasExited == false)
- {
- Thread.Sleep(100);
- }
- Thread.Sleep(100);
- Console.WriteLine(Environment.NewLine);
- }
- }
- Console.WriteLine("Done!!!");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement