PySSTV 0.5.3__tar.gz → 0.5.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. PySSTV-0.5.5/PKG-INFO +95 -0
  2. PySSTV-0.5.5/PySSTV.egg-info/PKG-INFO +95 -0
  3. {PySSTV-0.5.3 → PySSTV-0.5.5}/PySSTV.egg-info/SOURCES.txt +2 -14
  4. {PySSTV-0.5.3 → PySSTV-0.5.5}/PySSTV.egg-info/entry_points.txt +0 -1
  5. {PySSTV-0.5.3 → PySSTV-0.5.5}/README.md +1 -3
  6. PySSTV-0.5.5/pyproject.toml +3 -0
  7. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/examples/codegen.py +16 -16
  8. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/examples/gimp-plugin.py +8 -8
  9. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/examples/pyaudio_sstv.py +1 -1
  10. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/examples/repeater.py +4 -4
  11. {PySSTV-0.5.3 → PySSTV-0.5.5}/setup.py +1 -1
  12. PySSTV-0.5.3/.gitignore +0 -1
  13. PySSTV-0.5.3/.travis.yml +0 -9
  14. PySSTV-0.5.3/PKG-INFO +0 -96
  15. PySSTV-0.5.3/PySSTV.egg-info/PKG-INFO +0 -96
  16. PySSTV-0.5.3/pysstv/examples/codeman.c +0 -25
  17. PySSTV-0.5.3/pysstv/tests/assets/320x256.png +0 -0
  18. PySSTV-0.5.3/pysstv/tests/assets/MartinM1_encode_line_lena1.p +0 -2894
  19. PySSTV-0.5.3/pysstv/tests/assets/MartinM1_encode_line_lena10.p +0 -2894
  20. PySSTV-0.5.3/pysstv/tests/assets/MartinM1_encode_line_lena100.p +0 -2894
  21. PySSTV-0.5.3/pysstv/tests/assets/MartinM1_freq_bits.p +0 -3002
  22. PySSTV-0.5.3/pysstv/tests/assets/MartinM1_freq_bits_lena.p +0 -3002
  23. PySSTV-0.5.3/pysstv/tests/assets/MartinM1_values.p +0 -1002
  24. PySSTV-0.5.3/pysstv/tests/assets/SSTV_gen_samples.p +0 -1002
  25. PySSTV-0.5.3/pysstv/tests/assets/SSTV_gen_values.p +0 -1002
  26. PySSTV-0.5.3/requirements.txt +0 -3
  27. {PySSTV-0.5.3 → PySSTV-0.5.5}/LICENSE.txt +0 -0
  28. {PySSTV-0.5.3 → PySSTV-0.5.5}/MANIFEST.in +0 -0
  29. {PySSTV-0.5.3 → PySSTV-0.5.5}/PySSTV.egg-info/dependency_links.txt +0 -0
  30. {PySSTV-0.5.3 → PySSTV-0.5.5}/PySSTV.egg-info/requires.txt +0 -0
  31. {PySSTV-0.5.3 → PySSTV-0.5.5}/PySSTV.egg-info/top_level.txt +0 -0
  32. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/__init__.py +0 -0
  33. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/__main__.py +0 -0
  34. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/color.py +0 -0
  35. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/examples/__init__.py +0 -0
  36. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/examples/get_floats.py +0 -0
  37. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/examples/get_freq_bits.py +0 -0
  38. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/examples/overlay.py +0 -0
  39. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/grayscale.py +0 -0
  40. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/sstv.py +0 -0
  41. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/tests/__init__.py +0 -0
  42. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/tests/common.py +0 -0
  43. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/tests/test_color.py +0 -0
  44. {PySSTV-0.5.3 → PySSTV-0.5.5}/pysstv/tests/test_sstv.py +0 -0
  45. {PySSTV-0.5.3 → PySSTV-0.5.5}/setup.cfg +0 -0
