Sorry: can’t find a media player for ‘%s’ on your system!
Add an entry for your system to the media player dictionary for this type of file in playfile.py, or play the file manually.
def trace(*args): print(*args) # с разделяющими пробелами
##############################################################################
# приемы проигрывания: универсальный и другие: дополните своими приемами ##############################################################################
class MediaTool:
def __init__(self, runtext=’’):
self.runtext = runtext
def run(self, mediafile, **options): # options обычно игнорируется
fullpath = os.path.abspath(mediafile) # cwd может быть любым
self.open(fullpath, **options)
class Filter(MediaTool):
def open(self, mediafile, **ignored): media = open(mediafile, ‘rb’)
player = os.popen(self.runtext, ‘w’) # запустить команду оболочки
player.write(media.read()) # отправить файл в stdin
class Cmdline(MediaTool):
def open(self, mediafile, **ignored):
cmdline = self.runtext % mediafile # запустить команду os.system(cmdline) # использовать %s для имени файла
class Winstart(MediaTool): # использует реестр Windows
def open(self, mediafile, wait=False, **other): # позволяет дождаться
if not wait: # окончания проигрывания файла
os.startfile(mediafile) # или os.system(‘start file’)
else:
os.system(‘start /WAIT ‘ + mediafile)
class Webbrowser(MediaTool):
# file:// требует указывать абсолютный путь def open(self, mediafile, **options):
webbrowser.open_new(‘file://%s’ % mediafile, **options)
##############################################################################
# медиа- и платформозависимые методы: измените или укажите один из имеющихся ##############################################################################
# соответствия платформ и проигрывателей: измените! audiotools = {