Skip to content

Commit

Permalink
fix: iOS Hyperlink
Browse files Browse the repository at this point in the history
  • Loading branch information
r3tr0ananas committed Mar 17, 2024
1 parent e55284a commit 5bac90e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion mov_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
from .scraper import *
from .download import *

__version__ = "4.0.5"
__version__ = "4.0.6"
7 changes: 2 additions & 5 deletions mov_cli/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ def __init__(self, config: Config) -> None:
self.config = config

def download(self, media: Series | Movie, subtitles: str = None) -> subprocess.Popen:
title = unicodedata.normalize('NFKD', media.title).encode('ascii', 'ignore').decode('ascii') # normalize title

if hasattr(media, "episode"):
title += f" S{media.episode.season}E{media.episode.episode}"

title = unicodedata.normalize('NFKD', media.display_name).encode('ascii', 'ignore').decode('ascii') # normalize title

file = os.path.join(self.config.download_location, title + ".mp4")

args = [
Expand Down
9 changes: 3 additions & 6 deletions mov_cli/players/mpv.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,10 @@ def play(self, media: Media) -> subprocess.Popen:
# TODO: This should be moved to the VLC player class as it's invoking vlc not mpv.
self.logger.info("Detected your using iOS. \r\n")

print(
f"\e]8;;vlc-x-callback://x-callback-url/stream?url={media.url}\e\\-------------------------\n- Tap to open VLC -\n-------------------------\e]8;;\e\\\n"
)

self.logger.info("Sleeping for 10 Seconds.")
with open('/dev/clipboard', 'w') as f:
f.write(f"vlc://{media.url}")

time.sleep(10)
self.logger.info("The URL was copied into your clipboard. To play it, open a browser and paste the URL.")

else: # Windows, Linux and Other

Expand Down
14 changes: 7 additions & 7 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = ["E", "F"]
ignore = ["E501", "E402", "E702", "E701", "E731"]
lint.select = ["E", "F"]
lint.ignore = ["E501", "E402", "E702", "E701", "E731"]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
unfixable = []
lint.fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
lint.unfixable = []

# Exclude a variety of commonly ignored directories.
exclude = [
Expand Down Expand Up @@ -35,14 +35,14 @@ exclude = [
line-length = 88

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

target-version = "py38"

[mccabe]
[lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10

[per-file-ignores]
[lint.per-file-ignores]
"__init__.py" = ["F403"]
"scripts/*" = ["F401"]

0 comments on commit 5bac90e

Please sign in to comment.