PySSTV-0.5.5/PKG-INFO ADDED
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.1
2
+ Name: PySSTV
3
+ Version: 0.5.5
4
+ Summary: Python classes for generating Slow-scan Television transmissions
5
+ Home-page: https://github.com/dnet/pySSTV
6
+ Author: András Veres-Szentkirályi
7
+ Author-email: vsza@vsza.hu
8
+ License: MIT
9
+ Keywords: HAM SSTV slow-scan television Scottie Martin Robot Pasokon
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Topic :: Communications :: Ham Radio
12
+ Classifier: Topic :: Multimedia :: Video :: Conversion
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE.txt
17
+ Requires-Dist: Pillow
18
+
19
+ SSTV generator in pure Python
20
+ =============================
21
+
22
+ PySSTV generates SSTV modulated WAV files from any image that PIL can open
23
+ (PNG, JPEG, GIF, and many others). These WAV files then can be played by any
24
+ audio player connected to a shortwave radio for example.
25
+
26
+ My main motivation was to understand the internals of SSTV in practice, so
27
+ performance is far from optimal. I tried keeping the code readable, and only
28
+ performed such optimizations that wouldn't have complicated the codebase.
29
+
30
+ Command line usage
31
+ ------------------
32
+
33
+ $ python -m pysstv -h
34
+ usage: __main__.py [-h]
35
+ [--mode {MartinM1,MartinM2,ScottieS1,ScottieS2,Robot36,PasokonP3,PasokonP5,PasokonP7,PD90,PD120,PD160,PD180,PD240,PD290,Robot8BW,Robot24BW}]
36
+ [--rate RATE] [--bits BITS] [--vox] [--fskid FSKID]
37
+ [--chan CHAN]
38
+ image.png output.wav
39
+
40
+ Converts an image to an SSTV modulated WAV file.
41
+
42
+ positional arguments:
43
+ image.png input image file name
44
+ output.wav output WAV file name
45
+
46
+ optional arguments:
47
+ -h, --help show this help message and exit
48
+ --mode {MartinM1,MartinM2,ScottieS1,ScottieS2,Robot36,PasokonP3,PasokonP5,PasokonP7,PD90,PD120D160,PD180,PD240,Robot8BW,Robot24BW}
49
+ image mode (default: Martin M1)
50
+ --rate RATE sampling rate (default: 48000)
51
+ --bits BITS bits per sample (default: 16)
52
+ --vox add VOX tones at the beginning
53
+ --fskid FSKID add FSKID at the end
54
+ --chan CHAN number of channels (default: mono)
55
+
56
+ Python interface
57
+ ----------------
58
+
59
+ The `SSTV` class in the `sstv` module implements basic SSTV-related
60
+ functionality, and the classes of other modules such as `grayscale` and
61
+ `color` extend this. Most instances implement the following methods:
62
+
63
+ - `__init__` takes a PIL image, the samples per second, and the bits per
64
+ sample as a parameter, but doesn't perform any hard calculations
65
+ - `gen_freq_bits` generates tuples that describe a sine wave segment with
66
+ frequency in Hz and duration in ms
67
+ - `gen_values` generates samples between -1 and +1, performing sampling
68
+ according to the samples per second value given during construction
69
+ - `gen_samples` generates discrete samples, performing quantization
70
+ according to the bits per sample value given during construction
71
+ - `write_wav` writes the whole image to a Microsoft WAV file
72
+
73
+ The above methods all build upon those above them, for example `write_wav`
74
+ calls `gen_samples`, while latter calls `gen_values`, so typically, only
75
+ the first and the last, maybe the last two should be called directly, the
76
+ others are just listed here for the sake of completeness and to make the
77
+ flow easier to understand.
78
+
79
+ License
80
+ -------
81
+
82
+ The whole project is available under MIT license.
83
+
84
+ Useful links
85
+ ------------
86
+
87
+ - receive-only "counterpart": https://github.com/windytan/slowrx
88
+ - free SSTV handbook: http://www.sstv-handbook.com/
89
+ - robot 36 encoder/decoder in C: https://github.com/xdsopl/robot36/
90
+
91
+ Dependencies
92
+ ------------
93
+
94
+ - Python 3.5 or later
95
+ - Python Imaging Library (Debian/Ubuntu package: `python3-pil`)
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.1
2
+ Name: PySSTV
3
+ Version: 0.5.5
4
+ Summary: Python classes for generating Slow-scan Television transmissions
5
+ Home-page: https://github.com/dnet/pySSTV
6
+ Author: András Veres-Szentkirályi
7
+ Author-email: vsza@vsza.hu
8
+ License: MIT
9
+ Keywords: HAM SSTV slow-scan television Scottie Martin Robot Pasokon
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Topic :: Communications :: Ham Radio
12
+ Classifier: Topic :: Multimedia :: Video :: Conversion
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE.txt
17
+ Requires-Dist: Pillow
18
+
19
+ SSTV generator in pure Python
20
+ =============================
21
+
22
+ PySSTV generates SSTV modulated WAV files from any image that PIL can open
23
+ (PNG, JPEG, GIF, and many others). These WAV files then can be played by any
24
+ audio player connected to a shortwave radio for example.
25
+
26
+ My main motivation was to understand the internals of SSTV in practice, so
27
+ performance is far from optimal. I tried keeping the code readable, and only
28
+ performed such optimizations that wouldn't have complicated the codebase.
29
+
30
+ Command line usage
31
+ ------------------
32
+
33
+ $ python -m pysstv -h
34
+ usage: __main__.py [-h]
35
+ [--mode {MartinM1,MartinM2,ScottieS1,ScottieS2,Robot36,PasokonP3,PasokonP5,PasokonP7,PD90,PD120,PD160,PD180,PD240,PD290,Robot8BW,Robot24BW}]
36
+ [--rate RATE] [--bits BITS] [--vox] [--fskid FSKID]
37
+ [--chan CHAN]
38
+ image.png output.wav
39
+
40
+ Converts an image to an SSTV modulated WAV file.
41
+
42
+ positional arguments:
43
+ image.png input image file name
44
+ output.wav output WAV file name
45
+
46
+ optional arguments:
47
+ -h, --help show this help message and exit
48
+ --mode {MartinM1,MartinM2,ScottieS1,ScottieS2,Robot36,PasokonP3,PasokonP5,PasokonP7,PD90,PD120D160,PD180,PD240,Robot8BW,Robot24BW}
49
+ image mode (default: Martin M1)
50
+ --rate RATE sampling rate (default: 48000)
51
+ --bits BITS bits per sample (default: 16)
52
+ --vox add VOX tones at the beginning
53
+ --fskid FSKID add FSKID at the end
54
+ --chan CHAN number of channels (default: mono)
55
+
56
+ Python interface
57
+ ----------------
58
+
59
+ The `SSTV` class in the `sstv` module implements basic SSTV-related
60
+ functionality, and the classes of other modules such as `grayscale` and
61
+ `color` extend this. Most instances implement the following methods:
62
+
63
+ - `__init__` takes a PIL image, the samples per second, and the bits per
64
+ sample as a parameter, but doesn't perform any hard calculations
65
+ - `gen_freq_bits` generates tuples that describe a sine wave segment with
66
+ frequency in Hz and duration in ms
67
+ - `gen_values` generates samples between -1 and +1, performing sampling
68
+ according to the samples per second value given during construction
69
+ - `gen_samples` generates discrete samples, performing quantization
70
+ according to the bits per sample value given during construction
71
+ - `write_wav` writes the whole image to a Microsoft WAV file
72
+
73
+ The above methods all build upon those above them, for example `write_wav`
74
+ calls `gen_samples`, while latter calls `gen_values`, so typically, only
75
+ the first and the last, maybe the last two should be called directly, the
76
+ others are just listed here for the sake of completeness and to make the
77
+ flow easier to understand.
78
+
79
+ License
80
+ -------
81
+
82
+ The whole project is available under MIT license.
83
+
84
+ Useful links
85
+ ------------
86
+
87
+ - receive-only "counterpart": https://github.com/windytan/slowrx
88
+ - free SSTV handbook: http://www.sstv-handbook.com/
89
+ - robot 36 encoder/decoder in C: https://github.com/xdsopl/robot36/
90
+
91
+ Dependencies
92
+ ------------
93
+
94
+ - Python 3.5 or later
95
+ - Python Imaging Library (Debian/Ubuntu package: `python3-pil`)
@@ -1,9 +1,7 @@
1
- .gitignore
2
- .travis.yml
3
1
  LICENSE.txt
