forked from streamripper/streamripper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parse_rules.txt
82 lines (65 loc) · 3.08 KB
/
parse_rules.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
##--------------------------------------------------------------------------!
# This is an example of a file that can be customized for parsing metadata
#
# USAGE: streamripper URL -w parse_rules.txt
##--------------------------------------------------------------------------!
# Lines that start with '#' are comments, and blank lines are ignored.
##### CAUTION: Do not place your USER ADDED RULES at the end of the default
# parse_rules.txt file, because there is a [M]atch rule already there,
# (Artist - Title), that will prevent Streamripper from processing them.
##### PUT YOUR USER ADDED RULES HERE:
##### LEADING LETTERS:
# Rules can start with 'm' for match or 's' for substitute.
# m - [M]atch
# s - [S]ubstitute
##### TRAILING LETTERS:
# They can have the flags:
# e -- drop metadata
# g -- apply substitution globally
# i -- ignore case
# s -- save track
# x -- exclude track
# A{n} -- match group N is the artist
# C{n} -- match group N is the album
# N{n} -- match group N is the track number
# T{n} -- match group N is the track title
# Y{n} -- match group N is the year
#### EXAMPLES AND DEFAULT RULES:
# 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
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.