Skip to content

Commit a95eee1

Browse files
authored
Merge pull request #2721 from jedgarpark/walkmp3rson-fix
fix to mp3 streaming code
2 parents 3c7b707 + dba9191 commit a95eee1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Walkmp3rson/code.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-FileCopyrightText: 2022 John Park and Tod Kurt for Adafruit Industries
22
# SPDX-License-Identifier: MIT
3-
# Walkmp3rson digital cassette tape player (ok fine it's just SD cards)
3+
'''Walkmp3rson digital cassette tape player (ok fine it's just SD cards)'''
4+
45
import time
56
import os
67
import board
@@ -143,12 +144,15 @@ def tracktext(full_path_name, position):
143144
def change_track(tracknum):
144145
# pylint: disable=global-statement
145146
global mp3_filename
147+
# pylint: disable=global-statement
148+
global mp3stream
146149
mp3_filename = mp3s[tracknum]
147150
song_name_fc = tracktext(mp3_filename, 2)
148151
artist_name_fc = tracktext(mp3_filename, 1)
149152
mp3_file_fc = open(mp3_filename, "rb")
150-
mp3stream_fc = audiomp3.MP3Decoder(mp3_file_fc)
151-
mp3_bytes_fc = os.stat(mp3_filename)[6] # size in bytes is position 6
153+
mp3stream.file = mp3_file_fc
154+
mp3stream_fc = mp3stream
155+
mp3_bytes_fc = os.stat(mp3_filename)[6]
152156
return (mp3_file_fc, mp3stream_fc, song_name_fc, artist_name_fc, mp3_bytes_fc)
153157

154158
print("Walkmp3rson")

0 commit comments

Comments
 (0)