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
51b1dd86
Commit
51b1dd86
authored
Mar 11, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist/xspf: use tag_table to convert element name to TagType
parent
98a7d8da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
XspfPlaylistPlugin.cxx
src/playlist/plugins/XspfPlaylistPlugin.cxx
+17
-12
No files found.
src/playlist/plugins/XspfPlaylistPlugin.cxx
View file @
51b1dd86
...
...
@@ -23,6 +23,7 @@
#include "song/DetachedSong.hxx"
#include "input/InputStream.hxx"
#include "tag/Builder.hxx"
#include "tag/Table.hxx"
#include "util/StringView.hxx"
#include "lib/expat/ExpatParser.hxx"
#include "Log.hxx"
...
...
@@ -62,6 +63,19 @@ struct XspfParser {
TagBuilder
tag_builder
;
};
static
constexpr
struct
tag_table
xspf_tag_elements
[]
=
{
{
"title"
,
TAG_TITLE
},
/* TAG_COMPOSER would be more correct according to the XSPF
spec */
{
"creator"
,
TAG_ARTIST
},
{
"annotation"
,
TAG_COMMENT
},
{
"album"
,
TAG_ALBUM
},
{
"trackNum"
,
TAG_TRACK
},
{
nullptr
,
TAG_NUM_OF_ITEM_TYPES
}
};
static
void
XMLCALL
xspf_start_element
(
void
*
user_data
,
const
XML_Char
*
element_name
,
gcc_unused
const
XML_Char
**
atts
)
...
...
@@ -93,18 +107,9 @@ xspf_start_element(void *user_data, const XML_Char *element_name,
case
XspfParser
:
:
TRACK
:
if
(
strcmp
(
element_name
,
"location"
)
==
0
)
parser
->
state
=
XspfParser
::
LOCATION
;
else
if
(
strcmp
(
element_name
,
"title"
)
==
0
)
parser
->
tag_type
=
TAG_TITLE
;
else
if
(
strcmp
(
element_name
,
"creator"
)
==
0
)
/* TAG_COMPOSER would be more correct
according to the XSPF spec */
parser
->
tag_type
=
TAG_ARTIST
;
else
if
(
strcmp
(
element_name
,
"annotation"
)
==
0
)
parser
->
tag_type
=
TAG_COMMENT
;
else
if
(
strcmp
(
element_name
,
"album"
)
==
0
)
parser
->
tag_type
=
TAG_ALBUM
;
else
if
(
strcmp
(
element_name
,
"trackNum"
)
==
0
)
parser
->
tag_type
=
TAG_TRACK
;
else
parser
->
tag_type
=
tag_table_lookup
(
xspf_tag_elements
,
element_name
);
break
;
...
...
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