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
a9130cb9
Commit
a9130cb9
authored
Feb 26, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TagFile: add TagBuilder overload with ScanGenericTags() fallback
parent
b1d60b5c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
9 deletions
+29
-9
SongUpdate.cxx
src/SongUpdate.cxx
+2
-9
TagFile.cxx
src/TagFile.cxx
+15
-0
TagFile.hxx
src/TagFile.hxx
+12
-0
No files found.
src/SongUpdate.cxx
View file @
a9130cb9
...
@@ -96,12 +96,8 @@ Song::UpdateFile(Storage &storage)
...
@@ -96,12 +96,8 @@ Song::UpdateFile(Storage &storage)
full_tag_handler
,
&
tag_builder
))
full_tag_handler
,
&
tag_builder
))
return
false
;
return
false
;
}
else
{
}
else
{
if
(
!
tag_file_scan
(
path_fs
,
full_tag_handler
,
&
tag_builder
))
if
(
!
tag_file_scan
(
path_fs
,
tag_builder
))
return
false
;
return
false
;
if
(
tag_builder
.
IsEmpty
())
ScanGenericTags
(
path_fs
,
full_tag_handler
,
&
tag_builder
);
}
}
mtime
=
info
.
mtime
;
mtime
=
info
.
mtime
;
...
@@ -149,12 +145,9 @@ DetachedSong::LoadFile(Path path)
...
@@ -149,12 +145,9 @@ DetachedSong::LoadFile(Path path)
return
false
;
return
false
;
TagBuilder
tag_builder
;
TagBuilder
tag_builder
;
if
(
!
tag_file_scan
(
path
,
full_tag_handler
,
&
tag_builder
))
if
(
!
tag_file_scan
(
path
,
tag_builder
))
return
false
;
return
false
;
if
(
tag_builder
.
IsEmpty
())
ScanGenericTags
(
path
,
full_tag_handler
,
&
tag_builder
);
mtime
=
fi
.
GetModificationTime
();
mtime
=
fi
.
GetModificationTime
();
tag_builder
.
Commit
(
tag
);
tag_builder
.
Commit
(
tag
);
return
true
;
return
true
;
...
...
src/TagFile.cxx
View file @
a9130cb9
...
@@ -19,6 +19,9 @@
...
@@ -19,6 +19,9 @@
#include "config.h"
#include "config.h"
#include "TagFile.hxx"
#include "TagFile.hxx"
#include "tag/Generic.hxx"
#include "tag/TagHandler.hxx"
#include "tag/TagBuilder.hxx"
#include "fs/Path.hxx"
#include "fs/Path.hxx"
#include "util/UriUtil.hxx"
#include "util/UriUtil.hxx"
#include "util/Error.hxx"
#include "util/Error.hxx"
...
@@ -94,3 +97,15 @@ tag_file_scan(Path path_fs, const TagHandler &handler, void *handler_ctx)
...
@@ -94,3 +97,15 @@ tag_file_scan(Path path_fs, const TagHandler &handler, void *handler_ctx)
return
tfs
.
Scan
(
plugin
);
return
tfs
.
Scan
(
plugin
);
});
});
}
}
bool
tag_file_scan
(
Path
path
,
TagBuilder
&
builder
)
{
if
(
!
tag_file_scan
(
path
,
full_tag_handler
,
&
builder
))
return
false
;
if
(
builder
.
IsEmpty
())
ScanGenericTags
(
path
,
full_tag_handler
,
&
builder
);
return
true
;
}
src/TagFile.hxx
View file @
a9130cb9
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
class
Path
;
class
Path
;
struct
TagHandler
;
struct
TagHandler
;
class
TagBuilder
;
/**
/**
* Scan the tags of a song file. Invokes matching decoder plugins,
* Scan the tags of a song file. Invokes matching decoder plugins,
...
@@ -35,4 +36,15 @@ struct TagHandler;
...
@@ -35,4 +36,15 @@ struct TagHandler;
bool
bool
tag_file_scan
(
Path
path
,
const
TagHandler
&
handler
,
void
*
handler_ctx
);
tag_file_scan
(
Path
path
,
const
TagHandler
&
handler
,
void
*
handler_ctx
);
/**
* Scan the tags of a song file. Invokes matching decoder plugins,
* and falls back to generic scanners (APE and ID3) if no tags were
* found (but the file was recognized).
*
* @return true if the file was recognized (even if no metadata was
* found)
*/
bool
tag_file_scan
(
Path
path
,
TagBuilder
&
builder
);
#endif
#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