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
35567e65
Commit
35567e65
authored
Feb 26, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SongUpdate: add UpdateFileInArchive(ArchiveFile&)
parent
ae37e254
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
SongUpdate.cxx
src/SongUpdate.cxx
+41
-0
Song.hxx
src/db/plugins/simple/Song.hxx
+6
-0
No files found.
src/SongUpdate.cxx
View file @
35567e65
...
...
@@ -106,6 +106,47 @@ Song::UpdateFile(Storage &storage)
#ifdef ENABLE_ARCHIVE
Song
*
Song
::
LoadFromArchive
(
ArchiveFile
&
archive
,
const
char
*
name_utf8
,
Directory
&
parent
)
{
assert
(
!
uri_has_scheme
(
name_utf8
));
assert
(
strchr
(
name_utf8
,
'\n'
)
==
nullptr
);
Song
*
song
=
NewFile
(
name_utf8
,
parent
);
if
(
!
song
->
UpdateFileInArchive
(
archive
))
{
song
->
Free
();
return
nullptr
;
}
return
song
;
}
bool
Song
::
UpdateFileInArchive
(
ArchiveFile
&
archive
)
{
assert
(
parent
!=
nullptr
);
assert
(
parent
->
device
==
DEVICE_INARCHIVE
);
std
::
string
path_utf8
(
uri
);
for
(
const
Directory
*
directory
=
parent
;
directory
->
parent
!=
nullptr
&&
directory
->
parent
->
device
==
DEVICE_INARCHIVE
;
directory
=
directory
->
parent
)
{
path_utf8
.
insert
(
path_utf8
.
begin
(),
'/'
);
path_utf8
.
insert
(
0
,
directory
->
GetName
());
}
TagBuilder
tag_builder
;
if
(
!
tag_archive_scan
(
archive
,
path_utf8
.
c_str
(),
tag_builder
))
return
false
;
tag_builder
.
Commit
(
tag
);
return
true
;
}
bool
Song
::
UpdateFileInArchive
(
const
Storage
&
storage
)
{
...
...
src/db/plugins/simple/Song.hxx
View file @
35567e65
...
...
@@ -36,6 +36,7 @@ struct LightSong;
struct
Directory
;
class
DetachedSong
;
class
Storage
;
class
ArchiveFile
;
/**
* A song file inside the configured music directory. Internal
...
...
@@ -112,6 +113,11 @@ struct Song {
bool
UpdateFile
(
Storage
&
storage
);
#ifdef ENABLE_ARCHIVE
static
Song
*
LoadFromArchive
(
ArchiveFile
&
archive
,
const
char
*
name_utf8
,
Directory
&
parent
);
bool
UpdateFileInArchive
(
ArchiveFile
&
archive
);
bool
UpdateFileInArchive
(
const
Storage
&
storage
);
#endif
...
...
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