Last active
August 29, 2015 14:26
-
-
Save kanazux/7f6536f4fb25c292f5e6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# | |
# Kanazuchi <[email protected]> | |
# | |
import os | |
import re | |
for x in [ x for x in os.listdir('.') if '.mp4' in x ]: | |
for y in [ y for y in os.listdir('.') if '.srt' in y ]: | |
if x.lower().split('.')[1] == re.sub('s01e','1',y.lower().split('.')[1]): | |
os.rename(x, ".".join( | |
[x.lower().split('.')[0],x.lower().split('.')[1],x.lower().split('.')[-1]])) | |
new_y = re.sub('s01e', '1', y.lower().split('.')) | |
os.rename(y, ".".join([new_y[0], new_y[1], new_y[-1]])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment