0.0.2 fixed some bugs and improved README.md

This commit is contained in:
Bigsk 2023-02-23 00:47:54 +08:00
parent a6e305a3d6
commit 585c0f0933
5 changed files with 73 additions and 29 deletions

View File

@ -1,3 +1,34 @@
# pycw
Python Morse Code Generator
Python Morse Code Generator
Generate Morse Code (CW) audio files in Python.
## Usage
```
optional arguments:
-h, --help show this help message and exit
-i INPUT, --input INPUT
Input text file (defaults to stdin)
-t TEXT, --text TEXT Input text. Overrides --input.
-s SPEED, --speed SPEED
Speed, in words per minute (default: 12)
-n TONE, --tone TONE Tone frequency, in Hz (default: 800)
-v VOLUME, --volume VOLUME
Volume (default: 1.0)
-r SAMPLE_RATE, --sample_rate SAMPLE_RATE
Sample rate (default: 44100)
-o OUTPUT, --output OUTPUT
Name of the output file
```
Or `import pycw` and then use functions in your code, for example:
```
import pycw
pycw.output_wave("Intro.wav", "CQ CQ CQ DE BG5AWO BG5AWO BG5AWO PSE K", 20)
```
Then you can get a output file called `Intro.wav` in your working directory.

View File

@ -6,8 +6,6 @@ from .morse import stream_wave
from .morse import output_wave
from .morse import normalize_text
__version__ = '0.0.1'
__all__ = [
"synth",
"DIT",

View File

@ -1,3 +1,5 @@
import os
from argparse import ArgumentParser
from . import output_wave
@ -28,8 +30,8 @@ def main():
else:
input_text = args.text
if input_text == "-":
print('usage: -h to learn more')
if input_text == "-" or input_text is None:
os.system("pycw -h")
else:
output_wave(
args.output, input_text,

8
pycw/__version__.py Normal file
View File

@ -0,0 +1,8 @@
__title__ = "pycw"
__description__ = "Generate Morse Code (CW) audio files in Python."
__url__ = "https://github.com/bigsk05/pycw"
__version__ = '0.0.2'
__author__ = "Ian Xia"
__author_email__ = "i@ianxia.com"
__license__ = "Apache 2.0"
__copyright__ = "Copyright Ian Xia"

View File

@ -1,27 +1,32 @@
import os
import sys
from setuptools import setup, find_packages
version = '0.0.1'
about = {}
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "pycw", "__version__.py"), "r") as f:
exec(f.read(), about)
longdesc = """\
PyCW
#######
Generate Morse Code (CW) audio files in Python.
Repository and documentation: https://github.com/bigsk05/pycw
"""
with open("README.md", "r") as f:
readme = f.read()
if sys.argv[-1] == "publish":
os.system("python setup.py sdist bdist_wheel")
os.system("twine upload dist/*")
sys.exit()
setup(
name='pycw',
version=version,
name=about["__title__"],
version=about["__version__"],
description=about["__description__"],
packages=find_packages(),
url='https://github.com/bigsk05/pycw',
license='Apache Software License',
author='Ian Xia',
author_email='i@ianxia.com',
description='Generate Morse Code (CW) audio files in Python',
long_description=longdesc,
url=about["__url__"],
license=about["__license__"],
author=about["__author__"],
author_email=about["__author_email__"],
long_description_content_type="text/markdown",
long_description=readme,
install_requires=[
'numpy',
],
@ -32,16 +37,16 @@ setup(
# 'Programming Language :: Python :: 3.1',
# 'Programming Language :: Python :: 3.2',
# 'Programming Language :: Python :: 3.3',
# 'Programming Language :: Python :: 3.4',
# 'Programming Language :: Python :: 3.5',
# 'Programming Language :: Python :: 3.6',
# 'Programming Language :: Python :: 3.7',
# 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
# 'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3 :: Only',
],
entry_points={
'console_scripts': ['pycw=pycw:main'],
'console_scripts': ['pycw=pycw.__main__:main'],
},
package_data={'': ['README.md']},
include_package_data=True,