diff --git a/feeluown/gui/components/avatar.py b/feeluown/gui/components/avatar.py index f3867f9299..696b6ba940 100644 --- a/feeluown/gui/components/avatar.py +++ b/feeluown/gui/components/avatar.py @@ -113,7 +113,7 @@ async def _show_provider_current_user(self, source): assert provider is not None user = None if isinstance(provider, SupportsCurrentUser): - user = await run_fn(provider.get_current_user_or_none, source) + user = await run_fn(provider.get_current_user_or_none) if user is None: return None diff --git a/feeluown/gui/uimain/nowplaying_overlay.py b/feeluown/gui/uimain/nowplaying_overlay.py index da832c6ed8..6ce150f8a3 100644 --- a/feeluown/gui/uimain/nowplaying_overlay.py +++ b/feeluown/gui/uimain/nowplaying_overlay.py @@ -94,9 +94,11 @@ def enter_video_mode(self): video_widget = self._app.ui.mpv_widget video_widget.overlay_auto_visible = True if video_widget.parent() == self.artwork_view: + video_widget.show() self.artwork_view.set_body(video_widget) else: with video_widget.change_parent(): + video_widget.show() self.artwork_view.set_body(video_widget) self.ctl_btns.hide() self.progress.hide() diff --git a/feeluown/gui/watch.py b/feeluown/gui/watch.py index 65b8488f8b..1038c6e8da 100644 --- a/feeluown/gui/watch.py +++ b/feeluown/gui/watch.py @@ -105,9 +105,11 @@ def enter_fullwindow_mode(self, go_back=None): if video_widget.parent() != self._fullwindow_container: with video_widget.change_parent(): self._fullwindow_container.set_body(video_widget) + video_widget.show() self._fullwindow_container.show() self._fullwindow_container.raise_() else: + video_widget.show() self._fullwindow_container.show() self._fullwindow_container.raise_() @@ -139,9 +141,11 @@ def enter_pip_mode(self): if video_widget.parent() != self._pip_container: with video_widget.change_parent(): + video_widget.show() self._pip_container.attach_widget(video_widget) self._pip_container.show() else: + video_widget.show() self._pip_container.show() video_widget.ctl_bar.clear_adhoc_btns() diff --git a/feeluown/library/provider.py b/feeluown/library/provider.py index 685583965e..aac8d9e57e 100644 --- a/feeluown/library/provider.py +++ b/feeluown/library/provider.py @@ -64,6 +64,15 @@ def auth(self, user): """use provider as a specific user""" self._user = user + def get_current_user_or_none(self): + """ + .. versionadded: 4.0 + """ + try: + return self.get_current_user() + except NoUserLoggedIn: + return None + def search(self, *args, **kwargs): pass diff --git a/feeluown/player/playlist.py b/feeluown/player/playlist.py index d50c44d1c2..eea906781a 100644 --- a/feeluown/player/playlist.py +++ b/feeluown/player/playlist.py @@ -489,16 +489,12 @@ async def a_set_current_song(self, song): """ target_song = song # The song to be set. media = None # The corresponding media to be set. - try: media = await self._prepare_media(song) except MediaNotFound as e: if e.reason is MediaNotFound.Reason.check_children: await self.a_set_current_song_children(song) return - - logger.info(f'no media found for {song} due to {e}, mark it as bad') - self.mark_as_bad(song) except ProviderIOError as e: # FIXME: This may cause infinite loop when the prepare media always fails logger.error(f'prepare media failed: {e}, try next song') @@ -507,24 +503,27 @@ async def a_set_current_song(self, song): except Exception as e: # noqa # When the exception is unknown, we mark the song as bad. self._app.show_msg(f'获取歌曲链接失败: {e}') - logger.exception('prepare media failed due to unknown error, ' - 'so we mark the song as a bad one') - self.mark_as_bad(song) + logger.exception('prepare media failed due to unknown error') else: assert media, "media must not be empty" # The song has no media, try to find and use standby unless it is in fm mode. if media is None: - # if mode is fm mode, do not find standby song, just skip the song. - if self.mode is PlaylistMode.fm: - run_afn(self.a_next) - return if self._app.config.ENABLE_MV_AS_STANDBY: self._app.show_msg('尝试获取音乐视频的播放资源...') media = await self._prepare_mv_media(song) + if media: self._app.show_msg('使用音乐视频作为其播放资源 ✅') else: + # if mode is fm mode, do not find standby song, just skip the song. + if self.mode is PlaylistMode.fm: + self.mark_as_bad(song) + run_afn(self.a_next) + return + + logger.info(f"no media found for {song}, mark it as bad") + self.mark_as_bad(song) target_song, media = await self.find_and_use_standby(song) metadata = await self._prepare_metadata_for_song(target_song)