4
2
  MANIFEST.in
5
3
  README.md
6
- requirements.txt
4
+ pyproject.toml
7
5
  setup.py
8
6
  PySSTV.egg-info/PKG-INFO
9
7
  PySSTV.egg-info/SOURCES.txt
@@ -18,7 +16,6 @@ pysstv/grayscale.py
18
16
  pysstv/sstv.py
19
17
  pysstv/examples/__init__.py
20
18
  pysstv/examples/codegen.py
21
- pysstv/examples/codeman.c
22
19
  pysstv/examples/get_floats.py
23
20
  pysstv/examples/get_freq_bits.py
24
21
  pysstv/examples/gimp-plugin.py
@@ -28,13 +25,4 @@ pysstv/examples/repeater.py
28
25
  pysstv/tests/__init__.py
29
26
  pysstv/tests/common.py
30
27
  pysstv/tests/test_color.py
31
- pysstv/tests/test_sstv.py
32
- pysstv/tests/assets/320x256.png
33
- pysstv/tests/assets/MartinM1_encode_line_lena1.p
34
- pysstv/tests/assets/MartinM1_encode_line_lena10.p
35
- pysstv/tests/assets/MartinM1_encode_line_lena100.p
36
- pysstv/tests/assets/MartinM1_freq_bits.p
37
- pysstv/tests/assets/MartinM1_freq_bits_lena.p
38
- pysstv/tests/assets/MartinM1_values.p
39
- pysstv/tests/assets/SSTV_gen_samples.p
40
- pysstv/tests/assets/SSTV_gen_values.p
28
+ pysstv/tests/test_sstv.py
@@ -1,3 +1,2 @@
1
1
  [console_scripts]
