Skip to content

Commit

Permalink
Figured out the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rdbende committed Jul 5, 2024
1 parent 768d625 commit c2adc5c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
3 changes: 2 additions & 1 deletion cozy/app_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from cozy.control.filesystem_monitor import FilesystemMonitor
from cozy.control.offline_cache import OfflineCache
from cozy.media.files import Files
from cozy.media.player import Player
from cozy.media.player import GstPlayer, Player
from cozy.model.book import Book
from cozy.model.database_importer import DatabaseImporter
from cozy.model.library import Library
Expand Down Expand Up @@ -99,6 +99,7 @@ def configure_inject(self, binder):
binder.bind_to_constructor(HeaderbarViewModel, lambda: HeaderbarViewModel())
binder.bind_to_constructor(PlaybackSpeedViewModel, lambda: PlaybackSpeedViewModel())
binder.bind_to_constructor(SleepTimerViewModel, lambda: SleepTimerViewModel())
binder.bind_to_constructor(GstPlayer, lambda: GstPlayer())
binder.bind_to_constructor(PowerManager, lambda: PowerManager())
binder.bind_to_constructor(ToastNotifier, lambda: ToastNotifier())
binder.bind_to_constructor(AppViewModel, lambda: AppViewModel())
Expand Down
15 changes: 7 additions & 8 deletions cozy/media/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@


class GstPlayer(EventSender):
_bus: Gst.Bus | None
_player: Gst.Bin | None
_bus: Gst.Bus
_player: Gst.Bin

def __init__(self):
super().__init__()
Expand All @@ -34,10 +34,11 @@ def __init__(self):
self._playback_speed_timer_running: bool = False
self._volume: float = 1.0

Gst.init(None)
self.setup_pipeline()

def setup_pipeline(self):
Gst.init(None)

scaletempo = Gst.ElementFactory.make("scaletempo", "scaletempo")
scaletempo.sync_state_with_parent()

Expand All @@ -46,10 +47,9 @@ def setup_pipeline(self):

audiosink = Gst.ElementFactory.make("autoaudiosink", "audiosink")
audiobin.add(audiosink)

scaletempo.link(audiosink)
pad = scaletempo.get_static_pad("sink")
ghost_pad = Gst.GhostPad.new("sink", pad)

ghost_pad = Gst.GhostPad.new("sink", scaletempo.get_static_pad("sink"))
audiobin.add_pad(ghost_pad)

self._player = Gst.ElementFactory.make("playbin", "player")
Expand Down Expand Up @@ -289,15 +289,14 @@ class Player(EventSender):
_offline_cache: OfflineCache = inject.attr(OfflineCache)
_toast: ToastNotifier = inject.attr(ToastNotifier)
_importer: Importer = inject.attr(Importer)
_gst_player: GstPlayer = inject.attr(GstPlayer)

def __init__(self):
super().__init__()

self._book: Optional[Book] = None
self._play_next_chapter: bool = True

self._gst_player = GstPlayer()

self._importer.add_listener(self._on_importer_event)
self._gst_player.add_listener(self._on_gst_player_event)

Expand Down

0 comments on commit c2adc5c

Please sign in to comment.