Reputation: 483
I am new with Python and I thought that it would be funny to play with music by creating a playlist. The code I wrote plays the mp3 files saved in my Music folder. Now I want to pause/resume while the script is running. Any tips and recommendations are well received.
import vlc
from mutagen.mp3
import MP3
from glob import glob
import time
##Directory for Music Files########
audio_dir = '/path/to/Music'
files = glob (audio_dir + '/*.mp3')
####################################
for filename in files:
current_song = vlc.MediaPlayer(filename)
audio_specs = MP3(filename)
current_song.play()
time.sleep(audio_specs.info.length)
current_song.stop()
Upvotes: 0
Views: 260