subtitle_public_filepath = get_path(path)
with mg_globals.public_store.get_file(
subtitle_public_filepath, 'rb') as subtitle_public_file:
- text = subtitle_public_file.read().decode('utf-8')
+ text = subtitle_public_file.read().decode('utf-8','ignore')
return text
def save_subtitle(path,text):
subtitle_public_filepath = get_path(path)
with mg_globals.public_store.get_file(
subtitle_public_filepath, 'wb') as subtitle_public_file:
- subtitle_public_file.write(text)
\ No newline at end of file
+ subtitle_public_file.write(text)
@require_active_login
def edit_subtitles(request, media):
allowed_extensions = ['aqt','gsub','jss','sub','ttxt','pjs','psb',
- 'rt','smi','stl','ssf','srt','ssa','ass','usf','vtt','lrc']
+ 'rt','smi','rst','stl','ssf','srt','ssa','ass','usf','vtt','lrc']
form = forms.EditSubtitlesForm(request.form)
# Add any subtitles
return redirect(request,
location=media.url_for_self(request.urlgen))
- elif filepath.split('.')[:-1] not in allowed_extensions :
+ elif filepath.split('.')[-1] not in allowed_extensions :
messages.add_message(
request,
messages.ERROR,
("Subtitle file deleted!!!"))
return redirect(request,
- location=media.url_for_self(request.urlgen))
\ No newline at end of file
+ location=media.url_for_self(request.urlgen))