X-Git-Url: https://git.hedgecode.org/?p=hespiff.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fhedgecode%2Fxml%2Fxspf%2FXSPFPlaylist.java;fp=src%2Fmain%2Fjava%2Forg%2Fhedgecode%2Fxml%2Fxspf%2FXSPFPlaylist.java;h=36736bab3477e7b604842f3e8e23ea6e58410442;hp=0000000000000000000000000000000000000000;hb=6310cd885e1db660feb7dc222c2e86cccb5c1fce;hpb=13dba5ab997fc65d1da26de66a49b9a930b81f12
diff --git a/src/main/java/org/hedgecode/xml/xspf/XSPFPlaylist.java b/src/main/java/org/hedgecode/xml/xspf/XSPFPlaylist.java
new file mode 100644
index 0000000..36736ba
--- /dev/null
+++ b/src/main/java/org/hedgecode/xml/xspf/XSPFPlaylist.java
@@ -0,0 +1,376 @@
+/*
+ * Copyright (c) 2015. Developed by Hedgecode.
+ *
+ * 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.
+ */
+
+package org.hedgecode.xml.xspf;
+
+import java.io.File;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.xml.bind.JAXBException;
+
+import org.hedgecode.xml.xspf.bind.BinderFactory;
+import org.hedgecode.xml.xspf.bind.PlaylistBinder;
+import org.hedgecode.xml.xspf.validate.Validate;
+import org.hedgecode.xml.xspf.validate.ValidateException;
+import org.hedgecode.xml.xspf.validate.Validator;
+import org.hedgecode.xml.xspf.validate.ValidatorType;
+
+import static org.hedgecode.xml.xspf.XSPFConstants.Format;
+import static org.hedgecode.xml.xspf.XSPFConstants.Version;
+
+/**
+ *
+ *
+ * @author Dmitry Samoshin aka gotty
+ */
+public final class XSPFPlaylist implements Playlist {
+
+ protected XSPFPlaylist(Format format) {
+ this.format = format;
+ }
+
+ protected XSPFPlaylist(Version version) {
+ this.format = Format.RELAX_NG;
+ }
+
+ private Format format;
+
+ /**
+ * Human-readable title for the playlist.
+ */
+ private String title;
+
+ /**
+ * Human-readable name of the entity (author, authors, group, company, etc)
+ * that authored the playlist.
+ */
+ private String creator;
+
+ /**
+ * Human-readable comment on the playlist.
+ * This is character data, not HTML, and it may not contain markup.
+ */
+ private String annotation;
+
+ /**
+ * URI of a web page to find out more about this playlist.
+ * Likely to be homepage of the author, and would be used to find out
+ * more about the author and to find more playlists by the author.
+ */
+ private String info;
+
+ /**
+ * Source URI for this playlist.
+ */
+ @Validate(validatorType = ValidatorType.URI)
+ private String location;
+
+ /**
+ * Canonical ID for this playlist.
+ * Likely to be a hash or other location-independent name.
+ * Must be a legal URI.
+ */
+ private String identifier;
+
+ /**
+ * URI of an image to display in the absence of
+ * a playlist->trackList->image element.
+ */
+ private String image;
+
+ /**
+ * Creation date (not last-modified date) of the playlist,
+ * formatted as a XML schema dateTime.
+ * In the absence of a timezone, the element may be assumed
+ * to use Coordinated Universal Time (UTC).
+ */
+ private Date date;
+
+ /**
+ * URI of a resource that describes the license
+ * under which this playlist was released.
+ */
+ private String license;
+
+ /**
+ * An ordered list of URIs. The purpose is to satisfy licenses
+ * allowing modification but requiring attribution.
+ * If you modify such a playlist, move its playlist->location
+ * or playlist->identifier element to the top of the items
+ * in the playlist->attribution element.
+ * Such a list can grow without limit, so as a practical matter
+ * we suggest deleting ancestors more than ten generations back.
+ */
+ private Attribution attribution;
+
+ /**
+ * The link element allows XSPF to be extended
+ * without the use of XML namespaces.
+ */
+ private List links = new ArrayList<>();
+
+ /**
+ * The meta element allows metadata fields to be added to XSPF.
+ */
+ private List metas = new ArrayList<>();
+
+ /**
+ * The extension element allows non-XSPF XML to be included in XSPF documents.
+ * The purpose is to allow nested XML, which the meta and link elements do not.
+ */
+ private List extensions = new ArrayList<>();
+
+ /**
+ * Ordered list of track elements to be rendered.
+ * The sequence is a hint, not a requirement;
+ * renderers are advised to play tracks from top to bottom
+ * unless there is an indication otherwise.
+ */
+ private List