mirror of
https://github.com/F5OEO/rpitx.git
synced 2026-03-23 16:56:54 +01:00
Fix Python 3
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""Python interface to rpitx."""
|
||||
|
||||
# To avoid import pollution with ipython, hide functions in another module
|
||||
from _hidden import broadcast_fm
|
||||
from ._hidden import broadcast_fm
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"""Hides imports and other irrelevant things so that ipython works nicely."""
|
||||
|
||||
from pydub import AudioSegment
|
||||
import StringIO
|
||||
import _rpitx
|
||||
import io
|
||||
import array
|
||||
import logging
|
||||
import wave
|
||||
@@ -29,7 +29,7 @@ def broadcast_fm(file_, frequency):
|
||||
|
||||
raw_audio_data = _reencode(file_)
|
||||
|
||||
wav_data = StringIO.StringIO()
|
||||
wav_data = io.BytesIO()
|
||||
wav_writer = wave.open(wav_data, 'w')
|
||||
wav_writer.setnchannels(1)
|
||||
wav_writer.setsampwidth(2)
|
||||
@@ -37,6 +37,6 @@ def broadcast_fm(file_, frequency):
|
||||
wav_writer.writeframes(raw_audio_data.raw_data)
|
||||
wav_writer.close()
|
||||
|
||||
raw_array = array.array('c', wav_data.getvalue())
|
||||
raw_array = array.array('b', wav_data.getvalue())
|
||||
array_address, length = raw_array.buffer_info()
|
||||
_rpitx.broadcast_fm(array_address, length, frequency)
|
||||
|
||||
Reference in New Issue
Block a user