commit e69e0e213c611220ea5913563d4f17f930aadd40 Author: Jack O'Sullivan Date: Tue Apr 18 13:58:58 2023 +0100 Initial commit diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5e6f9f6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/.direnv/ +/result +/ideas.md +__pycache__/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..9221309 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# boardie + +Linux soundboard thingy diff --git a/boardie/__init__.py b/boardie/__init__.py new file mode 100644 index 0000000..f70e22c --- /dev/null +++ b/boardie/__init__.py @@ -0,0 +1,8 @@ +import shutil + +import evdev +import pyaudio +import pydub + +def main(): + print(f'ffmpeg: {shutil.which("ffmpeg")}') diff --git a/boardie/__main__.py b/boardie/__main__.py new file mode 100644 index 0000000..c342665 --- /dev/null +++ b/boardie/__main__.py @@ -0,0 +1,5 @@ +import sys + +from boardie import main + +sys.exit(main()) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..7decad5 --- /dev/null +++ b/flake.lock @@ -0,0 +1,178 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1678957337, + "narHash": "sha256-Gw4nVbuKRdTwPngeOZQOzH/IFowmz4LryMPDiJN/ah4=", + "owner": "numtide", + "repo": "devshell", + "rev": "3e0e60ab37cd0bf7ab59888f5c32499d851edb47", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1642700792, + "narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "846b2ae0fc4cc943637d3d1def4454213e203cba", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1677383253, + "narHash": "sha256-UfpzWfSxkfXHnb4boXZNaKsAcUrZT9Hw+tao1oZxd08=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9952d6bc395f5841262b006fbace8dd7e143b634", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1681723626, + "narHash": "sha256-lu9vrGVzptuG+DyR1iaFnIHkliwEdOLPTT/IsZND+Cg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "269c677b54ea828a9f0f4cb02f4beee9c95a2284", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1681756206, + "narHash": "sha256-7B2Jc1zosXvZJKlxTPBlGew0LeX/7cxguG/d3syc1JI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6eceb07c28016ec50dd683fda94995702b67e855", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1681532901, + "narHash": "sha256-9ZN/gaCOlkx53km4J2QkLQh4bS+6UCBsjdi87kw6+jc=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "2e66fd2623eccb3086e52929c2cefd882faac8a8", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devshell": "devshell", + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2", + "poetry2nix": "poetry2nix" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ab56ee2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,71 @@ +{ + description = "Linux soundboard"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + devshell.url = "github:numtide/devshell"; + poetry2nix.url = "github:nix-community/poetry2nix"; + }; + + outputs = { self, nixpkgs, flake-utils, devshell, poetry2nix }: + let + inherit (nixpkgs.lib) composeManyExtensions; + inherit (flake-utils.lib) eachDefaultSystem; + + pyOverrides = pkgs: pkgs.poetry2nix.overrides.withDefaults (self: super: { + pyaudio = super.pyaudio.overridePythonAttrs (old: { + buildInputs = old.buildInputs ++ [ pkgs.portaudio ]; + }); + }); + in + { + overlays = rec { + boardie = composeManyExtensions [ + poetry2nix.overlay + (final: prev: { + boardie = prev.poetry2nix.mkPoetryApplication { + projectDir = ./.; + overrides = pyOverrides prev; + + makeWrapperArgs = [ + ''--prefix PATH ':' "${prev.ffmpeg}/bin"'' + ]; + meta.mainProgram = "boardie"; + }; + }) + ]; + default = boardie; + }; + } // (eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ + devshell.overlays.default + self.overlays.default + ]; + }; + in + { + devShells.default = pkgs.devshell.mkShell { + packages = with pkgs; [ + poetry + ffmpeg + (pkgs.poetry2nix.mkPoetryEnv { + projectDir = ./.; + overrides = pyOverrides pkgs; + }) + ]; + }; + + packages = rec { + inherit (pkgs) boardie; + default = boardie; + }; + + apps = rec { + inherit (pkgs) boardie; + default = boardie; + }; + })); +} diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..8695e46 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,53 @@ +# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. + +[[package]] +name = "evdev" +version = "1.6.1" +description = "Bindings to the Linux input handling subsystem" +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "evdev-1.6.1.tar.gz", hash = "sha256:299db8628cc73b237fc1cc57d3c2948faa0756e2a58b6194b5bf81dc2081f1e3"}, +] + +[[package]] +name = "pyaudio" +version = "0.2.13" +description = "Cross-platform audio I/O with PortAudio" +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "PyAudio-0.2.13-cp310-cp310-win32.whl", hash = "sha256:48e29537ea22ae2ae323eebe297bfb2683831cee4f20d96964e131f65ab2161d"}, + {file = "PyAudio-0.2.13-cp310-cp310-win_amd64.whl", hash = "sha256:87137cfd0ef8608a2a383be3f6996f59505e322dab9d16531f14cf542fa294f1"}, + {file = "PyAudio-0.2.13-cp311-cp311-win32.whl", hash = "sha256:13915faaa780e6bbbb6d745ef0e761674fd461b1b1b3f9c1f57042a534bfc0c3"}, + {file = "PyAudio-0.2.13-cp311-cp311-win_amd64.whl", hash = "sha256:59cc3cc5211b729c7854e3989058a145872cc58b1a7b46c6d4d88448a343d890"}, + {file = "PyAudio-0.2.13-cp37-cp37m-win32.whl", hash = "sha256:d294e3f85b2238649b1ff49ce3412459a8a312569975a89d14646536362d7576"}, + {file = "PyAudio-0.2.13-cp37-cp37m-win_amd64.whl", hash = "sha256:ff7f5e44ef51fe61da1e09c6f632f0b5808198edd61b363855cc7dd03bf4a8ac"}, + {file = "PyAudio-0.2.13-cp38-cp38-win32.whl", hash = "sha256:c6b302b048c054b7463936d8ba884b73877dc47012f3c94665dba92dd658ae04"}, + {file = "PyAudio-0.2.13-cp38-cp38-win_amd64.whl", hash = "sha256:1505d766ee718df6f5a18b73ac42307ba1cb4d2c0397873159254a34f67515d6"}, + {file = "PyAudio-0.2.13-cp39-cp39-win32.whl", hash = "sha256:eb128e4a6ea9b98d9a31f33c44978885af27dbe8ae53d665f8790cbfe045517e"}, + {file = "PyAudio-0.2.13-cp39-cp39-win_amd64.whl", hash = "sha256:910ef09225cce227adbba92622d4a3e3c8375117f7dd64039f287d9ffc0e02a1"}, + {file = "PyAudio-0.2.13.tar.gz", hash = "sha256:26bccc81e4243d1c0ff5487e6b481de6329fcd65c79365c267cef38f363a2b56"}, +] + +[package.extras] +test = ["numpy"] + +[[package]] +name = "pydub" +version = "0.25.1" +description = "Manipulate audio with an simple and easy high level interface" +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "pydub-0.25.1-py2.py3-none-any.whl", hash = "sha256:65617e33033874b59d87db603aa1ed450633288aefead953b30bded59cb599a6"}, + {file = "pydub-0.25.1.tar.gz", hash = "sha256:980a33ce9949cab2a569606b65674d748ecbca4f0796887fd6f46173a7b0d30f"}, +] + +[metadata] +lock-version = "2.0" +python-versions = "^3.10" +content-hash = "a3a55972f5afbae28f3b04b8c2d51919bce6524c0afcf43afa8a5590691a5c06" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..84b1ad0 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,19 @@ +[tool.poetry] +name = "boardie" +version = "0.1.0" +description = "Linux soundboard" +authors = ["Jack O'Sullivan "] +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.10" +evdev = "^1.6.1" +pydub = "^0.25.1" +pyaudio = "^0.2.13" + +[tool.poetry.scripts] +boardie = 'boardie:main' + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api"