Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
5fdb804a
Commit
5fdb804a
authored
Sep 04, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/simple/Song: add attribute "target"
Will be used for Song objects representing tracks inside a CUE file.
parent
91c1274a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
0 deletions
+22
-0
SongSave.cxx
src/SongSave.cxx
+7
-0
SongSave.hxx
src/SongSave.hxx
+1
-0
DirectorySave.cxx
src/db/plugins/simple/DirectorySave.cxx
+3
-0
Song.cxx
src/db/plugins/simple/Song.cxx
+2
-0
Song.hxx
src/db/plugins/simple/Song.hxx
+9
-0
No files found.
src/SongSave.cxx
View file @
5fdb804a
...
...
@@ -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
{
...
...
src/SongSave.hxx
View file @
5fdb804a
...
...
@@ -44,6 +44,7 @@ song_save(BufferedOutputStream &os, const DetachedSong &song);
*/
DetachedSong
song_load
(
TextFile
&
file
,
const
char
*
uri
,
std
::
string
*
target_r
=
nullptr
,
AudioFormat
*
audio_format_r
=
nullptr
);
#endif
src/db/plugins/simple/DirectorySave.cxx
View file @
5fdb804a
...
...
@@ -161,12 +161,15 @@ directory_load(TextFile &file, Directory &directory)
if
(
directory
.
FindSong
(
name
)
!=
nullptr
)
throw
FormatRuntimeError
(
"Duplicate song '%s'"
,
name
);
std
::
string
target
;
auto
audio_format
=
AudioFormat
::
Undefined
();
auto
detached_song
=
song_load
(
file
,
name
,
&
target
,
&
audio_format
);
auto
song
=
std
::
make_unique
<
Song
>
(
std
::
move
(
detached_song
),
directory
);
song
->
target
=
std
::
move
(
target
);
song
->
audio_format
=
audio_format
;
directory
.
AddSong
(
std
::
move
(
song
));
...
...
src/db/plugins/simple/Song.cxx
View file @
5fdb804a
...
...
@@ -51,6 +51,8 @@ Song::Export() const noexcept
LightSong
dest
(
filename
.
c_str
(),
tag
);
if
(
!
parent
.
IsRoot
())
dest
.
directory
=
parent
.
GetPath
();
if
(
!
target
.
empty
())
dest
.
real_uri
=
target
.
c_str
();
dest
.
mtime
=
mtime
;
dest
.
start_time
=
start_time
;
dest
.
end_time
=
end_time
;
...
...
src/db/plugins/simple/Song.hxx
View file @
5fdb804a
...
...
@@ -93,6 +93,15 @@ struct Song {
*/
std
::
string
filename
;
/**
* If non-empty, then this object does not describe a file
* within the `music_directory`, but some sort of symbolic
* link pointing to this value. It can be an absolute URI
* (i.e. with URI scheme) or a URI relative to this object
* (which may begin with one or more "../").
*/
std
::
string
target
;
template
<
typename
F
>
Song
(
F
&&
_filename
,
Directory
&
_parent
)
noexcept
:
parent
(
_parent
),
filename
(
std
::
forward
<
F
>
(
_filename
))
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment