Ejemplo n.º 1
0
        public static MediaFileConverter GetDefaultMediaFileConverter()
        {
            var cacheDirectory = Path.Combine(About.LocalApplicationDataDirectory, "cache");
            var converter      = new MediaFileConverter(cacheDirectory);

            return(converter);
        }
Ejemplo n.º 2
0
 public PackageBuilder(
     IPackageDirectoryStructure structure, 
     MediaFileConverter converter)
 {
     this.packageDirectoryStructure = structure;
     this.converter = converter;
     this.MaxGmeSize = 800 * 1024 * 1024;
 }
Ejemplo n.º 3
0
 public void TestConvert(string source)
 {
     var cacheDir = TestFile("media-cache");
     PathUtil.EnsureNotExists(cacheDir);
     PathUtil.EnsureDirectoryExists(cacheDir);
     var converter = new MediaFileConverter(cacheDir);
     var convertedFile = converter.ProvidePenAudioFile(CancellationToken.None, source).Result;
 }
Ejemplo n.º 4
0
 public PackageBuilder(
     IPackageDirectoryStructure structure,
     MediaFileConverter converter,
     OidSvgWriter oidWriter
     )
 {
     this.packageDirectoryStructure = structure;
     this.converter  = converter;
     this.MaxGmeSize = 800 * 1024 * 1024;
     OidSvgWriter    = oidWriter;
 }
Ejemplo n.º 5
0
        public void PackageBuilderTest()
        {
            var penDirectory = TestFile("penDirectory");
            PathUtil.EnsureNotExists(penDirectory);
            PathUtil.EnsureDirectoryExists(penDirectory);
            var converter = new MediaFileConverter(TestFile("media-cache"));
            var albumReader = new AlbumReader();

            var package = Package.CreateFromInputPaths(new[] { TestFile("audio") });
            package.Albums.First().Tracks = Enumerable.Range(0, 20).Select(_ => package.Albums.First().Tracks.First()).ToArray();
            package.ProductId = 800;
                
            var structure = new PackageDirectoryStructure(penDirectory, package);
            var pb = new PackageBuilder(structure, converter);

            pb.Build(CancellationToken.None).Wait();

            Console.WriteLine(structure.GmeFile);
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            log4net.Config.BasicConfigurator.Configure();

            var pen = TipToiPen.GetAll().FirstOrDefault();
            if (pen == null)
            {
                pen = TipToiPen.Simulated;
                log.InfoFormat("Pen is not attached. Output will be written to {0}", pen.RootDirectory);
            }

            var package = Package.CreateFromInputPaths(args);
    
            var cacheDirectory = Path.Combine(About.LocalApplicationDataDirectory, "cache");
            var converter = new MediaFileConverter(cacheDirectory);

            var structure = new PackageDirectoryStructure(pen.RootDirectory, package);
            var packageBuilder = new PackageBuilder(structure, converter, Settings.Read().CreateOidSvgWriter());
            packageBuilder.Build(CancellationToken.None).Wait();
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            log4net.Config.BasicConfigurator.Configure();

            var pen = TipToiPen.GetAll().FirstOrDefault();

            if (pen == null)
            {
                pen = TipToiPen.Simulated;
                log.InfoFormat("Pen is not attached. Output will be written to {0}", pen.RootDirectory);
            }

            var package = Package.CreateFromInputPaths(args);

            var cacheDirectory = Path.Combine(About.LocalApplicationDataDirectory, "cache");
            var converter      = new MediaFileConverter(cacheDirectory);

            var structure      = new PackageDirectoryStructure(pen.RootDirectory, package);
            var packageBuilder = new PackageBuilder(structure, converter, Settings.Read().CreateOidSvgWriter());

            packageBuilder.Build(CancellationToken.None).Wait();
        }
Ejemplo n.º 8
0
        public async Task Build(string[] mp3FilesOrDirectories)
        {
            if (!mp3FilesOrDirectories.Any())
            {
                throw new ArgumentOutOfRangeException(nameof(mp3FilesOrDirectories), String.Empty, "You must specify at least one audio file.");
            }

            var pen = TipToiPen.GetAll().FirstOrDefault();

            if (pen == null)
            {
                pen = TipToiPen.Simulated;
                log.InfoFormat("Pen is not attached. Output will be written to {0}", pen.RootDirectory);
            }

            var package = Package.CreateFromInputPaths(mp3FilesOrDirectories);

            var cacheDirectory = Path.Combine(About.Get().LocalApplicationDataDirectory, "cache");
            var converter      = new MediaFileConverter(cacheDirectory);

            var structure      = new PackageDirectoryStructure(pen.RootDirectory, package);
            var packageBuilder = new PackageBuilder(structure, converter, Settings.Read().CreateOidSvgWriter());
            await packageBuilder.Build(CancellationToken.None);
        }
Ejemplo n.º 9
0
 public static MediaFileConverter GetDefaultMediaFileConverter()
 {
     var cacheDirectory = Path.Combine(About.LocalApplicationDataDirectory, "cache");
     var converter = new MediaFileConverter(cacheDirectory);
     return converter;
 }