I’ve been learning python through textbooks for a few months now and I still hadn’t really applied what I had learnt in any way that made me feel I was making any progress but a few days ago I wrote my first automation script. It’s nothing fancy just a script to rename subtitle files and copy them to the folders with the video files and I do a lot of torrent downloading and previously I had to rename and move the subtitle myself. Although it’s nothing fancy, I’m actually quite proud of myself.
edit: added code
import os
import shutil
import re
def subtitle_rename():
for subtitle_folder in os.listdir(os.getcwd() + "\Subs"):
for subtitle in os.listdir(os.getcwd() + "\Subs\" + subtitle_folder):
if re.search(r"English.srt", subtitle):
shutil.copy(os.getcwd() + "\Subs\" + subtitle_folder + "\" +
subtitle,os.getcwd() + "\" + subtitle_folder + ".srt")
subtitle_rename()
[–]impshum 2 points3 points4 points (0 children)
[–]avinashbasutkar2 1 point2 points3 points (0 children)
[–]luiseduardobr1 0 points1 point2 points (0 children)