Last active
November 29, 2017 03:33
-
-
Save tkota0726/fc2f96802299e03367f8a30b3ec770f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Qitaから使わせてもらいました。
https://qiita.com/teaka_experimen/items/483c713582cdef2a7590