SourceIterator is actually just SourceIterable
This commit is contained in:
@@ -26,10 +26,10 @@ import yaml
|
|||||||
from src import shared
|
from src import shared
|
||||||
from src.game import Game
|
from src.game import Game
|
||||||
from src.importer.sources.location import Location
|
from src.importer.sources.location import Location
|
||||||
from src.importer.sources.source import SourceIterator, URLExecutableSource
|
from src.importer.sources.source import SourceIterable, URLExecutableSource
|
||||||
|
|
||||||
|
|
||||||
class BottlesSourceIterator(SourceIterator):
|
class BottlesSourceIterable(SourceIterable):
|
||||||
source: "BottlesSource"
|
source: "BottlesSource"
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
@@ -80,7 +80,7 @@ class BottlesSource(URLExecutableSource):
|
|||||||
"""Generic Bottles source"""
|
"""Generic Bottles source"""
|
||||||
|
|
||||||
name = _("Bottles")
|
name = _("Bottles")
|
||||||
iterator_class = BottlesSourceIterator
|
iterator_class = BottlesSourceIterable
|
||||||
url_format = 'bottles:run/"{bottle_name}"/"{game_name}"'
|
url_format = 'bottles:run/"{bottle_name}"/"{game_name}"'
|
||||||
available_on = {"linux"}
|
available_on = {"linux"}
|
||||||
|
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ from gi.repository import GLib, Gtk
|
|||||||
from src import shared
|
from src import shared
|
||||||
from src.game import Game
|
from src.game import Game
|
||||||
from src.importer.sources.location import Location
|
from src.importer.sources.location import Location
|
||||||
from src.importer.sources.source import Source, SourceIterator
|
from src.importer.sources.source import Source, SourceIterable
|
||||||
|
|
||||||
|
|
||||||
class FlatpakSourceIterator(SourceIterator):
|
class FlatpakSourceIterable(SourceIterable):
|
||||||
source: "FlatpakSource"
|
source: "FlatpakSource"
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
@@ -115,7 +115,7 @@ class FlatpakSource(Source):
|
|||||||
"""Generic Flatpak source"""
|
"""Generic Flatpak source"""
|
||||||
|
|
||||||
name = _("Flatpak")
|
name = _("Flatpak")
|
||||||
iterator_class = FlatpakSourceIterator
|
iterator_class = FlatpakSourceIterable
|
||||||
executable_format = "flatpak run {flatpak_id}"
|
executable_format = "flatpak run {flatpak_id}"
|
||||||
available_on = {"linux"}
|
available_on = {"linux"}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from src.game import Game
|
|||||||
from src.importer.sources.location import Location
|
from src.importer.sources.location import Location
|
||||||
from src.importer.sources.source import (
|
from src.importer.sources.source import (
|
||||||
SourceIterationResult,
|
SourceIterationResult,
|
||||||
SourceIterator,
|
SourceIterable,
|
||||||
URLExecutableSource,
|
URLExecutableSource,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ class SubSource(Iterable):
|
|||||||
"""Class representing a Heroic sub-source"""
|
"""Class representing a Heroic sub-source"""
|
||||||
|
|
||||||
source: "HeroicSource"
|
source: "HeroicSource"
|
||||||
source_iterator: "HeroicSourceIterator"
|
source_iterator: "HeroicSourceIterable"
|
||||||
name: str
|
name: str
|
||||||
service: str
|
service: str
|
||||||
image_uri_params: str = ""
|
image_uri_params: str = ""
|
||||||
@@ -284,7 +284,7 @@ class NileIterable(StoreSubSource):
|
|||||||
) from error
|
) from error
|
||||||
|
|
||||||
|
|
||||||
class HeroicSourceIterator(SourceIterator):
|
class HeroicSourceIterable(SourceIterable):
|
||||||
source: "HeroicSource"
|
source: "HeroicSource"
|
||||||
|
|
||||||
hidden_app_names: set[str] = set()
|
hidden_app_names: set[str] = set()
|
||||||
@@ -334,7 +334,7 @@ class HeroicSource(URLExecutableSource):
|
|||||||
"""Generic Heroic Games Launcher source"""
|
"""Generic Heroic Games Launcher source"""
|
||||||
|
|
||||||
name = _("Heroic")
|
name = _("Heroic")
|
||||||
iterator_class = HeroicSourceIterator
|
iterator_class = HeroicSourceIterable
|
||||||
url_format = "heroic://launch/{app_name}"
|
url_format = "heroic://launch/{app_name}"
|
||||||
available_on = {"linux", "win32"}
|
available_on = {"linux", "win32"}
|
||||||
|
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ from time import time
|
|||||||
from src import shared
|
from src import shared
|
||||||
from src.game import Game
|
from src.game import Game
|
||||||
from src.importer.sources.location import Location
|
from src.importer.sources.location import Location
|
||||||
from src.importer.sources.source import SourceIterator, URLExecutableSource
|
from src.importer.sources.source import SourceIterable, URLExecutableSource
|
||||||
from src.utils.sqlite import copy_db
|
from src.utils.sqlite import copy_db
|
||||||
|
|
||||||
|
|
||||||
class ItchSourceIterator(SourceIterator):
|
class ItchSourceIterable(SourceIterable):
|
||||||
source: "ItchSource"
|
source: "ItchSource"
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
@@ -76,7 +76,7 @@ class ItchSourceIterator(SourceIterator):
|
|||||||
|
|
||||||
class ItchSource(URLExecutableSource):
|
class ItchSource(URLExecutableSource):
|
||||||
name = _("itch")
|
name = _("itch")
|
||||||
iterator_class = ItchSourceIterator
|
iterator_class = ItchSourceIterable
|
||||||
url_format = "itch://caves/{cave_id}/launch"
|
url_format = "itch://caves/{cave_id}/launch"
|
||||||
available_on = {"linux", "win32"}
|
available_on = {"linux", "win32"}
|
||||||
|
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ from time import time
|
|||||||
from src import shared
|
from src import shared
|
||||||
from src.game import Game
|
from src.game import Game
|
||||||
from src.importer.sources.location import Location
|
from src.importer.sources.location import Location
|
||||||
from src.importer.sources.source import Source, SourceIterationResult, SourceIterator
|
from src.importer.sources.source import Source, SourceIterationResult, SourceIterable
|
||||||
|
|
||||||
|
|
||||||
class LegendarySourceIterator(SourceIterator):
|
class LegendarySourceIterable(SourceIterable):
|
||||||
source: "LegendarySource"
|
source: "LegendarySource"
|
||||||
|
|
||||||
def game_from_library_entry(
|
def game_from_library_entry(
|
||||||
@@ -93,7 +93,7 @@ class LegendarySource(Source):
|
|||||||
executable_format = "legendary launch {app_name}"
|
executable_format = "legendary launch {app_name}"
|
||||||
available_on = {"linux"}
|
available_on = {"linux"}
|
||||||
|
|
||||||
iterator_class = LegendarySourceIterator
|
iterator_class = LegendarySourceIterable
|
||||||
config_location: Location = Location(
|
config_location: Location = Location(
|
||||||
schema_key="legendary-location",
|
schema_key="legendary-location",
|
||||||
candidates=(
|
candidates=(
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ from time import time
|
|||||||
from src import shared
|
from src import shared
|
||||||
from src.game import Game
|
from src.game import Game
|
||||||
from src.importer.sources.location import Location
|
from src.importer.sources.location import Location
|
||||||
from src.importer.sources.source import SourceIterator, URLExecutableSource
|
from src.importer.sources.source import SourceIterable, URLExecutableSource
|
||||||
from src.utils.sqlite import copy_db
|
from src.utils.sqlite import copy_db
|
||||||
|
|
||||||
|
|
||||||
class LutrisSourceIterator(SourceIterator):
|
class LutrisSourceIterable(SourceIterable):
|
||||||
source: "LutrisSource"
|
source: "LutrisSource"
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
@@ -87,7 +87,7 @@ class LutrisSource(URLExecutableSource):
|
|||||||
"""Generic Lutris source"""
|
"""Generic Lutris source"""
|
||||||
|
|
||||||
name = _("Lutris")
|
name = _("Lutris")
|
||||||
iterator_class = LutrisSourceIterator
|
iterator_class = LutrisSourceIterable
|
||||||
url_format = "lutris:rungameid/{game_id}"
|
url_format = "lutris:rungameid/{game_id}"
|
||||||
available_on = {"linux"}
|
available_on = {"linux"}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ from src.importer.sources.location import Location
|
|||||||
SourceIterationResult = None | Game | tuple[Game, tuple[Any]]
|
SourceIterationResult = None | Game | tuple[Game, tuple[Any]]
|
||||||
|
|
||||||
|
|
||||||
class SourceIterator:
|
class SourceIterable(Iterable):
|
||||||
"""Data producer for a source of games"""
|
"""Data producer for a source of games"""
|
||||||
|
|
||||||
source: "Source" = None
|
source: "Source" = None
|
||||||
@@ -57,7 +57,7 @@ class Source(Iterable):
|
|||||||
data_location: Optional[Location] = None
|
data_location: Optional[Location] = None
|
||||||
cache_location: Optional[Location] = None
|
cache_location: Optional[Location] = None
|
||||||
config_location: Optional[Location] = None
|
config_location: Optional[Location] = None
|
||||||
iterator_class: type[SourceIterator]
|
iterator_class: type[SourceIterable]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def full_name(self) -> str:
|
def full_name(self) -> str:
|
||||||
@@ -89,7 +89,7 @@ class Source(Iterable):
|
|||||||
def executable_format(self) -> str:
|
def executable_format(self) -> str:
|
||||||
"""The executable format used to construct game executables"""
|
"""The executable format used to construct game executables"""
|
||||||
|
|
||||||
def __iter__(self) -> SourceIterator:
|
def __iter__(self) -> Generator[SourceIterationResult, None, None]:
|
||||||
"""
|
"""
|
||||||
Get an iterator for the source
|
Get an iterator for the source
|
||||||
:raises UnresolvableLocationError: Not iterable if any of the locations are unresolvable
|
:raises UnresolvableLocationError: Not iterable if any of the locations are unresolvable
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ from typing import Iterable
|
|||||||
from src import shared
|
from src import shared
|
||||||
from src.game import Game
|
from src.game import Game
|
||||||
from src.importer.sources.location import Location
|
from src.importer.sources.location import Location
|
||||||
from src.importer.sources.source import SourceIterator, URLExecutableSource
|
from src.importer.sources.source import SourceIterable, URLExecutableSource
|
||||||
from src.utils.steam import SteamFileHelper, SteamInvalidManifestError
|
from src.utils.steam import SteamFileHelper, SteamInvalidManifestError
|
||||||
|
|
||||||
|
|
||||||
class SteamSourceIterator(SourceIterator):
|
class SteamSourceIterable(SourceIterable):
|
||||||
source: "SteamSource"
|
source: "SteamSource"
|
||||||
|
|
||||||
def get_manifest_dirs(self) -> Iterable[Path]:
|
def get_manifest_dirs(self) -> Iterable[Path]:
|
||||||
@@ -112,7 +112,7 @@ class SteamSourceIterator(SourceIterator):
|
|||||||
class SteamSource(URLExecutableSource):
|
class SteamSource(URLExecutableSource):
|
||||||
name = _("Steam")
|
name = _("Steam")
|
||||||
available_on = {"linux", "win32"}
|
available_on = {"linux", "win32"}
|
||||||
iterator_class = SteamSourceIterator
|
iterator_class = SteamSourceIterable
|
||||||
url_format = "steam://rungameid/{game_id}"
|
url_format = "steam://rungameid/{game_id}"
|
||||||
|
|
||||||
data_location = Location(
|
data_location = Location(
|
||||||
|
|||||||
Reference in New Issue
Block a user