public static Qua ToQua( SongMetadata song, DscFileMetadata script, string creator = "SEGA", string source = "Project Diva", TimeSpan previewtime = new TimeSpan()) => ToQua(song.Title, song.Artist, Path.GetFileName(Path.GetFileName(song.AudioPath)), (int)song.Bpm, DscFile.LoadFile(script.Path).GetAllNotes(), creator, source, script.Difficulty, previewtime);
public ValueTask ExecuteAsync(IConsole console) { var dsc = DscFile.LoadFile(InputFile); // foreach (var note in dsc.GetAllNotes()) // console.Output.WriteLine($"{note.Timestamp}, {note.Button}, {note.TargetPosX}, {note.TargetPosY}, {note.StartPosX}, {note.StartPosY}, {note.Unknown6}, {note.Unknown7}"); foreach (var line in dsc.GetRawScript()) { console.Output.Write(line); } return(default);
public async ValueTask ExecuteAsync(IConsole console) { console.Output.WriteLine($" - Processing all data..."); var dscfiles = GetDscFileMetadata(); console.Output.WriteLine($" Found {dscfiles.Count()} .dsc files"); var audiofiles = GetAudioFileMetadata(); console.Output.WriteLine($" Found {audiofiles.Count()} .ogg files"); var db = GetDatabaseEntries(audiofiles); console.Output.WriteLine($" Found {db.Count()} database entries"); var songs = GetSongMetadata(dscfiles, audiofiles, db); console.Output.WriteLine($" Generated data for {songs.Count()} songs"); console.Output.WriteLine($" - Converting all .dsc to .qua ..."); foreach (var song in songs) { console.Output.WriteLine($" Song {song.Title}"); foreach (var script in song.ScriptFiles) { console.Output.WriteLine($" Difficulty {script.Difficulty}"); if (!Directory.Exists(Path.Combine(OutputPath, song.Id))) { Directory.CreateDirectory(Path.Combine(OutputPath, song.Id)); } DscFile.ToQua(song, script, creator: DataCreator, source: DataSource, previewtime: song.PreviewTime) .Save(Path.Combine(OutputPath, song.Id, $"{song.Id}_{script.Difficulty}.qua")); } // copy .ogg string audiofilepath = Path.Combine(OutputPath, song.Id, $"{song.Id}.ogg"); // if (!File.Exists(audiofilepath)) // File.Copy(song.AudioPath, audiofilepath); // downmix with ffmpeg // ffmpeg -hide_banner -loglevel fatal -i "temp.ogg" -ac 2 "$path" if (!File.Exists(audiofilepath)) { await CliWrap.Cli.Wrap("ffmpeg") .WithArguments(x => x .Add("-hide_banner") .Add("-loglevel").Add("fatal") .Add("-i").Add(song.AudioPath) .Add("-ac").Add("2") .Add(audiofilepath) ) .ExecuteAsync(); } // // zip up // string archivepath = Path.Combine(OutputPath, $"{song.Id}.qp"); // if (File.Exists(archivepath)) // File.Delete(archivepath); // System.IO.Compression.ZipFile.CreateFromDirectory(Path.Combine(OutputPath, song.Id), archivepath); // Directory.Delete(Path.Combine(OutputPath, song.Id), true); } console.Output.WriteLine($"Conversion complete!"); // return default; }