Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2013
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6. using System.Diagnostics;
  7. using System.Runtime;
  8. using System.Threading;
  9.  
  10. namespace flacToAlac
  11. {
  12. class Program
  13. {
  14. static void Main(string[] args)
  15. {
  16. Console.WriteLine("Please enter the folder where your .flacs are");
  17. string location = Console.ReadLine();
  18.  
  19. string[] files = Directory.GetFiles(@location, "*.flac", SearchOption.AllDirectories);
  20. foreach (string s in files)
  21. {
  22. if (!File.Exists(Path.GetDirectoryName(s) + "\\" + "itunes\\" + Path.GetFileNameWithoutExtension(s) + ".m4a"))
  23. {
  24.  
  25. string directory = Path.GetDirectoryName(s);
  26. string filename = Path.GetFileNameWithoutExtension(s);
  27. string process = @"ffmpeg\bin\ffmpeg.exe";
  28. string codec = "\" -acodec alac ";
  29.  
  30.  
  31. if (!Directory.Exists(directory + "\\" + "itunes"))
  32. {
  33. Directory.CreateDirectory(directory + "\\" + "itunes");
  34. Console.WriteLine("Created directory: " + directory + "\\" + "itunes");
  35. Console.WriteLine(Environment.NewLine);
  36. }
  37.  
  38. Console.WriteLine("Converting " + @s + Environment.NewLine + "To " + directory + "\\" + "itunes\\" + filename + ".m4a");
  39. Process ffmpeg = Process.Start(process, "-i \"" + @s + codec + "\"" + directory + "\\" + "itunes\\" + filename + ".m4a" + "\"");
  40. while (ffmpeg.HasExited == false)
  41. {
  42. Thread.Sleep(100);
  43. }
  44. Thread.Sleep(100);
  45. Console.WriteLine(Environment.NewLine);
  46. }
  47.  
  48. }
  49.  
  50. Console.WriteLine("Done!!!");
  51. Console.ReadKey();
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement