<commit_before>/*
 *  Copyright 2006 The National Library of New Zealand
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

/*
 * Created on 8/06/2004
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package nz.govt.natlib.adapter.mp3;

/**
 * @author nevans
 * 
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public abstract class MP3Util {

	public static ID3v2Tag getTag(String type, String value) {
		ID3v2Tag result = new ID3v2Tag();
		// from id3v1.x -->
		// "title","artist","album","year","comment","genre","track"
		result.setValue(value);

		if (type.equalsIgnoreCase("TALB")) {
			result.setName("album");
		}
		if (type.equalsIgnoreCase("COMM")) {
			result.setName("comment");
			byte enc = (byte) value.charAt(0);
			int valPos = 1;
			String lang = value.substring(1, 4);
			String sht = "";
			valPos = 4;
			for (; valPos < value.length(); valPos++) {
				char c = value.charAt(valPos);
				if (c == 0x00) {
					break;
				}
				sht += c;
			}
			String full = value.substring(valPos + 1).trim();
			result.setAttributes(new String[] { "language", "name" });
			result.setValues(new String[] { lang, sht });
			result.setValue(full);
		} else if (type.equalsIgnoreCase("TIT1")) {
			result.setName("Group");
		} else if (type.equalsIgnoreCase("TIT2")) {
			result.setName("Title");
		} else if (type.equalsIgnoreCase("TIT3")) {
			result.setName("Subtitle");
		} else if (type.equalsIgnoreCase("TOAL")) {
			result.setName("Movie");
		} else if (type.equalsIgnoreCase("TRCK")) {
			result.setName("Track");
		} else if (type.equalsIgnoreCase("TPOS")) {
			result.setName("part-of-set");
		} else if (type.equalsIgnoreCase("TSST")) {
			result.setName("part-of-set");<commit_msg>Fixed a problem where it was not printing the album title - fix was to add an "else" statement in a set of nested "if" statements.<commit_after>/*
 *  Copyright 2006 The National Library of New Zealand
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

/*
 * Created on 8/06/2004
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package nz.govt.natlib.adapter.mp3;

/**
 * @author nevans
 * 
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public abstract class MP3Util {

	public static ID3v2Tag getTag(String type, String value) {
		ID3v2Tag result = new ID3v2Tag();
		// from id3v1.x -->
		// "title","artist","album","year","comment","genre","track"
		result.setValue(value);

		if (type.equalsIgnoreCase("TALB")) {
			result.setName("album");
		} else if (type.equalsIgnoreCase("COMM")) {
			result.setName("comment");
			byte enc = (byte) value.charAt(0);
			int valPos = 1;
			String lang = value.substring(1, 4);
			String sht = "";
			valPos = 4;
			for (; valPos < value.length(); valPos++) {
				char c = value.charAt(valPos);
				if (c == 0x00) {
					break;
				}
				sht += c;
			}
			String full = value.substring(valPos + 1).trim();
			result.setAttributes(new String[] { "language", "name" });
			result.setValues(new String[] { lang, sht });
			result.setValue(full);
		} else if (type.equalsIgnoreCase("TIT1")) {
			result.setName("Group");
		} else if (type.equalsIgnoreCase("TIT2")) {
			result.setName("Title");
		} else if (type.equalsIgnoreCase("TIT3")) {
			result.setName("Subtitle");
		} else if (type.equalsIgnoreCase("TOAL")) {
			result.setName("Movie");
		} else if (type.equalsIgnoreCase("TRCK")) {
			result.setName("Track");
		} else if (type.equalsIgnoreCase("TPOS")) {
			result.setName("part-of-set");
		} else if (type.equalsIgnoreCase("TSST")) {
			result.setName("part-of-set");
{'fraction_non_alphanumeric': 0.1423342822285482, 'fraction_numerical': 0.015046766978446523, 'mean_word_length': 3.7710960232783703, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5519604', 'n_tokens_mistral': 1726, 'n_tokens_neox': 1554, 'n_words': 458}