Modified get_path function in tools/subtitles.py
This commit is contained in:
parent
9f8e9ff18a
commit
4292c6aaaa
@ -1,23 +1,20 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
def get_path(path):
|
def get_path(path):
|
||||||
return eval(path)
|
|
||||||
|
|
||||||
def open_subtitle(path):
|
|
||||||
temp = ['user_dev','media','public']
|
temp = ['user_dev','media','public']
|
||||||
path = list(get_path(path))
|
path = list(eval(path))
|
||||||
file_path = os.path.abspath(__file__).split('/') # Path of current file as dictionary
|
file_path = os.path.abspath(__file__).split('/') # Path of current file as dictionary
|
||||||
subtitle_path = file_path[:-3] + temp + path # Creating the absolute path for the subtitle file
|
subtitle_path = file_path[:-3] + temp + path # Creating the absolute path for the subtitle file
|
||||||
subtitle_path = "/" + os.path.join(*subtitle_path)
|
subtitle_path = "/" + os.path.join(*subtitle_path)
|
||||||
|
return subtitle_path
|
||||||
|
|
||||||
|
def open_subtitle(path):
|
||||||
|
subtitle_path = get_path(path)
|
||||||
subtitle = open(subtitle_path,"r") # Opening the file using the absolute path
|
subtitle = open(subtitle_path,"r") # Opening the file using the absolute path
|
||||||
text = subtitle.read()
|
text = subtitle.read()
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def save_subtitle(path,text):
|
def save_subtitle(path,text):
|
||||||
temp = ['user_dev','media','public']
|
subtitle_path = get_path(path)
|
||||||
path = list(get_path(path))
|
|
||||||
file_path = os.path.abspath(__file__).split('/') # Path of current file as dictionary
|
|
||||||
subtitle_path = file_path[:-3] + temp + path # Creating the absolute path for the subtitle file
|
|
||||||
subtitle_path = "/" + os.path.join(*subtitle_path)
|
|
||||||
subtitle = open(subtitle_path,"w") # Opening the file using the absolute path
|
subtitle = open(subtitle_path,"w") # Opening the file using the absolute path
|
||||||
subtitle.write(text)
|
subtitle.write(text)
|
Loading…
x
Reference in New Issue
Block a user