detect media type from parent folder name when scanning a subfolder path
This commit is contained in:
1 parent
de3c41848f
commit
cd157b095a
1 file changed
+8
-3
@@ -455,9 +455,14 @@ TV_SHARE_KEYWORDS = ("tv", "show", "series")
|
|||||||
|
|
||||||
|
|
||||||
def infer_media_type(share):
|
def infer_media_type(share):
|
||||||
name = Path(share).name.lower()
|
path = Path(share)
|
||||||
is_movie = any(k in name for k in MOVIE_SHARE_KEYWORDS)
|
candidates = [path.name]
|
||||||
is_tv = any(k in name for k in TV_SHARE_KEYWORDS)
|
if path.parent != path:
|
||||||
|
candidates.append(path.parent.name)
|
||||||
|
candidates = [c.lower() for c in candidates if c]
|
||||||
|
|
||||||
|
is_movie = any(any(k in c for k in MOVIE_SHARE_KEYWORDS) for c in candidates)
|
||||||
|
is_tv = any(any(k in c for k in TV_SHARE_KEYWORDS) for c in candidates)
|
||||||
if is_movie and not is_tv:
|
if is_movie and not is_tv:
|
||||||
return "movie"
|
return "movie"
|
||||||
if is_tv and not is_movie:
|
if is_tv and not is_movie:
|
||||||
|
|||||||
Reference in new issue
Block a user