Removed ast and fixed comments
This commit is contained in:
parent
0e60155a6f
commit
1ba4556b90
@ -1,26 +1,14 @@
|
|||||||
import ast,os
|
import os
|
||||||
|
|
||||||
def get_path(path):
|
def get_path(path):
|
||||||
"""
|
return eval(path)
|
||||||
Converting the path of the form
|
|
||||||
x = u'[ "A","B","C" ," D"]'
|
|
||||||
to
|
|
||||||
x = ["A", "B", "C", "D"]
|
|
||||||
"""
|
|
||||||
return ast.literal_eval(path)
|
|
||||||
|
|
||||||
def open_subtitle(path):
|
def open_subtitle(path):
|
||||||
temp = ['user_dev','media','public']
|
temp = ['user_dev','media','public']
|
||||||
path = list(get_path(path))
|
path = list(get_path(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
|
||||||
Creating the absolute path for the subtitle file
|
|
||||||
"""
|
|
||||||
subtitle_path = file_path[:-3] + temp + path
|
|
||||||
subtitle_path = "/" + os.path.join(*subtitle_path)
|
subtitle_path = "/" + os.path.join(*subtitle_path)
|
||||||
"""
|
subtitle = open(subtitle_path,"r") # Opening the file using the absolute path
|
||||||
Opening the file using the absolute path
|
|
||||||
"""
|
|
||||||
subtitle = open(subtitle_path,"r")
|
|
||||||
text = subtitle.read()
|
text = subtitle.read()
|
||||||
return text
|
return text
|
Loading…
x
Reference in New Issue
Block a user