private ConvertedSong ConvertSong(RecordedSong song, byte[] reusedBuffer)
        {
            var destPath = GetDestPath(song);

            using (var source = File.OpenRead(song.TempPath))
            {
                this.SongEncoder.Encode(
                    source,
                    destPath,
                    new SongTags(
                        title: song.SongInfo.SongName,
                        artist: song.SongInfo.Artist
                        ),
                    reusedBuffer
                    );
            }

            File.Delete(song.TempPath);

            //With mutable settings now added (so the temp path could change), it's a pain to delete the temp file later
            //	File.Move(song.TempPath, Path.ChangeExtension(song.TempPath, ".wav-converted"));
            //	//Don't delete yet as it's easier to control later, and this won't be reached if there was an error
            //	//Rename the file so that it won't be converted again

            return(new ConvertedSong(
                       songInfo: song.SongInfo,
                       tempPath: song.TempPath,
                       outputPath: destPath
                       ));
        }
 public string GetDestPath(RecordedSong song)
 {
     return(Path.Combine(this.OutputFolder, song.SongInfo.CombinedName) + this.SongEncoder.Extension);
 }
示例#3
0
 public void Enqueue(RecordedSong song)
 {
     _pendingSongs.Enqueue(song);
     _logger.Log("Enqueued song '" + song.SongInfo.CombinedName + "' for conversion.");
 }