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
9e5a49b8
Commit
9e5a49b8
authored
Feb 11, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag_id3: use the tag_table library for TXXX
parent
767ade02
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
15 deletions
+26
-15
tag_id3.c
src/tag_id3.c
+10
-15
tag_table.h
src/tag_table.h
+16
-0
No files found.
src/tag_id3.c
View file @
9e5a49b8
...
...
@@ -19,6 +19,7 @@
#include "config.h"
#include "tag_id3.h"
#include "tag_table.h"
#include "tag.h"
#include "riff.h"
#include "aiff.h"
...
...
@@ -242,23 +243,17 @@ tag_id3_import_comment(struct tag *dest, struct id3_tag *tag, const char *id,
static
enum
tag_type
tag_id3_parse_txxx_name
(
const
char
*
name
)
{
static
const
struct
{
enum
tag_type
type
;
const
char
*
name
;
}
musicbrainz_txxx
[]
=
{
{
TAG_ALBUM_ARTIST_SORT
,
"ALBUMARTISTSORT"
},
{
TAG_MUSICBRAINZ_ARTISTID
,
"MusicBrainz Artist Id"
},
{
TAG_MUSICBRAINZ_ALBUMID
,
"MusicBrainz Album Id"
},
{
TAG_MUSICBRAINZ_ALBUMARTISTID
,
"MusicBrainz Album Artist Id"
},
{
TAG_MUSICBRAINZ_TRACKID
,
"MusicBrainz Track Id"
},
static
const
struct
tag_table
txxx_tags
[]
=
{
{
"ALBUMARTISTSORT"
,
TAG_ALBUM_ARTIST_SORT
},
{
"MusicBrainz Artist Id"
,
TAG_MUSICBRAINZ_ARTISTID
},
{
"MusicBrainz Album Id"
,
TAG_MUSICBRAINZ_ALBUMID
},
{
"MusicBrainz Album Artist Id"
,
TAG_MUSICBRAINZ_ALBUMARTISTID
},
{
"MusicBrainz Track Id"
,
TAG_MUSICBRAINZ_TRACKID
},
{
NULL
,
TAG_NUM_OF_ITEM_TYPES
}
};
for
(
unsigned
i
=
0
;
i
<
G_N_ELEMENTS
(
musicbrainz_txxx
);
++
i
)
if
(
strcmp
(
name
,
musicbrainz_txxx
[
i
].
name
)
==
0
)
return
musicbrainz_txxx
[
i
].
type
;
return
TAG_NUM_OF_ITEM_TYPES
;
return
tag_table_lookup
(
txxx_tags
,
name
);
}
/**
...
...
src/tag_table.h
View file @
9e5a49b8
...
...
@@ -31,6 +31,22 @@ struct tag_table {
};
/**
* Looks up a string in a tag translation table (case sensitive).
* Returns TAG_NUM_OF_ITEM_TYPES if the specified name was not found
* in the table.
*/
G_GNUC_PURE
static
inline
enum
tag_type
tag_table_lookup
(
const
struct
tag_table
*
table
,
const
char
*
name
)
{
for
(;
table
->
name
!=
NULL
;
++
table
)
if
(
strcmp
(
name
,
table
->
name
)
==
0
)
return
table
->
type
;
return
TAG_NUM_OF_ITEM_TYPES
;
}
/**
* Looks up a string in a tag translation table (case insensitive).
* Returns TAG_NUM_OF_ITEM_TYPES if the specified name was not found
* in the table.
...
...
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