2
2
  pysstv = pysstv.__main__:main
3
-
@@ -1,8 +1,6 @@
1
1
  SSTV generator in pure Python
2
2
  =============================
3
3
 
4
- [![Build Status](https://travis-ci.org/dnet/pySSTV.svg?branch=master)](https://travis-ci.org/dnet/pySSTV)
5
-
6
4
  PySSTV generates SSTV modulated WAV files from any image that PIL can open
7
5
  (PNG, JPEG, GIF, and many others). These WAV files then can be played by any
8
6
  audio player connected to a shortwave radio for example.
@@ -76,4 +74,4 @@ Dependencies
76
74
  ------------
77
75
 
78
76
  - Python 3.5 or later
79
- - Python Imaging Library (Debian/Ubuntu package: `python-imaging`)
77
+ - Python Imaging Library (Debian/Ubuntu package: `python3-pil`)
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools"]
3
+ build-backend = "setuptools.build_meta"
@@ -69,10 +69,10 @@ def main(sstv_class=None):
69
69
  n += 1
70
70
  del lut
71
71
  m_start, m_len = gen_matches(same_as, history, n)
72
- for i in xrange(same_as[m_start]):
72
+ for i in range(same_as[m_start]):
73
73
  yield history[i][0]
74
74
  yield 'for (int row = 0; row < width * {0}; row += width) {{'.format(sstv.HEIGHT)
75
- for i in xrange(same_as[m_start], same_as[m_start] + m_len - 1):
75
+ for i in range(same_as[m_start], same_as[m_start] + m_len - 1):
76
76
  yield ' ' + history[i][1]
77
77
  yield '}'
78
78
  yield '}}\n\n#define FREQ_COUNT {0}'.format(n)
@@ -83,7 +83,7 @@ def gen_matches(same_as, history, n):
83
83
  cur_start = None
84
84
  cur_len = None
85
85
  cur_end = None
86
- for i in xrange(n):
86
+ for i in range(n):
87
87
  if cur_start is None:
88
88
  tmp = same_as.get(i)
89
89
  if tmp is not None:
@@ -114,22 +114,22 @@ def test(img_file):
114
114
  import struct
115
115
  exe = './codegen-test-executable'
116
116
  if not path.exists('stb_image.h'):
117
- from urllib import urlretrieve
117
+ from urllib.request import urlretrieve
118
118
  urlretrieve('https://raw.githubusercontent.com/nothings/stb/master/stb_image.h', 'stb_image.h')
119
119
  try:
120
120
  for sstv_class in supported:
121
- print 'Testing', sstv_class
121
+ print('Testing', sstv_class)
122
122
  gcc = Popen(['gcc', '-xc', '-lm', '-o', exe, '-'], stdin=PIPE)
123
123
  start = datetime.now()
124
124
  with open(path.join(path.dirname(__file__), 'codeman.c')) as cm:
125
125
  c_src = cm.read().replace('#include "codegen.c"', '\n'.join(main(sstv_class)))
126
126
  gcc.communicate(c_src)
127
127
  gen_elapsed = datetime.now() - start
128
- print ' - gengcc took', gen_elapsed
128
+ print(' - gengcc took', gen_elapsed)
129
129
  start = datetime.now()
130
130
  gen = check_output([exe, img_file])
131
131
  native_elapsed = datetime.now() - start
132
- print ' - native took', native_elapsed
132
+ print(' - native took', native_elapsed)
133
133
  img = Image.open(img_file)
134
134
  sstv = sstv_class(img, 44100, 16)
135
135
  start = datetime.now()
@@ -138,20 +138,20 @@ def test(img_file):
138
138
  assert gen[n * 8:(n + 1) * 8] == struct.pack('ff', freq, msec)
139
139
  except AssertionError:
140
140
  mode_name = sstv_class.__name__
141
- with file('/tmp/{0}-c.bin'.format(mode_name), 'wb') as f:
141
+ with open('/tmp/{0}-c.bin'.format(mode_name), 'wb') as f:
142
142
  f.write(gen)
143
- with file('/tmp/{0}-py.bin'.format(mode_name), 'wb') as f:
143
+ with open('/tmp/{0}-py.bin'.format(mode_name), 'wb') as f:
144
144
  for n, (freq, msec) in enumerate(sstv.gen_freq_bits()):
145
145
  f.write(struct.pack('ff', freq, msec))
146
- with file('/tmp/{0}.c'.format(mode_name), 'w') as f:
146
+ with open('/tmp/{0}.c'.format(mode_name), 'w') as f:
147
147
  f.write(c_src)
148
- print (" ! Outputs are different, they've been saved to "
148
+ print((" ! Outputs are different, they've been saved to "
149
149
  "/tmp/{0}-{{c,py}}.bin, along with the C source code "
150
- "in /tmp/{0}.c").format(mode_name)
150
+ "in /tmp/{0}.c").format(mode_name))
151
151
  python_elapsed = datetime.now() - start
152
- print ' - python took', python_elapsed
153
- print ' - speedup:', python_elapsed.total_seconds() / native_elapsed.total_seconds()
154
- print 'OK'
152
+ print(' - python took', python_elapsed)
153
+ print(' - speedup:', python_elapsed.total_seconds() / native_elapsed.total_seconds())
154
+ print('OK')
155
155
  finally:
156
156
  try:
157
157
  remove(exe)
@@ -164,4 +164,4 @@ if __name__ == '__main__':
164
164
  if len(argv) > 2 and argv[1] == 'test':
165
165
  test(argv[2])
166
166
  else:
167
- print '\n'.join(main())
167
+ print('\n'.join(main()))
@@ -6,13 +6,13 @@
6
6
 
7
7
  from gimpfu import register, main, pdb, PF_BOOL, PF_STRING, PF_RADIO, CLIP_TO_IMAGE
8
8
  from PIL import Image, ImageTk
9
- from Tkinter import Tk, Canvas, Button, Checkbutton, IntVar, Frame, LEFT, NW
9
+ from tkinter import Tk, Canvas, Button, Checkbutton, IntVar, Frame, LEFT, NW
10
10
  from pysstv import __main__ as pysstv_main
11
11
  from pysstv.examples.pyaudio_sstv import PyAudioSSTV
12
12
  from pysstv.sstv import SSTV
13
13
  from itertools import repeat
14
14
  from threading import Thread
15
- from Queue import Queue, Empty
15
+ from queue import Queue, Empty
16
16
  from time import sleep
17
17
  import gimp, os
18
18
 
@@ -118,12 +118,12 @@ class ProgressCanvas(Canvas):
118
118
  self.height_ratio = 1
119
119
  width, height = image.size
120
120
  pixels = image.load()
121
- RED, GREEN, BLUE = range(3)
121
+ RED, GREEN, BLUE = list(range(3))
122
122
  self.colors = ['#{0:02x}{1:02x}{2:02x}'.format(
123
- contrast(sum(pixels[x, y][RED] for x in xrange(width)) / width),
124
- contrast(sum(pixels[x, y][GREEN] for x in xrange(width)) / width),
125
- contrast(sum(pixels[x, y][BLUE] for x in xrange(width)) / width))
126
- for y in xrange(height)]
123
+ contrast(sum(pixels[x, y][RED] for x in range(width)) / width),
124
+ contrast(sum(pixels[x, y][GREEN] for x in range(width)) / width),
125
+ contrast(sum(pixels[x, y][BLUE] for x in range(width)) / width))
126
+ for y in range(height)]
127
127
  if height / float(width) > 1.5:
