Merge pull request #559 from imayushsaini/playlist_

filtering unavailable maps from playlist
This commit is contained in:
Eric Froemling 2023-01-18 13:39:31 -08:00 committed by GitHub
commit 34efc25086
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,8 @@ import copy
import logging
from typing import Any, TYPE_CHECKING
import _ba
if TYPE_CHECKING:
from typing import Sequence
from ba import _session
@ -39,6 +41,7 @@ def filter_playlist(
goodlist: list[dict] = []
unowned_maps: Sequence[str]
available_maps: list[str] = list(_ba.app.maps.keys())
if remove_unowned or mark_unowned:
unowned_maps = get_unowned_maps()
unowned_game_types = get_unowned_game_types()
@ -157,6 +160,10 @@ def filter_playlist(
gameclass = getclass(entry['type'], GameActivity)
if entry['settings']['map'] not in available_maps:
raise ImportError(
f"Map not found: '{entry['settings']['map']}'")
if remove_unowned and gameclass in unowned_game_types:
continue
if add_resolved_type: