diff --git a/mkv_this/functions.py b/mkv_this/functions.py index 0493f39..aeb1382 100644 --- a/mkv_this/functions.py +++ b/mkv_this/functions.py @@ -102,6 +102,7 @@ def writesentence(tmodel, args_sen, args_out, args_over, args_len): # functions for directory: def dir_list(directory): + "fetch list of text files from a directory" # create a list of files to concatenate: matches = [] if os.path.isdir(directory) is True: @@ -116,10 +117,11 @@ def dir_list(directory): return matches # returns a LIST of filenames -# feed this one the matches list: -def dir_cat(matchlist, batchfile): +# feed this the matches list: +def dir_cat(matchlist, bulkfile): + "takes a list of files, concatenates their contents into a single file" # concatenate into batchfile.txt: - with open(batchfile, "w") as outfile: + with open(bulkfile, "w") as outfile: for fname in matchlist: try: with open(fname, encoding="utf-8") as infile: diff --git a/mkv_this/mkv_this.py b/mkv_this/mkv_this.py index 6a00b53..0f1f535 100755 --- a/mkv_this/mkv_this.py +++ b/mkv_this/mkv_this.py @@ -147,7 +147,8 @@ def main(): elif args.directory: matchlist = dir_list(args.infile) # place batchfile.txt in user-given directory: - batchfile = os.path.dirname(args.infile) + os.path.sep + "batchfile.txt" + #batchfile = os.path.dirname(args.infile) + os.path.sep + "batchfile.txt" + batchfile = args.infile + os.path.sep + "batchfile.txt" dir_cat(matchlist, batchfile) text = read(batchfile) os.unlink(batchfile) @@ -167,9 +168,10 @@ def main(): elif args.directory: matchlist = dir_list(args.infile) # place batchfile.txt in user-given directory: - batchfile = os.path.dirname(args.infile) + os.path.sep + "batchfile.txt" + batchfile = args.infile + os.path.sep + "batchfile.txt" dir_cat(matchlist, batchfile) text = read(batchfile) + os.unlink(batchfile) # or normal: else: text = read(args.infile) @@ -209,9 +211,10 @@ def main(): elif args.directory: matchlist = dir_list(args.infile) # place batchfile.txt in user-given directory: - batchfile = os.path.dirname(args.infile) + os.path.sep + "batchfile.txt" + batchfile = args.infile + os.path.sep + "batchfile.txt" dir_cat(matchlist, batchfile) text = read(batchfile) + os.unlink(batchfile) # or local: else: text = read(args.infile) diff --git a/setup.py b/setup.py index 4dad061..b7b5d50 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ with open(path.join(this_directory, "README.md"), encoding="utf-8") as f: setup( name="mkv-this", - version="0.2.0", + version="0.2.1", description="cli wrapper for markovify: take a text file or URL, markovify, save the results.", long_description=long_description, long_description_content_type="text/markdown",