-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsublist.py
40 lines (28 loc) · 1015 Bytes
/
sublist.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#sublist generator - r3n@RSG
import os
cd = os.getcwd()
ep_list = []
def mediainfo():
print('Generating mediainfo...\n')
files_in_directory = os.listdir(cd)
for file in files_in_directory:
if file.endswith('.mkv'):
os.system(f'mediainfo --LogFile="{cd}\\{file}.txt" "{cd}\\{file}"')
ep_list.append(file)
def fetch_lang_list():
for ep in ep_list:
lang_list = []
source_file = open(f'{ep}.txt', "r", encoding='utf-8')
for line in source_file:
if 'Language' in line:
lang_list.append(line.strip().replace(
'Language : ', ''))
source_file.close()
cleaned = lang_list[2::]
cleaned.sort()
print(ep)
print(*cleaned, sep = ", ")
os.remove(f'{cd}\\{ep}.txt')
mediainfo()
print('Subtitle availability per episode - generated by github.com/rsgrt/sublist\n')
fetch_lang_list()