~ubuntu-branches/ubuntu/utopic/libjaudiotagger-java/utopic

« back to all changes in this revision

Viewing changes to src/org/jaudiotagger/audio/asf/tag/AsfFieldKey.java

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath, Damien Raude-Morvan, Varun Hiremath
  • Date: 2009-04-01 19:17:56 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090401191756-bygniim270guy7o1
Tags: 1.0.9-1
[ Damien Raude-Morvan ]
* New upstream release
* debian/watch: Use java.net repository (which contains new releases!)
* debian/control:
  - Build-Depends on default-jdk-builddep
  - Bump Standards-Version to 3.8.1 (no changes needed)
  - Change section to "java"
* debian/rules: use default-java as JAVA_HOME
* debina/orig-tar.{sh|excludes}: strip audio and others binary files from ZIP
* debian/build.xml:
  - compile with "nowarn" to keep build log readable
  - exclude LogFormatter from build (use com.sun classes)
* debian/ant.properties: new source directory is "src" in orig.tar.gz
* Add myself as Uploaders

[ Varun Hiremath ]
* Accept changes made by Damien Raude-Morvan (Closes: #522130)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.jaudiotagger.audio.asf.tag;
 
2
 
 
3
import java.util.HashMap;
 
4
 
 
5
/**
 
6
 * Field keys which need to be mapped for ASF files, or only specified for ASF.
 
7
 *
 
8
 * TODO These attributes and their v23 mapping that havent been added to enum yet
 
9
 *
 
10
 * WMA      ID3v1   ID3v22  ID3v2324
 
11
 *
 
12
 * CopyrightURL                 WCP     WCOP
 
13
 * Duration             TLE     TLEN
 
14
 * FileSize                     TSIZ
 
15
 * WM/AudioFileURL              WAF     WOAF
 
16
 * WM/AudioSourceURL            WAS     WOAS
 
17
 * WM/Binary            GEO     GEOB
 
18
 * WM/EncodingSettings          TSS     TSSE
 
19
 * WM/EncodingTime                      TDEN
 
20
 * WM/MCDI                      MCDI
 
21
 * WM/ModifiedBy                        TPE4
 
22
 * WM/OriginalAlbumTitle                TOT     TOAL
 
23
 * WM/OriginalArtist            TOA     TOPE
 
24
 * WM/OriginalFilename          TOF     TOFN
 
25
 * WM/OriginalLyricist          TOL     TOLY
 
26
 * WM/OriginalReleaseYear               TOR     TORY
 
27
 * WM/PlaylistDelay                     TDLY
 
28
 * WM/RadioStationName          TRN     TRSN
 
29
 * WM/RadioStationOwner                 TRO     TRSO
 
30
 * WM/SetSubTitle                       TSST
 
31
 * WM/Text              TXX     TXXX
 
32
 * WM/UniqueFileIdentifier              UFI     UFID
 
33
 * WM/UserWebURL                WXX     WXXX
 
34
 *
 
35
 * @author Christian Laireiter
 
36
 */
 
37
public enum AsfFieldKey
 
38
{
 
39
    //Keys are arbitary because these fields dont have 'keys' internally because they are stored in preset contents descriptor
 
40
    AUTHOR("AUTHOR", false),
 
41
    TITLE("TITLE", false),
 
42
    RATING("RATING", false),
 
43
    COPYRIGHT("COPYRIGHT", false),
 
44
    DESCRIPTION("DESCRIPTION", false),
 
45
 
 
46
    //keys are important because this is how values will be looked up by other applications
 
47
    ALBUM("WM/AlbumTitle", false),
 
48
    ALBUM_ARTIST("WM/AlbumArtist", true),
 
49
    ALBUM_ARTIST_SORT("WM/AlbumArtistSortOrder", false),
 
50
    ALBUM_SORT("WM/AlbumSortOrder", false),
 
51
    AMAZON_ID("ASIN", false),
 
52
    ARTIST_SORT("WM/ArtistSortOrder", false),           
 
53
    BARCODE("WM/Barcode", false),
 
54
    BPM("WM/BeatsPerMinute", false),
 
55
    CATALOG_NO("WM/CatalogNo", false),
 
56
    CATEGORY("WM/Category", true),      
 
57
    COMPOSER("WM/Composer", true),
 
58
    COMPOSER_SORT("WM/ComposerSort", false),
 
59
    CONDUCTOR("WM/Conductor", true),
 
60
    COVER_ART("WM/Picture", true),
 
61
    COVER_ART_URL("WM/AlbumCoverURL", true),
 
62
    DIRECTOR("WM/Director", true),
 
63
    DISC_NO("WM/PartOfSet", false),
 
64
    ENCODER("WM/ToolName", false),
 
65
    ENCODED_BY("WM/EncodedBy", false),
 
66
    GENRE("WM/Genre", true),
 
67
    GENRE_ID("WM/GenreID", true),
 
68
    GROUPING("WM/ContentGroupDescription", false),
 
69
    INITIAL_KEY("WM/InitialKey", false),
 
70
    IS_COMPILATION("WM/IsCompilation", false),
 
71
    ISRC("WM/ISRC", false),
 
72
    ISVBR("IsVBR", false),
 
73
    LANGUAGE("WM/Language", true),
 
74
    LYRICIST("WM/Writer", true),
 
75
    LYRICS("WM/Lyrics", false),
 
76
    LYRICS_SYNCHRONISED("WM/Lyrics_Synchronised", true),
 
77
    MEDIA("WM/Media", false),
 
78
    MOOD("WM/Mood", true),
 
79
    MUSICBRAINZ_ARTISTID("MusicBrainz/Artist Id", false),
 
80
    MUSICBRAINZ_DISC_ID("MusicBrainz/Disc Id", false),
 
81
    MUSICBRAINZ_RELEASE_COUNTRY("MusicBrainz/Album Release Country", false),
 
82
    MUSICBRAINZ_RELEASE_STATUS("MusicBrainz/Album Status", false),
 
83
    MUSICBRAINZ_RELEASE_TYPE("MusicBrainz/Album Type", false),
 
84
    MUSICBRAINZ_RELEASEARTISTID("MusicBrainz/Album Artist Id", false),
 
85
    MUSICBRAINZ_RELEASEID("MusicBrainz/Album Id", false),
 
86
    MUSICBRAINZ_TRACK_ID("MusicBrainz/Track Id", false),
 
87
    MUSICIP_ID("MusicIP/PUID", false),
 
88
    PRODUCER("WM/Producer", false),
 
89
    RECORD_LABEL("WM/Publisher", false),
 
90
    REMIXER("WM/ModifiedBy", false),
 
91
    SUBTITLE("WM/SubTitle", false),
 
92
    TITLE_SORT("WM/TitleSortOrder", false),
 
93
    TRACK("WM/TrackNumber", false),
 
94
    URL_DISCOGS_ARTIST_SITE("WM/DiscogsArtistUrl", false),
 
95
    URL_DISCOGS_RELEASE_SITE("WM/DiscogsReleaseUrl", false),
 
96
    URL_OFFICIAL_ARTIST_SITE("WM/AuthorURL", false),
 
97
    URL_OFFICIAL_RELEASE_SITE("WM/OfficialReleaseUrl", false),
 
98
    URL_PROMOTIONAL_SITE("WM/PromotionURL", true),
 
99
    URL_WIKIPEDIA_ARTIST_SITE("WM/WikipediaArtistUrl", false),
 
100
    URL_WIKIPEDIA_RELEASE_SITE("WM/WikipediaReleaseUrl", false),
 
101
    YEAR("WM/Year", false),;
 
102
 
 
103
    /**
 
104
     * Stores the {@link AsfFieldKey#fieldName} to the field key.
 
105
     */
 
106
    private final static HashMap<String, AsfFieldKey> FIELD_ID_MAP;
 
107
 
 
108
    static
 
109
    {
 
110
        FIELD_ID_MAP = new HashMap<String, AsfFieldKey>(AsfFieldKey.values().length);
 
111
        for (AsfFieldKey curr : AsfFieldKey.values())
 
112
        {
 
113
            FIELD_ID_MAP.put(curr.getFieldName(), curr);
 
114
        }
 
115
    }
 
116
 
 
117
 
 
118
    /**
 
119
     * Searches for an ASF field key which represents the given id string.<br>
 
120
     *
 
121
     * @param fieldName the fieldname used for this key
 
122
     * @return tjhe Enum that represents this field
 
123
     */
 
124
    public static AsfFieldKey getAsfFieldKey(String fieldName)
 
125
    {
 
126
        return FIELD_ID_MAP.get(fieldName);
 
127
    }
 
128
 
 
129
    /**
 
130
     * Tests whether the field is enabled for multiple values.<br>
 
131
     *
 
132
     * @param id field id to test.
 
133
     * @return <code>true</code> if ASF implementation supports multiple values for the field.
 
134
     */
 
135
    public static boolean isMultiValued(String id)
 
136
    {
 
137
        boolean result = false; // For now, there is no support for multi values.
 
138
        AsfFieldKey fieldKey = getAsfFieldKey(id);
 
139
        if (fieldKey != null)
 
140
        {
 
141
            result = fieldKey.isMultiValued();
 
142
        }
 
143
        return result;
 
144
    }
 
145
 
 
146
 
 
147
    /**
 
148
     * If set, the field has a standard id assigned.
 
149
     */
 
150
    private String fieldName;
 
151
 
 
152
    /**
 
153
     * If <code>true</code>, the field will be stored repeatedly if occurs so in tags.
 
154
     */
 
155
    private boolean multiValued;
 
156
 
 
157
    /**
 
158
     * Creates an instance<br>
 
159
     *
 
160
     * @param asfFieldId standard field identifier.
 
161
     * @param multiValue <code>true</code> if the this ASF field can have multiple values.
 
162
     */
 
163
    private AsfFieldKey(String asfFieldId, boolean multiValue)
 
164
    {
 
165
        this.fieldName = asfFieldId;
 
166
        this.multiValued = multiValue;
 
167
    }
 
168
 
 
169
 
 
170
    /**
 
171
     * Returns the standard field id.
 
172
     *
 
173
     * @return the standard field id. (may be <code>null</code>)
 
174
     */
 
175
    public String getFieldName()
 
176
    {
 
177
        return this.fieldName;
 
178
    }
 
179
 
 
180
 
 
181
    /**
 
182
     * Returns <code>true</code> if this field can store multiple values.
 
183
     *
 
184
     * @return <code>true</code> if multiple values are supported for this field.
 
185
     */
 
186
    public boolean isMultiValued()
 
187
    {
 
188
        return this.multiValued;
 
189
    }
 
190
 
 
191
    /**
 
192
     * {@inheritDoc}
 
193
     */
 
194
    @Override
 
195
    public String toString()
 
196
    {
 
197
        return getFieldName();
 
198
    }
 
199
}