turned it into a package

This commit is contained in:
2021-10-07 22:20:12 +02:00
parent 0dfa4c45af
commit 86bc41a2f2
7 changed files with 44 additions and 7 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
env/
*egg-info/
__pycache__/
build/
dist/

7
LICENSE.txt Normal file
View File

@@ -0,0 +1,7 @@
Copyright 2021 Zev Benjamin Averbach
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,8 +1,15 @@
# Installation
```bash
git clone https://github.com/zevaverbach/extract_audio_from_video
ln -s <wherever you cloned it to>/app/extract_audio /usr/local/bin/extract
pip install extract-audio
```
## Prequisites
ffmpeg
```bash
$ brew install ffmpeg
```
# Usage
@@ -10,5 +17,4 @@ ln -s <wherever you cloned it to>/app/extract_audio /usr/local/bin/extract
```bash
extract <directory full of (only) video files>
```
This will produce m4a versions of the video files in that same directory.

0
app/__init__.py Normal file
View File

View File

@@ -7,10 +7,11 @@ import threading
def extract_audio(dir_, fp):
return check_output(f"ffmpeg -i {fp} -vn -acodec copy {dir_}{fp.stem}.m4a", shell=True)
return check_output(f'ffmpeg -y -i "{fp}" -vn -acodec copy "{dir_}{fp.stem}.m4a"', shell=True)
def main(dir_):
def main():
dir_ = args[1]
threads = []
for fp in Path(dir_).iterdir():
a = threading.Thread(
@@ -27,5 +28,4 @@ def main(dir_):
if __name__ == "__main__":
dirpath = args[1]
main(dirpath)
main()

2
setup.cfg Normal file
View File

@@ -0,0 +1,2 @@
[metadata]
license_files = LICENSE.txt

17
setup.py Normal file
View File

@@ -0,0 +1,17 @@
from setuptools import setup
setup(
name="extract-audio",
version="0.1",
packages=["app"],
description="Extract audio from a directory of video files.",
author="Zev Averbach",
author_email="zev@averba.ch",
url="https://github.com/zevaverbach/extract_audio_from_video",
entry_points={
"console_scripts": [
"extract=app.extract_audio:main",
]
},
)