diff --git a/match.rb b/match.rb new file mode 100644 index 0000000..32b2bd0 --- /dev/null +++ b/match.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +ids = [] +titles = [] +res = [] +File.open('ids.txt').each do |line| + ids << line +end +File.open('titles.txt').each do |t| + titles << t +end + +ids.each do |id| + titles.each do |title| + res << "#{id}-#{title}" if ids.find_index(id) == titles.find_index(title) + end +end + +puts res diff --git a/rename.py b/rename.py new file mode 100644 index 0000000..efa6ea4 --- /dev/null +++ b/rename.py @@ -0,0 +1,23 @@ +from os import makedirs, rename, walk +from os.path import exists, join + +matched = open("matched.txt", "r") +videos = [] +vid_path = 'vids/' +done_path = 'done/' + +if not exists(done_path): + makedirs(done_path) +for (dirpath, dirnames, filenames) in walk(vid_path): + videos.extend(filenames) + +for line in matched: + idx = [int(s) for s in line.split("-") if s.isdigit()] + for video in videos: + if str(idx[0]) in video: + try: + rename(join(vid_path + video), join(done_path + line.strip('\n') + ".mp4")) + except ValueError: + print("err") + +print("done!") diff --git a/shell b/shell deleted file mode 100755 index b5ee83a..0000000 Binary files a/shell and /dev/null differ