aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin
diff options
context:
space:
mode:
authorsaksham1115 <saksham115@gmail.com>2016-07-13 13:36:14 +0000
committersaksham1115 <saksham115@gmail.com>2016-07-19 17:29:09 +0000
commit4292c6aaaa1fb49740ecd0a26946f2460d805e46 (patch)
tree706587937e19155df25472dcdc23c80f8b355363 /mediagoblin
parent9f8e9ff18a92757c599530936eafcf08ab7ee709 (diff)
downloadmediagoblin-4292c6aaaa1fb49740ecd0a26946f2460d805e46.tar.lz
mediagoblin-4292c6aaaa1fb49740ecd0a26946f2460d805e46.tar.xz
mediagoblin-4292c6aaaa1fb49740ecd0a26946f2460d805e46.zip
Modified get_path function in tools/subtitles.py
Diffstat (limited to 'mediagoblin')
-rw-r--r--mediagoblin/tools/subtitles.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/mediagoblin/tools/subtitles.py b/mediagoblin/tools/subtitles.py
index 7fcf5f11..efafbeec 100644
--- a/mediagoblin/tools/subtitles.py
+++ b/mediagoblin/tools/subtitles.py
@@ -1,23 +1,20 @@
import os
def get_path(path):
- return eval(path)
-
-def open_subtitle(path):
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
subtitle_path = file_path[:-3] + temp + path # Creating the absolute path for the subtitle file
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
text = subtitle.read()
return text
def save_subtitle(path,text):
- temp = ['user_dev','media','public']
- 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_path = get_path(path)
subtitle = open(subtitle_path,"w") # Opening the file using the absolute path
subtitle.write(text) \ No newline at end of file