aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tools/subtitles.py
diff options
context:
space:
mode:
authorsaksham1115 <saksham115@gmail.com>2016-06-29 11:18:34 +0000
committersaksham1115 <saksham115@gmail.com>2016-07-19 17:29:09 +0000
commit316bef690842b5015fce68d028f92cb7d6766e41 (patch)
treed37c23ccb4e47df40ff2a488621363b470eb7799 /mediagoblin/tools/subtitles.py
parent2c36555bfe4b21880d82b95c4c7a676967f10f96 (diff)
downloadmediagoblin-316bef690842b5015fce68d028f92cb7d6766e41.tar.lz
mediagoblin-316bef690842b5015fce68d028f92cb7d6766e41.tar.xz
mediagoblin-316bef690842b5015fce68d028f92cb7d6766e41.zip
Opening ths subtitle using absolute path and open function
Diffstat (limited to 'mediagoblin/tools/subtitles.py')
-rw-r--r--mediagoblin/tools/subtitles.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/mediagoblin/tools/subtitles.py b/mediagoblin/tools/subtitles.py
index 7002cdfc..bfb4a7ea 100644
--- a/mediagoblin/tools/subtitles.py
+++ b/mediagoblin/tools/subtitles.py
@@ -1,4 +1,4 @@
-import ast
+import ast,os
def get_path(path):
"""
@@ -7,4 +7,20 @@ def get_path(path):
to
x = ["A", "B", "C", "D"]
"""
- return ast.literal_eval(path) \ No newline at end of file
+ return ast.literal_eval(path)
+
+def open_subtitle(path):
+ temp = ['user_dev','media','public']
+ path = list(get_path(path))
+ file_path = os.path.abspath(__file__).split('/') # Path of current file as dictionary
+ """
+ Creating the absolute path for the subtitle file
+ """
+ subtitle_path = file_path[:-3] + temp + path
+ subtitle_path = "/" + os.path.join(*subtitle_path)
+ """
+ Opening the file using the absolute path
+ """
+ subtitle = open(subtitle_path,"r")
+ text = subtitle.read()
+ return text \ No newline at end of file