1# $Id: mt-daapd.playlist,v 1.1 2009-06-30 02:31:08 steven Exp $
2#
3# This is the playlist file, for specifying iTunes-style
4# "Smart Playlists".
5# 
6# The syntax is as follows:
7#
8# "Playlist Name" { expression }
9#
10# An expression consists of:
11#
12# ID3-tag-name operator operand
13#
14# Where valid ID3-tag-names are:
15#   Artist (string)
16#   Album (string)
17#   Genre (string) 
18#   Path (string) -- full path to song, including filename
19#   Composer (string)
20#   Orchestra (string)
21#   Conductor (string)
22#   Grouping (string) -- I don't even know what this is...
23#   Comment (string)
24#   Type (string) -- "mp3 audio file", "m4a audio file", etc.
25#   Year (int)
26#   BPM (int)
27#   Bitrate (int)
28#   Date (date)
29#
30# Valid operators include:
31#   is, includes (string)
32#   >, <, <=, >=, = (int)
33#   after, before (date)
34#
35# the "is" operator must exactly match the tag,
36# while the "includes" operator matches a substring.
37# Both matches are case-insensitive
38#
39# Valid operands include:
40#   "string value" (string)
41#   integer (int)
42#
43# Multiple expressions can be anded or ored together,
44# using the keywords OR and AND (or || and &&).
45# The unary not operator is also supported using the
46# keyword NOT (or !)
47#
48# Examples:
49#
50# "techno" {
51#    genre includes "techno" ||
52#    artist includes "zombie"
53# }
54#
55# This would match songs by "Rob Zombie" or "White Zombie",
56# as well as those with a genre of "Techno-Industrial" or
57# "Trance/Techno", for example.
58#
59# "AAC Files" {
60#   path includes ".m4a" ||
61#   path includes ".m4p"
62# }
63#
64# This would match all m4a and m4p files -- i.e. iTunes-ripped aac files
65# or songs downloaded from iTMS.
66#
67# "Orchestral Music" {
68#   Orchestra !IS "" ||
69#   Conductor !IS ""
70# }
71#
72# This would match anything with *anything* entered as a
73# orchestra or conductor... this would probably include any
74# orchestral music.  Kind of ugly, but works!
75#
76#
77# DATES
78#
79# Dates are kind of funky.  The "date" of a file is when it
80# was created on the file system, or the date that it was first
81# entered into the database, whichever is earlier.  The date of 
82# a file can be matched with the terms "before" or "after".
83#
84# One example of a valid date is a date in yyyy-mm-dd format:
85#
86# "Files added after January 1, 2004" {
87#   date after 2004-01-01
88# }
89#
90# There are also some special date keywords:
91#  "today", "yesterday", "last week", "last month", "last year"
92# 
93# A valid date can also be made by appling an interval to a 
94# date.  As an example, a valid date might be:
95#
96# 3 weeks before today
97# or
98# 3 weeks ago   
99#
100# You can combine these, of course.
101#
102# "3 weeks before today" is the same as "2 weeks before last week" 
103# or "1 week after last month" or "21 days before today" or
104# "20 days before yesterday" or "7 days after last month".  You get
105# the idea.
106# 
107# Note that the playlists are only generated at the time that mt-daapd
108# starts... so while the dates will be accurate at start time, they
109# may become inaccurate with time.  Yes, I know... it's on my list.  :)
110#
111# So, examples:
112#
113# "Recently Added MP3s" {
114#   date after last month AND file includes ".mp3"
115# } 
116#
117# This matches only mp3 files added in the last 30 days.
118#
119# 
120# SUMMARY
121#
122# I expect that this language will grow over time.  If you want
123# to hack on it, see src/lexer.l, src/parser.y, and src/playlist.c
124#
125# If there is something missing you particularly want, let me
126# (rpedde@users.sourceforge.net) know!
127#
128
129"60's Music" {
130    Year >= 1960 && Year < 1970
131}
132
133"Recently Added" {
134    Date after 2 weeks ago
135}
136
137"Non-DRMed Music" {
138    path not includes ".m4p"
139}
140
141"AAC Files" {
142    path includes ".m4p" ||
143    path includes ".m4a" ||
144    path includes ".aac"
145}
146