Skip to content

Commit

Permalink
Remove detect dep, use cross-platform pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdelorenzo committed Nov 15, 2020
1 parent 27513d8 commit 960bcb8
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 19 deletions.
2 changes: 1 addition & 1 deletion onhold/after.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
ENV_VAR = 'DING'


def run(file: Path):
def run(file: Optional[Path]):
with play_after(file):
if not is_pipeline():
return
Expand Down
16 changes: 14 additions & 2 deletions onhold/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#from subprocess import run

from play_sounds import DEFAULT_SONG
from detect import unix as IS_UNIX


RC_OK = 0
Expand All @@ -21,11 +20,24 @@ def is_pipeline() -> bool:
return not stdin.isatty()


# python 3.8+ compatible
#def dumb_pipe():
# while data := stdin.buffer.read(CHUNK):
# stdout.buffer.write(data)


# python 3.6 compatible
def dumb_pipe():
while data := stdin.buffer.read(CHUNK):
while True:
data = stdin.buffer.read(CHUNK)

if not data:
break

stdout.buffer.write(data)



@contextmanager
def using_path(
sound_path: Optional[str],
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ click==7.1.2
boombox==0.56
play_sounds==0.0.5
playsound==1.2.2
detect==2020.7.1

PyObjc==6.2.2; sys_platform == 'darwin'
30 changes: 15 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


NAME = "onhold"
VERSION = "0.4.1"
VERSION = "0.5.0"
LICENSE = "AGPL-3.0"

DESC = "🔊 Play music while and after jobs complete"
Expand All @@ -23,18 +23,18 @@
}

setup(
name=NAME,
version=VERSION,
description=DESC,
long_description=README,
long_description_content_type="text/markdown",
url="https://alexdelorenzo.dev",
author=__author__,
license=LICENSE,
packages=[NAME],
zip_safe=False,
install_requires=REQUIREMENTS,
entry_points=ENTRY_POINTS,
python_requires='>=3.6',
include_package_data=True,
name=NAME,
version=VERSION,
description=DESC,
long_description=README,
long_description_content_type="text/markdown",
url="https://alexdelorenzo.dev",
author=__author__,
license=LICENSE,
packages=[NAME],
zip_safe=False,
install_requires=REQUIREMENTS,
entry_points=ENTRY_POINTS,
python_requires='>=3.6',
include_package_data=True,
)

0 comments on commit 960bcb8

Please sign in to comment.