regex in split chapters
This commit is contained in:
parent
27e09d80ef
commit
795bde4b60
1 changed files with 20 additions and 28 deletions
|
|
@ -30,35 +30,27 @@ def yt_album_as_chapters_with_regex_preset_dict(yt_album_as_chapters_preset_dict
|
|||
mergedeep.merge(
|
||||
yt_album_as_chapters_preset_dict,
|
||||
{
|
||||
"regex": {
|
||||
"from": {
|
||||
# Ensure regex can handle override variables that come from the
|
||||
# post-metadata stage
|
||||
"chapter_title": {
|
||||
"match": r"\d+\. (.+)",
|
||||
"capture_group_names": "captured_track_title",
|
||||
"capture_group_defaults": "{chapter_title}",
|
||||
},
|
||||
"title": {
|
||||
"match": [
|
||||
"(.+) - (.+) [-[\\(\\{].+",
|
||||
"(.+) - (.+)",
|
||||
],
|
||||
"capture_group_names": [
|
||||
"captured_track_artist",
|
||||
"captured_track_album",
|
||||
],
|
||||
"capture_group_defaults": [
|
||||
"{channel}",
|
||||
"{title}",
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
"overrides": {
|
||||
"track_title": "{captured_track_title}",
|
||||
"track_album": "{captured_track_album}",
|
||||
"track_artist": "{captured_track_artist}",
|
||||
"title_capture": """{
|
||||
%regex_capture_many(
|
||||
title,
|
||||
[
|
||||
"(.+) - (.+) [-[\\(\\{].+",
|
||||
"(.+) - (.+)"
|
||||
],
|
||||
[ channel, title ]
|
||||
)
|
||||
}""",
|
||||
"chapter_title_capture": r"""{
|
||||
%regex_capture_many(
|
||||
chapter_title,
|
||||
[ "\d+\. (.+)" ],
|
||||
[ chapter_title ]
|
||||
)
|
||||
}""",
|
||||
"track_title": "{%array_at(chapter_title_capture, 1)}",
|
||||
"track_artist": "{%array_at(title_capture, 1)}",
|
||||
"track_album": "{%array_at(title_capture, 2)}",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue