# This is an example of a file that can be customized for parsing metadata
# Use it this like this:
#     streamripper URL -w parse_rules.txt

# Lines that start with '#' are comments, and blank lines are ignored.

# Ignore metadata that begins with "A suivre"
# The leading "m" says this is a match rule
# The trailing "e" means drop the metadata
m/^A suivre:/e

# Exclude tracks that contain the given expression
# The leading "m" says this is a match rule
# The trailing "x" means that the track should not be saved (excluded)
## m/advertisement/x

# Save tracks that contain the given expression
# The leading "m" says this is a match rule
# The trailing "s" means that the track should be saved
## m/[Ff]unk/s

# The first m//e, m//s or m//x rule that matches determines the 
# action that is performed.  If none match, then by default the file 
# will be saved.  If you prefer having the default being that the 
# files aren't saved, include the following rule after all your 
# other m//e, m//s or m//x rules.
## m//x

# Strip off anything like "- Mp3Pro" from the end of the string
# The leading "s" says this is a substitution rule
# The trailing "i" means case insensitive matching
s/[[:space:]]*-?[[:space:]]*mp3pro$//i

# Strip off something like "- " from the beginning of the string
s/^[[:space:]]*-[[:space:]]*//

# The strip rules don't have to be after the m//e, m//s and m//x 
# rules.  You can interleave them.  Rules are always processed
# in order.

# This is the normal parsing rule: "Artist - Title"
# The trailing "A1" means that the artist (A) matches subpattern 1
# The trailing "T2" means that the title (T) matches subpattern 2
m/^[[:space:]]*([^-]*[^-[:space:]])[[:space:]]*-[[:space:]]*(.*)[[:space:]]*$/A1T2

# This is slightly different parsing rule: "Artist, Title"
## m/^[[:space:]]*([^,]*[^,[:space:]])[[:space:]]*,[[:space:]]*(.*)[[:space:]]*$/A1T2

# After the first match with an m//A or m//T rule, no more rules 
# will be checked.

# If the metadata doesn't match any of the "m" rules, then the remaining 
# metadata string (with substitutions) is entered into the "Title" field.
