<commit_before>#!/usr/bin/env python 

import os
import glob 
import subprocess
import argparse
import sys

parser = argparse.ArgumentParser()
parser.add_argument("dir", help = "Input directory")

args = parser.parse_args()

def convert2wav(inputfile):
	extension = os.path.splitext(inputfile)[1]
	if os.path.exists(inputfile.replace(extension,'.wav',1)) == False:
		subprocess.call(['ffmpeg', '-i', inputfile, inputfile.replace(extension,'.wav',1)])

# Make the output directories if they don't exist already 
if not os.path.exists("mp3"):
	os.mkdir("mp3")

if not os.path.exists("log"):
	os.mkdir("log")

if os.path.exists(args.dir):
	os.chdir(args.dir) 

    # get files with extension .mp4 into a list
	mp4_list = glob.glob("*.mp4") 

    # get files with extension .webm into a list
	webm_list = glob.glob("*.webm")
	
    # get files with extension .mkv into a list
	mkv_list = glob.glob("*.mkv")

	for inputfile in mp4_list:
		convert2wav(inputfile)				

	for inputfile in webm_list:
		convert2wav(inputfile)

	for inputfile in mkv_list:
		convert2wav(inputfile)

    # get all WAV files into a list 
	wav_files = glob.glob("*.wav")

	for l in wav_files: 
		if os.path.exists(l.replace('.wav','.mp3',1)) == False:<commit_msg>original files are now moved to the log directory after processing.<commit_after>#!/usr/bin/env python 

import os
import glob 
import subprocess
import argparse
import shutil

parser = argparse.ArgumentParser()
parser.add_argument("dir", help = "Input directory")

args = parser.parse_args()

def convert2wav(inputfile,logdir='log'):
	if not os.path.exists(logdir):
		os.mkdir(logdir)
	extension = os.path.splitext(inputfile)[1]
	if os.path.exists(inputfile.replace(extension,'.wav',1)) == False:
		subprocess.call(['ffmpeg', '-i', inputfile, inputfile.replace(extension,'.wav',1)])
		
	shutil.move(inputfile,logdir)

# Make the output directories if they don't exist already 
if not os.path.exists("mp3"):
	os.mkdir("mp3")

if os.path.exists(args.dir):
	os.chdir(args.dir) 

    # get files with extension .mp4 into a list
	mp4_list = glob.glob("*.mp4") 

    # get files with extension .webm into a list
	webm_list = glob.glob("*.webm")
	
    # get files with extension .mkv into a list
	mkv_list = glob.glob("*.mkv")

	for inputfile in mp4_list:
		convert2wav(inputfile)				

	for inputfile in webm_list:
		convert2wav(inputfile)

	for inputfile in mkv_list:
		convert2wav(inputfile)

    # get all WAV files into a list 
	wav_files = glob.glob("*.wav")

	for l in wav_files: 
		if os.path.exists(l.replace('.wav','.mp3',1)) == False:
{'fraction_non_alphanumeric': 0.1374075515764889, 'fraction_numerical': 0.011677695601401323, 'mean_word_length': 4.25562372188139, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1612328', 'n_tokens_mistral': 974, 'n_tokens_neox': 919, 'n_words': 234}