128
128
  width *= 2
129
129
  elif width < 200:
@@ -237,7 +237,7 @@ register(
237
237
  "*",
238
238
  [
239
239
  (PF_RADIO, "mode", "SSTV mode", "MartinM1",
240
- tuple((n, n) for n in sorted(MODULE_MAP.iterkeys()))),
240
+ tuple((n, n) for n in sorted(MODULE_MAP.keys()))),
241
241
  (PF_BOOL, "vox", "Include VOX tones", True),
242
242
  (PF_STRING, "fskid", "FSK ID", ""),
243
243
  (PF_RADIO, "ptt_port", "PTT port", None,
@@ -5,7 +5,7 @@ Demonstrates playing the generated samples directly using PyAudio
5
5
  Tested on PyAudio 0.2.7 http://people.csail.mit.edu/hubert/pyaudio/
6
6
  """
7
7
 
8
- from __future__ import division
8
+
9
9
  from pysstv.sstv import SSTV
10
10
  from time import sleep
11
11
  from itertools import islice
@@ -8,9 +8,9 @@ simply copying/linking images to the directory or suing an SSTV
8
8
  receiver such as slowrx or QSSTV.
9
9
  """
10
10
 
11
- from __future__ import print_function
11
+
12
12
  from pyinotify import WatchManager, Notifier, ProcessEvent, IN_CREATE
13
- from pyaudio_sstv import PyAudioSSTV
13
+ from .pyaudio_sstv import PyAudioSSTV
14
14
  from pysstv.color import MartinM1, MartinM2, ScottieS1, ScottieS2
15
15
  from pysstv.grayscale import Robot8BW, Robot24BW
16
16
  from PIL import Image
@@ -44,13 +44,13 @@ class EventHandler(ProcessEvent):
44
44
 
45
45
  def get_module_for_filename(filename):
46
46
  basename, _ = path.splitext(path.basename(filename))
47
- for mode, module in MODE_MAP.iteritems():
47
+ for mode, module in MODE_MAP.items():
48
48
  if mode in basename:
49
49
  return module
50
50
 
51
51
  def get_module_for_image(image):
52
52
  size = image.size
53
- for mode in MODE_MAP.itervalues():
53
+ for mode in MODE_MAP.values():
54
54
  if all(i >= m for i, m in zip(size, (mode.WIDTH, mode.HEIGHT))):
55
55
  return mode
56
56
 
@@ -4,7 +4,7 @@ from setuptools import setup
4
4
 
5
5
  setup(
6
6
  name='PySSTV',
7
- version='0.5.3',
7
+ version='0.5.5',
8
8
  description='Python classes for generating Slow-scan Television transmissions',
9
9
  author=u'András Veres-Szentkirályi',
10
10
  author_email='vsza@vsza.hu',
PySSTV-0.5.3/.gitignore DELETED
@@ -1 +0,0 @@
1
- stb_image.h
PySSTV-0.5.3/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- language: python
2
- python:
3
- - "3.6"
4
- - "3.7"
5
- - "3.8"
6
- - "3.9"
7
- sudo: false
8
- install: "pip install -r requirements.txt"
9
- script: nosetests
PySSTV-0.5.3/PKG-INFO DELETED
@@ -1,96 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: PySSTV
3
- Version: 0.5.3
4
- Summary: Python classes for generating Slow-scan Television transmissions
5
- Home-page: https://github.com/dnet/pySSTV
6
- Author: András Veres-Szentkirályi
7
- Author-email: vsza@vsza.hu
8
- License: MIT
9
- Description: SSTV generator in pure Python
10
- =============================
11
-
12
- [![Build Status](https://travis-ci.org/dnet/pySSTV.svg?branch=master)](https://travis-ci.org/dnet/pySSTV)
13
-
14
- PySSTV generates SSTV modulated WAV files from any image that PIL can open
15
- (PNG, JPEG, GIF, and many others). These WAV files then can be played by any
16
- audio player connected to a shortwave radio for example.
17
-
18
- My main motivation was to understand the internals of SSTV in practice, so
19
- performance is far from optimal. I tried keeping the code readable, and only
20
- performed such optimizations that wouldn't have complicated the codebase.
21
-
22
- Command line usage
23
- ------------------
24
-
25
- $ python -m pysstv -h
26
- usage: __main__.py [-h]
27
- [--mode {MartinM1,MartinM2,ScottieS1,ScottieS2,Robot36,PasokonP3,PasokonP5,PasokonP7,PD90,PD120,PD160,PD180,PD240,PD290,Robot8BW,Robot24BW}]
28
- [--rate RATE] [--bits BITS] [--vox] [--fskid FSKID]
29
- [--chan CHAN]
30
- image.png output.wav
31
-
32
- Converts an image to an SSTV modulated WAV file.
33
-
34
- positional arguments:
35
- image.png input image file name
36
- output.wav output WAV file name
37
-
38
- optional arguments:
39
- -h, --help show this help message and exit
40
- --mode {MartinM1,MartinM2,ScottieS1,ScottieS2,Robot36,PasokonP3,PasokonP5,PasokonP7,PD90,PD120D160,PD180,PD240,Robot8BW,Robot24BW}
41
- image mode (default: Martin M1)
42
- --rate RATE sampling rate (default: 48000)
43
- --bits BITS bits per sample (default: 16)
44
- --vox add VOX tones at the beginning
45
- --fskid FSKID add FSKID at the end
46
- --chan CHAN number of channels (default: mono)
47
-
48
- Python interface
49
- ----------------
50
-
51
- The `SSTV` class in the `sstv` module implements basic SSTV-related
52
- functionality, and the classes of other modules such as `grayscale` and
53
- `color` extend this. Most instances implement the following methods:
54
-
55
- - `__init__` takes a PIL image, the samples per second, and the bits per
56
- sample as a parameter, but doesn't perform any hard calculations
57
- - `gen_freq_bits` generates tuples that describe a sine wave segment with
58
- frequency in Hz and duration in ms
59
- - `gen_values` generates samples between -1 and +1, performing sampling
60
- according to the samples per second value given during construction
61
- - `gen_samples` generates discrete samples, performing quantization
62
- according to the bits per sample value given during construction
63
- - `write_wav` writes the whole image to a Microsoft WAV file
64
-
65
- The above methods all build upon those above them, for example `write_wav`
66
- calls `gen_samples`, while latter calls `gen_values`, so typically, only
67
- the first and the last, maybe the last two should be called directly, the
68
- others are just listed here for the sake of completeness and to make the
69
- flow easier to understand.
70
-
71
- License
72
- -------
73
-
74
- The whole project is available under MIT license.
75
-
76
- Useful links
77
- ------------
78
-
79
- - receive-only "counterpart": https://github.com/windytan/slowrx
80
- - free SSTV handbook: http://www.sstv-handbook.com/
81
- - robot 36 encoder/decoder in C: https://github.com/xdsopl/robot36/
82
-
83
- Dependencies
84
- ------------
85
-
86
- - Python 3.5 or later
87
- - Python Imaging Library (Debian/Ubuntu package: `python-imaging`)
88
-
89
- Keywords: HAM SSTV slow-scan television Scottie Martin Robot Pasokon
90
- Platform: UNKNOWN
91
- Classifier: Development Status :: 4 - Beta
92
- Classifier: Topic :: Communications :: Ham Radio
93
- Classifier: Topic :: Multimedia :: Video :: Conversion
94
- Classifier: License :: OSI Approved :: MIT License
95
- Classifier: Operating System :: OS Independent
96
- Description-Content-Type: text/markdown
@@ -1,96 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: PySSTV
3
- Version: 0.5.3
4
- Summary: Python classes for generating Slow-scan Television transmissions
5
- Home-page: https://github.com/dnet/pySSTV
6
- Author: András Veres-Szentkirályi
7
- Author-email: vsza@vsza.hu
8
- License: MIT
9
- Description: SSTV generator in pure Python
10
- =============================
11
-
12
- [![Build Status](https://travis-ci.org/dnet/pySSTV.svg?branch=master)](https://travis-ci.org/dnet/pySSTV)
13
-
14
- PySSTV generates SSTV modulated WAV files from any image that PIL can open
15
- (PNG, JPEG, GIF, and many others). These WAV files then can be played by any
16
- audio player connected to a shortwave radio for example.
17
-
18
- My main motivation was to understand the internals of SSTV in practice, so
19
- performance is far from optimal. I tried keeping the code readable, and only
20
- performed such optimizations that wouldn't have complicated the codebase.
21
-
22
- Command line usage
23
- ------------------
24
-
25
- $ python -m pysstv -h
26
- usage: __main__.py [-h]
27
- [--mode {MartinM1,MartinM2,ScottieS1,ScottieS2,Robot36,PasokonP3,PasokonP5,PasokonP7,PD90,PD120,PD160,PD180,PD240,PD290,Robot8BW,Robot24BW}]
28
- [--rate RATE] [--bits BITS] [--vox] [--fskid FSKID]
29
- [--chan CHAN]
30
- image.png output.wav
31
-
32
- Converts an image to an SSTV modulated WAV file.
33
-
34
- positional arguments:
35
- image.png input image file name
36
- output.wav output WAV file name
37
-
38
- optional arguments:
39
- -h, --help show this help message and exit
40
- --mode {MartinM1,MartinM2,ScottieS1,ScottieS2,Robot36,PasokonP3,PasokonP5,PasokonP7,PD90,PD120D160,PD180,PD240,Robot8BW,Robot24BW}
41
- image mode (default: Martin M1)
42
- --rate RATE sampling rate (default: 48000)
43
- --bits BITS bits per sample (default: 16)
44
- --vox add VOX tones at the beginning
45
- --fskid FSKID add FSKID at the end
46
- --chan CHAN number of channels (default: mono)
47
-
48
- Python interface
49
- ----------------
50
-
51
- The `SSTV` class in the `sstv` module implements basic SSTV-related
52
- functionality, and the classes of other modules such as `grayscale` and
53
- `color` extend this. Most instances implement the following methods:
54
-
55
- - `__init__` takes a PIL image, the samples per second, and the bits per
56
- sample as a parameter, but doesn't perform any hard calculations
57
- - `gen_freq_bits` generates tuples that describe a sine wave segment with
58
- frequency in Hz and duration in ms
59
- - `gen_values` generates samples between -1 and +1, performing sampling
60
- according to the samples per second value given during construction
61
- - `gen_samples` generates discrete samples, performing quantization
62
- according to the bits per sample value given during construction
63
- - `write_wav` writes the whole image to a Microsoft WAV file
64
-
65
- The above methods all build upon those above them, for example `write_wav`
66
- calls `gen_samples`, while latter calls `gen_values`, so typically, only
67
- the first and the last, maybe the last two should be called directly, the
68
- others are just listed here for the sake of completeness and to make the
69
- flow easier to understand.
70
-
71
- License
72
- -------
73
-
74
- The whole project is available under MIT license.
75
-
76
- Useful links
77
- ------------
78
-
79
- - receive-only "counterpart": https://github.com/windytan/slowrx
80
- - free SSTV handbook: http://www.sstv-handbook.com/
81
- - robot 36 encoder/decoder in C: https://github.com/xdsopl/robot36/
82
-
83
- Dependencies
84
- ------------
85
-
86
- - Python 3.5 or later
87
- - Python Imaging Library (Debian/Ubuntu package: `python-imaging`)
88
-
89
- Keywords: HAM SSTV slow-scan television Scottie Martin Robot Pasokon
90
- Platform: UNKNOWN
91
- Classifier: Development Status :: 4 - Beta
92
- Classifier: Topic :: Communications :: Ham Radio
93
- Classifier: Topic :: Multimedia :: Video :: Conversion
94
- Classifier: License :: OSI Approved :: MIT License
95
- Classifier: Operating System :: OS Independent
96
- Description-Content-Type: text/markdown
@@ -1,25 +0,0 @@
1
- #include <stdio.h>
2
-
3
- #define STB_IMAGE_IMPLEMENTATION
4
- #include "stb_image.h"
5
- #include "codegen.c"
6
-
7
- int main(int argc, char **argv) {
8
- int x, y, n;
9
- unsigned char *img = stbi_load(argv[1], &x, &y, &n, 0);
10
- if (n != 3) {
11
- fprintf(stderr, "Only RGB images are supported\n");
12
- return 1;
13
- }
14
-
15
- float freqs[FREQ_COUNT], msecs[FREQ_COUNT];
16
-
17
- convert(img, freqs, msecs, x);
18
-
19
- for (int i = 0; i < FREQ_COUNT; i++) {
20
- fwrite(&(freqs[i]), 4, 1, stdout);
21
- fwrite(&(msecs[i]), 4, 1, stdout);
22
- }
23
-
24
- return 0;
25
- }