Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"name": "Subsimport",
"description": "Import subtitles into blender",
"author": "doakey3",
"version": (1, 3, 1),
"blender": (2, 80, 0),
"version": (1, 3, 2),
"blender": (3, 2, 0),
"wiki_url": "https://github.com/doakey3/subsimport",
"tracker_url": "https://github.com/doakey3/subsimport/issues",
"category": "Sequencer"
Expand Down Expand Up @@ -135,6 +135,8 @@ def init_prop():
# Better off using en-us until I have a better dictionary
#('en-gb', 'English-Great Britain', ''),
('en-us', 'English-U.S.', ''),
('zh-tw', '繁體中文', ''),
('zh-cn', '簡體中文', ''),
('eo', 'Esperanto', ''),
('et', 'Estonian', ''),
('fi', 'Finnish', ''),
Expand Down
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion operators/hyphenator/get_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def get_dictionary(dic_path=None, lang='en-us'):
dictionary = {}

try:
f = open(dic_path, 'r')
f = open(dic_path, 'r', encoding="utf-8")
lines = f.readlines()
f.close()

Expand Down
Empty file.
Empty file.
1 change: 1 addition & 0 deletions operators/pylrc/tools/find_even_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ def find_even_split(line):
"""
Given a string, splits it into two (almost) evenly spaced lines
"""
"""word_list = line.split(' ')"""
word_list = line.split(' ')
differences = []
for i in range(len(word_list)):
Expand Down
2 changes: 1 addition & 1 deletion operators/pysrt/srtfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def _get_first_line(cls, string_iterable):

@classmethod
def _detect_encoding(cls, path):
file_descriptor = open(path, 'rb')
file_descriptor = open(path, 'rb', 'utf-8')
first_chars = file_descriptor.read(BIGGER_BOM)
file_descriptor.close()

Expand Down
4 changes: 2 additions & 2 deletions operators/save_syllables.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def execute(self, context):
lang=scene.syllabification_language)

path = bpy.path.abspath(scene.syllable_dictionary_path)
f = open(path, 'r')
f = open(path, 'r',encoding='utf-8')
words = f.readlines()
f.close()

Expand All @@ -39,7 +39,7 @@ def execute(self, context):
module_path, 'hyphenator', 'dictionaries',
scene.syllabification_language + '.txt')

f = open(dic_path, 'w')
f = open(dic_path, 'w', encoding='utf-8')
f.write('\n'.join(values))
f.close()

Expand Down
11 changes: 9 additions & 2 deletions operators/split_words.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ def break_strip(scene, strip):
else:
dictionary = {}

words = strip.text.replace('\n', ' ').split(' ')
if scene.syllabification_language == 'zh-tw' or scene.syllabification_language == 'zh-cn':
words = list(strip.text.replace('\n', ' '))
else:
words = strip.text.replace('\n', ' ').split(' ')
i = 0
while i < len(words):
if words[i].rstrip() == '':
Expand Down Expand Up @@ -72,9 +75,13 @@ def form_items(scene, strip, pieces):
text = strip.text
lines = text.split('\n')
empty_text = ''
empty_chr = ' '
if scene.syllabification_language == 'zh-tw' or scene.syllabification_language == 'zh-cn':
empty_chr = ' '

for i in range(len(lines)):
for char in range(len(lines[i])):
empty_text += ' '
empty_text += empty_chr
empty_text += '\n'

new_pieces = []
Expand Down
13 changes: 9 additions & 4 deletions operators/syllabify.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ def collect_words(scene):
words = []

text_strips = get_text_strips(scene)
for strip in text_strips:
strip_words = strip.text.lower().replace('--', ' ').replace('\n', ' ').split(' ')
words.extend(strip_words)
if scene.syllabification_language == 'zh-tw' or scene.syllabification_language == 'zh-cn':
for strip in text_strips:
strip_words = list(strip.text.lower().replace('--', ' ').replace('\n', ' '))
words.extend(strip_words)
else:
for strip in text_strips:
strip_words = strip.text.lower().replace('--', ' ').replace('\n', ' ').split(' ')
words.extend(strip_words)

i = 0
while i < len(words):
Expand Down Expand Up @@ -105,7 +110,7 @@ def execute(self, context):
words[i] = ' '.join(words[i])
words = set(words)
words = sorted(list(words))
f = open(self.filepath, 'w')
f = open(self.filepath, 'w',encoding='utf-8')
f.write('\n'.join(words))
f.close()

Expand Down
4 changes: 2 additions & 2 deletions operators/tools/subtitles_to_sequencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def subtitles_to_sequencer(context, subs):
name=sub_name,
type='TEXT',
channel=open_channel,
frame_start=strip_start,
frame_end=strip_end
frame_start=int(strip_start),
frame_end=int(strip_end)
)

text_strip.font = get_font(scene.subtitle_font)
Expand Down
1 change: 1 addition & 0 deletions tools/automatic_text_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def write_word_level(text, txt_path):
text = text.split('\n')
for line in text:
split = line.split(' ')
"""split = list(line)"""
for word in split:
words.append(word)

Expand Down