regex in split chapters

This commit is contained in:
Jesse Bannon 2024-09-27 08:50:55 -07:00
parent 27e09d80ef
commit 795bde4b60

View file

@ -30,35 +30,27 @@ def yt_album_as_chapters_with_regex_preset_dict(yt_album_as_chapters_preset_dict
mergedeep.merge( mergedeep.merge(
yt_album_as_chapters_preset_dict, 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": { "overrides": {
"track_title": "{captured_track_title}", "title_capture": """{
"track_album": "{captured_track_album}", %regex_capture_many(
"track_artist": "{captured_track_artist}", 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)}",
}, },
}, },
) )