how create Media player in Python.
import os,random,re,mp3play
#pip install mp3play
#copy path of your song folder
path=os.chdir('/storage/emulated/0/Python')
#make a list files
playlist=os.listdir()
#now shuffle the list
playlist=random.shuffle(playlist)
#prevention to open another file
ext='.mp3$'
#start playing song from list
for song in playlist:
#varify mp3 files
if re.search(ext,song):
print(f'your currently song playing is{song}')
try:
#load your file
clip=mp3.load(song)
#play your file
clip.play()
except:
#load file
os.startfile(song)
finally:
print('error in playing music')
else:
pass
print('song finshed')
Contact:
#pip install mp3play
#copy path of your song folder
path=os.chdir('/storage/emulated/0/Python')
#make a list files
playlist=os.listdir()
#now shuffle the list
playlist=random.shuffle(playlist)
#prevention to open another file
ext='.mp3$'
#start playing song from list
for song in playlist:
#varify mp3 files
if re.search(ext,song):
print(f'your currently song playing is{song}')
try:
#load your file
clip=mp3.load(song)
#play your file
clip.play()
except:
#load file
os.startfile(song)
finally:
print('error in playing music')
else:
pass
print('song finshed')
Blog Presented by
~Pawan Kushwah
( Computer science
Department )
"The Innovation Hub"
(Team Member)
#TIH2019
Contact:
Email id .... theinnovationhub2019@gmail.com
Comments
Post a Comment