diff options
author | Max Kellermann <max@musicpd.org> | 2019-09-04 10:19:01 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-09-08 00:32:16 +0200 |
commit | 5fdb804a500c91c206dd75327c920a1fc75dcc9f (patch) | |
tree | 41058489bc4017b1b5eb948964756f2226a7f012 /src/SongSave.cxx | |
parent | 91c1274ac60243c4ab61b28e8471711459fb8e08 (diff) |
db/simple/Song: add attribute "target"
Will be used for Song objects representing tracks inside a CUE file.
Diffstat (limited to 'src/SongSave.cxx')
-rw-r--r-- | src/SongSave.cxx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/SongSave.cxx b/src/SongSave.cxx index ce761e544..11c2ebcaf 100644 --- a/src/SongSave.cxx +++ b/src/SongSave.cxx @@ -53,6 +53,9 @@ song_save(BufferedOutputStream &os, const Song &song) { os.Format(SONG_BEGIN "%s\n", song.filename.c_str()); + if (!song.target.empty()) + os.Format("Target: %s\n", song.target.c_str()); + range_save(os, song.start_time.ToMS(), song.end_time.ToMS()); tag_save(os, song.tag); @@ -83,6 +86,7 @@ song_save(BufferedOutputStream &os, const DetachedSong &song) DetachedSong song_load(TextFile &file, const char *uri, + std::string *target_r, AudioFormat *audio_format_r) { DetachedSong song(uri); @@ -105,6 +109,9 @@ song_load(TextFile &file, const char *uri, tag.AddItem(type, value); } else if (StringIsEqual(line, "Time")) { tag.SetDuration(SignedSongTime::FromS(ParseDouble(value))); + } else if (StringIsEqual(line, "Target")) { + if (target_r != nullptr) + *target_r = value; } else if (StringIsEqual(line, "Format")) { if (audio_format_r != nullptr) { try { |