Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
iwalton3 committed May 14, 2024
1 parent afa970d commit d0a1148
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion jellyfin_mpv_shim/bulk_subtitle.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def render_message(message, show_text):
text = _("Selecting Tracks...")
for message in messages[-6:]:
text += "\n " + message
show_text(text, 2 ** 30, 1)
show_text(text, 2**30, 1)


def process_series(mode, player: "PlayerManager_type", m_raid=None, m_rsid=None):
Expand Down
2 changes: 1 addition & 1 deletion jellyfin_mpv_shim/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
def expo(max_value: Optional[int] = None):
n = 0
while True:
a = 2 ** n
a = 2**n
if max_value is None or a < max_value:
yield a
n += 1
Expand Down
1 change: 0 additions & 1 deletion jellyfin_mpv_shim/display_mirror/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

# noinspection PyPep8Naming,PyPep8Naming
def getUrl(serverAddress, name):

if not name:
raise Exception("Url name cannot be empty")

Expand Down
1 change: 0 additions & 1 deletion jellyfin_mpv_shim/gui_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def _show_file_win32(path: str):
def open_config():
show_file(confdir(APP_NAME))


except KeyError:
open_config = None
log.warning("Platform does not support opening folders.")
Expand Down
14 changes: 8 additions & 6 deletions jellyfin_mpv_shim/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ def _get_url_from_source(self):
and settings.direct_paths
and (settings.remote_direct_paths or self.parent.is_local)
):

if platform.startswith("win32") or platform.startswith("cygwin"):
# matches on SMB scheme
match = re.search("(?:\\\\).+:.*@(.+)", self.media_source["Path"])
Expand Down Expand Up @@ -274,7 +273,8 @@ def get_hls_tile_images(self, width, count):
for i in range(0, count):
data = BytesIO()
self.client.jellyfin._get_stream(
f"Videos/{self.item['Id']}/Trickplay/{width}/{i}.jpg?MediaSourceId={self.media_source['Id']}", data
f"Videos/{self.item['Id']}/Trickplay/{width}/{i}.jpg?MediaSourceId={self.media_source['Id']}",
data,
)
yield data.getvalue()

Expand All @@ -283,17 +283,19 @@ def get_bif(self, prefer_width=320):
print(manifest)
if (
manifest is not None
and manifest.get(self.media_source['Id']) is not None
and len(manifest[self.media_source['Id']]) > 0
and manifest.get(self.media_source["Id"]) is not None
and len(manifest[self.media_source["Id"]]) > 0
):
available_widths = [int(x) for x in manifest[self.media_source['Id']].keys()]
available_widths = [
int(x) for x in manifest[self.media_source["Id"]].keys()
]

if prefer_width is not None:
width = min(available_widths, key=lambda x: abs(x - prefer_width))
else:
width = max(available_widths)

return manifest[self.media_source['Id']][str(width)]
return manifest[self.media_source["Id"]][str(width)]
else:
return None

Expand Down
2 changes: 1 addition & 1 deletion jellyfin_mpv_shim/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def refresh_menu(self):
fmt = "\n **{0}**"
menu_text += fmt.format(item[0])

self.playerManager.show_text(menu_text, 2 ** 30, 1)
self.playerManager.show_text(menu_text, 2**30, 1)

def mouse_select(self, idx: int):
if idx < 0 or idx > len(self.menu_list):
Expand Down
9 changes: 7 additions & 2 deletions jellyfin_mpv_shim/mpv_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
from .conf import settings
from .clients import clientManager
from .constants import APP_NAME
from .log_utils import configure_log, configure_log_file, enable_sanitization, root_logger
from .log_utils import (
configure_log,
configure_log_file,
enable_sanitization,
root_logger,
)

logging.getLogger("requests").setLevel(logging.CRITICAL)

Expand All @@ -27,7 +32,7 @@ def main():
if settings.write_logs:
log_file = conffile.get(APP_NAME, "log.txt")
configure_log_file(log_file, settings.mpv_log_level)

log = root_logger

if sys.platform.startswith("darwin"):
Expand Down
1 change: 0 additions & 1 deletion jellyfin_mpv_shim/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,6 @@ def update(self):
and self._player.playback_time > self._video.intro_start
and self._player.playback_time < self._video.intro_end
):

if not self.is_in_intro:
if settings.skip_intro_always and not self.intro_has_triggered:
self.intro_has_triggered = True
Expand Down
9 changes: 2 additions & 7 deletions jellyfin_mpv_shim/trickplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ def run(self):
video = self.player.get_video()
try:
data = video.get_bif(settings.thumbnail_preferred_size)
if (
not self.player.has_video()
or video != self.player.get_video()
):
if not self.player.has_video() or video != self.player.get_video():
# Video changed while we were getting the bif file
continue

Expand All @@ -72,9 +69,7 @@ def run(self):
data["TileWidth"],
data["TileHeight"],
data["ThumbnailCount"],
video.get_hls_tile_images(
data["Width"], img_count
),
video.get_hls_tile_images(data["Width"], img_count),
fh,
)

Expand Down
2 changes: 1 addition & 1 deletion jellyfin_mpv_shim/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def get_profile(
"Condition": "LessThanEqual",
"Property": "Height",
"Value": "1080",
}
},
],
}
)
Expand Down

0 comments on commit d0a1148

Please sign in to comment.