All Downloads are FREE. Search and download functionalities are using the official Maven repository.

chameleon.playlist.wpl.Fragment Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2008, Christophe Delory
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   * Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *   * Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY CHRISTOPHE DELORY ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL CHRISTOPHE DELORY BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package chameleon.playlist.wpl;

import java.util.ArrayList;
import java.util.List;

/**
 * Specifies one condition of the query that selects items from the library.
 * Conditions are specified by condition strings.
 * A condition string typically has a name portion, a condition portion, and a value portion.
 * 
* Certain condition strings have a metadata attribute portion, a condition portion, and a value portion. * For example, in the condition string "Album Artist Is Joe", the metadata attribute portion is "Album Artist", * the condition portion is "Is", and the value portion is "Joe". *
* Example: *
 * <fragment name = "Album Artist">
 *  <argument name = "condition">Is</argument>
 *  <argument name = "value">Joe</argument>
 * </fragment>
 * 
* For condition strings of this type, the following table shows the possible metadata attributes, possible conditions and possible values: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Metadata attributePossible conditionsPossible values
Actor, Album Artist, Album Title, Author, Caption, Channel, Composer, Conductor, Content Provider, Content Provider Genre, Contributing Artist, Copyright Text, Director, Episode, File Type, Genre, Key, Keywords, Language, Mood, Parental Rating, Period, Producer, Provider, Publisher, Series, Station name, Subgenre, Subtitle, Title, WriterEquals, Does Not Equal, Is, Is Not, Contains, Does Not ContainAny string value
Bit Rate (in kilobytes per second)Equals, Does Not Equal, Is, Is Not, Contains, Does Not Contain48, 64, 96, 128, 160, 192, 256, 300, 500, 750, 1000, 1500, 3000, 4500, 6000, 7500
Secondary Media TypeEquals, Does Not Equal, Is, Is Not, Contains, Does Not ContainAudio: News, Audio: Talk Show, Audio: Audio Books, Audio: Audio Spoken Word, Video: News, Video: Talk Show, Video: Home Video, Video: Movie / Film, Video: TV show, Video: Corporate Video, Video: Music Video
File Size (in KB), Image height, Image width, Play Count : Afternoon Totals, Play Count : Evening Totals, Play Count : Morning Totals, Play Count : Night Totals, Play Count : Total Overall, Play Count : Total Weekday, Play Count : Total WeekendIs Less Than, Is Greater Than, Is, Is NotAny number
Broadcast time, Date Encoded, Date Recorded, Date taken, Release YearIs Before, Is After, Is, Is NotYesterday, Last week, Last month, 6 months, 1 year, 2 years, 5 years, 2000s, 1990s, 1980s, 1970s, 1960s, 1950s, 1940s
Date AddedIs Before, Is After, Is, Is NotYesterday, Last week, Last month, 6 months, 1 year, 2 years, 5 years
Date Last PlayedOlder Than, More Recent Than, Is, Is NotYesterday, Last week, Last month, 6 months, 1 year, 2 years, 5 years
Month takenIs Before, Is More Recent Than, Is, Is Not1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
Year takenIs Before, Is More Recent Than, Is, Is NotAny year
Auto Rating, My RatingIs At Least, Is No More Than, Is, Is NotUnrated, 1 Star, 2 Stars, 3 Stars, 4 Stars, 5 Stars
Custom Field #1, Custom Field #2, File Name, Key FieldsContains, Does Not ContainAny string
* Certain condition strings have a limiter portion, a number portion and a format portion. * For example in the condition string "Limit Total Size To 3 Megabytes", the limiter portion is "Limit Total Size To", * the number portion is "3" and the format portion is "Megabytes". *
* Example: *
 * <fragment name = "Limit Total Size To">
 *  <argument name = "number">3</argument>
 *  <argument name = "format">Megabytes</argument>
 * </fragment>
 * 
* For condition strings of this type the following table shows the possible limiters and formats: * * * * * * * * * * * * * * * * *
LimiterPossible numbersPossible formats
Limit Total Size ToAny numberKilobytes, Megabytes, Gigabytes
Limit Total Duration ToAny numberSeconds, Minutes, Hours, Days
* Certain condition strings have a limiter portion and a number portion. * For example in the condition string "Limit Number of Items to 25", the limiter portion is "Limit Number of Items" and the number portion is "25". *
* Example: *
 * <fragment name = "Limit Number of Items">
 *  <argument name = "number">25</argument>
 * </fragment>
 * 
* For condition strings of this type the following table shows the only possible limiter: * * * * * * * * * *
LimiterPossible numbers
Limit Number Of ItemsAny number
* Certain condition strings have a protection portion and a condition portion. * For example in the condition string "Protection Is present", the protection portion is "Protection" and the condition portion is "Is". *
* Example: *
 * <fragment name = "Protection">
 *  <argument name = "condition">Is</argument>
 * </fragment>
 * 
* For condition strings of this type the following table shows the possible conditions: * * * * * * * * * *
Protection portionPossible conditions
ProtectionIs, Is Not
* There is one type of fragment element that does not contain a condition string. * If the name attribute of a fragment element is "Randomize Playback Order" the fragment element contains no argument elements. * This fragment element instructs the player to play the list in random order. *
* Example: *
 * <fragment name = "Randomize Playback Order">
 * </fragment>
 * 
* Certain condition strings have a sort portion, a value portion and a condition portion. * For example, in the condition string "Sort By Title Ascending order", the sort portion is "Sort By", the value portion is "Title", * and the condition portion is "Ascending". * Note that in this case the value portion is a metadata attribute. *
* Example: *
 * <fragment name = "Sort By">
 *  <argument name = "value">Title</argument>
 *  <argument name = "condition">Ascending</argument>
 * </fragment>
 * 
* For condition strings of this type the following table shows the possible values and conditions: * * * * * * * * * * * *
Sort portionPossible valuesPossible conditions
Sort ByGenre, Title, Date Added, Auto Rating, My Rating, Play Count : Total Overall, Play Count : Morning Totals, Play Count : Afternoon Totals, Play Count : Evening Totals, Play Count : Night Totals, Play Count : Total Weekday, Play Count : Total Weekend, Actor, Subtitle, Station name, Channel, Broadcast time, Director, Release Year, Writer, Producer, Date Recorded, Date Encoded, Bit Rate, ProtectionAscending, Descending, Random
* When you use a fragment element to sort a playlist, you must sort on a metadata attribute that applies to the type of media items you are sorting. * For example, if you are sorting music items you can not sort on Actor. * The following table shows which metadata attributes you can use to sort which media types: * * * * * * * * * * * * * * * * * * * * * * * * * *
Media typePossible metadata attributes
MusicGenre, Title, Date Added, Auto Rating, My Rating, Play Count : Total Overall, Play Count : Morning Totals, Play Count :Afternoon Totals, Play Count :Evening Totals, Play Count :Night Totals, Play Count :Total Weekday, Play Count : Total Weekend
Video or TVGenre, Actor, Subtitle, Title, Date Added, Auto Rating, Station name, Channel, Broadcast time, Director, Release Year, Writer, Producer, Date Recorded, Date Encoded, Bit Rate, My Rating, Protection, Play Count : Total Overall, Play Count : Morning Totals, Play Count : Afternoon Totals, Play Count : Evening Totals, Play Count : Night Totals, Play Count : Total Weekday, Play Count : Total Weekend
RadioTitle, Date Added, Bit Rate
PhotoTitle
OtherGenre, Title, Date Added, Auto Rating, My Rating, Bit Rate, Play Count : Total Overall, Play Count : Morning Totals, Play Count : Afternoon Totals, Play Count : Evening Totals, Play Count : Night Totals, Play Count : Total Weekday, Play Count : Total Weekend
* Windows Media Player 9 Series or later. * @version $Revision: 92 $ * @author Christophe Delory * @castor.class xml="fragment" */ public class Fragment { /** * A list of argument elements. */ private final List _arguments = new ArrayList(); /** * A portion of a condition string. */ private String _name = ""; /** * Adds an argument element to this fragment. * @param argument an argument element. Shall not be null. * @throws NullPointerException if argument is null. * @see #getArguments */ public void addArgument(final Argument argument) { if (argument == null) { throw new NullPointerException("no argument"); } _arguments.add(argument); } /** * Returns the list of argument elements. * @return a list of argument elements. May be empty but not null. * @see #addArgument * @castor.field * get-method="getArguments" * set-method="addArgument" * type="chameleon.playlist.wpl.Argument" * collection="arraylist" * @castor.field-xml * name="argument" * node="element" */ public List getArguments() { return _arguments; } /** * Returns a portion of a condition string. * @return a fragment name. Shall not be null. * @see #setName * @castor.field * get-method="getName" * set-method="setName" * required="true" * @castor.field-xml * name="name" * node="attribute" */ public String getName() { return _name; } /** * Initializes a portion of a condition string. * @param name a fragment name. Shall not be null. * @throws NullPointerException if name is null. * @see #getName */ public void setName(final String name) { _name = name.trim(); // Throws NullPointerException if name is null. } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy