Skip to content

Commit

Permalink
fix pylint & flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
mokurin000 committed Jan 9, 2024
1 parent 8f0124c commit 70336f5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
16 changes: 8 additions & 8 deletions feeluown/nowplaying/nowplaying.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
# todo: fix! aionp.interface.macos treat aionp time as milisecond while
# other two interface treat it as microsecond (which is commented
# at aionp.interface.base)
def sec_to_μs(t_sec):
def sec_to_us(t_sec):
return int(t_sec * 1000 * 1000)


def μs_to_sec(t_microsec):
def us_to_sec(t_microsec):
return t_microsec / 1000 / 1000


Expand Down Expand Up @@ -82,10 +82,10 @@ def update_song_metadata(self, meta: dict):
self.set_playback_property(PlayProp.Metadata, metadata)

def update_duration(self, duration):
self.set_playback_property(PlayProp.Duration, int(sec_to_μs(duration or 0)))
self.set_playback_property(PlayProp.Duration, int(sec_to_us(duration or 0)))

def update_position(self, position):
self.set_playback_property(PlayProp.Position, int(sec_to_μs(position or 0)))
self.set_playback_property(PlayProp.Position, int(sec_to_us(position or 0)))

def update_playback_status(self, state):
self.set_playback_property(PlayProp.PlaybackStatus,
Expand Down Expand Up @@ -118,16 +118,16 @@ def on_shuffle(self, shuffle: bool):
self._app.playlist.playback_mode = PlaybackMode.sequential

def on_set_position(self, track_id: str, position: int):
self._app.player.position = μs_to_sec(position)
self._app.player.position = us_to_sec(position)

def on_seek(self, offset_us: int):
self._app.player.position = μs_to_sec(offset_us)
self._app.player.position = us_to_sec(offset_us)

def get_playback_property(self, name: PlayProp):
if name == PlayProp.Duration:
return sec_to_μs(self._app.player.duration)
return sec_to_us(self._app.player.duration)
elif name == PlayProp.Position:
return sec_to_μs(self._app.player.position)
return sec_to_us(self._app.player.position)
elif name == PlayProp.PlaybackStatus:
return StatePlaybackStatusMapping[self._app.player.state]
elif name == PlayProp.Rate:
Expand Down
5 changes: 3 additions & 2 deletions feeluown/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ def _scan_entry_points(self):
https://packaging.python.org/guides/creating-and-discovering-plugins/
"""
try:
import importlib_metadata # pylint: disable=redefined-outer-name
entry_points = importlib_metadata.entry_points().select(group='fuo.plugins_v1')
import importlib_metadata # pylint: disable=redefined-outer-name
entry_points = importlib_metadata.entry_points() \
.select(group='fuo.plugins_v1')
except ImportError:
import pkg_resources
entry_points = pkg_resources.iter_entry_points('fuo.plugins_v1')
Expand Down

0 comments on commit 70336f5

Please sign in to comment.