This repository has been archived by the owner on Jun 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
182 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ dist | |
__pycache__ | ||
.venv | ||
.pytest_cache | ||
.ruff_cache | ||
.coverage | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from pathlib import Path | ||
from typing import Annotated | ||
|
||
from fastapi import Depends, FastAPI | ||
from playbacker.config import Config, get_setlists_dir_path, get_songs_file_path | ||
from playbacker.core.player import Player | ||
|
||
|
||
def get_player() -> Player: | ||
... | ||
|
||
|
||
CurrentPlayer = Annotated[Player, Depends(get_player)] | ||
|
||
|
||
def get_config() -> Config: | ||
... | ||
|
||
|
||
CurrentConfig = Annotated[Config, Depends(get_config)] | ||
|
||
|
||
def get_setlist_dir_path_dep(config: CurrentConfig): | ||
return get_setlists_dir_path(config.config_dir_path) | ||
|
||
|
||
CurrentSetlistDir = Annotated[Path, Depends(get_setlist_dir_path_dep)] | ||
|
||
|
||
def get_songs_file_path_dep(config: CurrentConfig): | ||
return get_songs_file_path(config.config_dir_path) | ||
|
||
|
||
CurrentSongsFile = Annotated[Path, Depends(get_songs_file_path_dep)] | ||
|
||
|
||
def set_dependencies(app: FastAPI, player: Player, config: Config): | ||
app.dependency_overrides[get_player] = lambda: player | ||
app.dependency_overrides[get_config] = lambda: config | ||
app.dependency_overrides[get_config] = lambda: config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.