View Javadoc

1   /*
2    * Entagged Audio Tag library
3    * Copyright (c) 2003-2005 Raphaël Slinckx <raphael@slinckx.net>
4    * 
5    * This library is free software; you can redistribute it and/or
6    * modify it under the terms of the GNU Lesser General Public
7    * License as published by the Free Software Foundation; either
8    * version 2.1 of the License, or (at your option) any later version.
9    *  
10   * This library is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   * Lesser General Public License for more details.
14   * 
15   * You should have received a copy of the GNU Lesser General Public
16   * License along with this library; if not, write to the Free Software
17   * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18   */
19  package entagged.audioformats.ogg;
20  
21  import entagged.audioformats.generic.AbstractTag;
22  import entagged.audioformats.generic.TagField;
23  import entagged.audioformats.ogg.util.OggTagField;
24  
25  //FIXME: Handle previously handled DESCRIPTION|COMMENT and TRACK|TRACKNUMBER
26  public class OggTag extends AbstractTag {
27  
28      private String vendor = "";
29      //This is the vendor string that will be written if no other is supplied
30  	public static final String DEFAULT_VENDOR = "Entagged - The Musical Box";
31  
32      protected TagField createAlbumField(String content) {
33          return new OggTagField("ALBUM", content);
34      }
35  
36      protected TagField createArtistField(String content) {
37          return new OggTagField("ARTIST", content);
38      }
39  
40      protected TagField createCommentField(String content) {
41          return new OggTagField("DESCRIPTION", content);
42      }
43  
44      protected TagField createGenreField(String content) {
45          return new OggTagField("GENRE", content);
46      }
47  
48      protected TagField createTitleField(String content) {
49          return new OggTagField("TITLE", content);
50      }
51  
52      protected TagField createTrackField(String content) {
53          return new OggTagField("TRACKNUMBER", content);
54      }
55  
56      protected TagField createYearField(String content) {
57          return new OggTagField("DATE", content);
58      }
59  
60      protected String getAlbumId() {
61          return "ALBUM";
62      }
63  
64      protected String getArtistId() {
65          return "ARTIST";
66      }
67  
68      protected String getCommentId() {
69          return "DESCRIPTION";
70      }
71  
72      protected String getGenreId() {
73          return "GENRE";
74      }
75  
76      protected String getTitleId() {
77          return "TITLE";
78      }
79  
80      protected String getTrackId() {
81          return "TRACKNUMBER";
82      }
83  
84      public String getVendor() {
85  		if( !this.vendor.trim().equals("") )
86  		    return vendor;
87      
88  		return DEFAULT_VENDOR;
89      }
90  
91      protected String getYearId() {
92          return "DATE";
93      }
94  
95      public void setVendor(String vendor) {
96          if(vendor == null) {
97              this.vendor = "";
98              return;
99          }
100         this.vendor = vendor;
101     }
102     
103     protected boolean isAllowedEncoding(String enc) {
104         return enc.equals("UTF-8");
105     }
106 	
107     public String toString() {
108         return "OGG " + super.toString();
109     }
110 }
111