Skip to content

Instantly share code, notes, and snippets.

@tkota0726
Last active November 29, 2017 03:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkota0726/fc2f96802299e03367f8a30b3ec770f9 to your computer and use it in GitHub Desktop.
Save tkota0726/fc2f96802299e03367f8a30b3ec770f9 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import fnmatch
from subprocess import call
matches = []
for root, dirnames, filenames in os.walk('./'):
for filename in fnmatch.filter(filenames,'*.wma'):
matches.append(os.path.join(os.path.abspath(root), filename))
for match in matches:
message = "convert {0} to {1}".format(match, match.replace('.wma', '.mp3'))
before = match.decode('utf-8')
after = before.replace('.wma', '.mp3')
print message
if os.path.exists(after):
print 'This file is already converted.'
else:
call(u'ffmpeg -i "{0}" "{1}"'.format(before, after), shell=True)
@tkota0726
Copy link
Author

Qitaから使わせてもらいました。
https://qiita.com/teaka_experimen/items/483c713582cdef2a7590

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment