[BACKEND] Additional filtering on root parent search (#445)
* [BACKEND] Additional filtering on root parent search * update failing test
This commit is contained in:
parent
75f4a52099
commit
3106861a42
2 changed files with 13 additions and 8 deletions
|
|
@ -215,15 +215,20 @@ class EntryParent(BaseEntry):
|
|||
Sometimes the root-level parent is disconnected via playlist_ids Find it if it exists.
|
||||
"""
|
||||
|
||||
def _url_matches(webpage_url: str):
|
||||
return webpage_url in url or url in webpage_url
|
||||
def _url_matches(parent: "EntryParent"):
|
||||
return parent.webpage_url in url or url in parent.webpage_url
|
||||
|
||||
def _uid_is_uploader_id(parent: "EntryParent"):
|
||||
return parent.uid == parent.uploader_id
|
||||
|
||||
top_level_parents = [
|
||||
parent
|
||||
for parent in parents
|
||||
if parent.num_children() == 0 and _url_matches(parent.webpage_url)
|
||||
parent for parent in parents if parent.num_children() == 0 and _url_matches(parent)
|
||||
]
|
||||
|
||||
# If more than 1 parent exists, assume the uploader_id is the root parent
|
||||
if len(top_level_parents) > 1:
|
||||
top_level_parents = [parent for parent in parents if _uid_is_uploader_id(parent)]
|
||||
|
||||
match len(top_level_parents):
|
||||
case 0:
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
".ytdl-sub-chapters_from_comments-download-archive.json": "122723ce8d257eebb05178daa26141f6",
|
||||
"JMC/JMC - Move 78 - Automated Improvisation [Full Album]-thumb.jpg": "c12e6a6f242680d1096a1a99d74a62c6",
|
||||
"JMC/JMC - Move 78 - Automated Improvisation [Full Album].info.json": "ee8437e52186219ff510214138f00e28",
|
||||
"JMC/JMC - Move 78 - Automated Improvisation [Full Album].mp4": "8b8a9a731a19bc37feb091559f97ebbc",
|
||||
"JMC/JMC - Move 78 - Automated Improvisation [Full Album].info.json": "6654b2b5bbf4e7dfb51f2c5e3138df63",
|
||||
"JMC/JMC - Move 78 - Automated Improvisation [Full Album].mp4": "5bd2291db1ee7848ff5d8ed0fdb98782",
|
||||
"JMC/JMC - Move 78 - Automated Improvisation [Full Album].nfo": "7a65b184d24c68fc0ec5380432250f5b"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue