OSDN Git Service

Use bbs type widely.
[fukui-no-namari/fukui-no-namari.git] / src / FukuiNoNamari / idxfile.py
index 18a2361..b559a03 100644 (file)
 import os
 import os.path
 from fileinput import FileInput
-from misc import get_thread_idx_path
+import misc
 
 metadata_namelist = ["title", "lineCount", "lastModified", "etag"]
 
-def load_idx(bbs, board, thread):
+def load_idx(bbs_type):
     """Loads index file of thread
 
     bbs: bbs id
@@ -34,7 +34,7 @@ def load_idx(bbs, board, thread):
     return dictionary which key is in metadata_namelist if idx file exist,
     otherwise return empty dic
     """
-    idxfile_path = get_thread_idx_path(bbs, board, thread)
+    idxfile_path = misc.get_thread_idx_path(bbs_type)
     if not os.path.exists(idxfile_path):
         return {"title":None,"lineCount":0,"lastModified":None,"etag":None}
 
@@ -64,7 +64,7 @@ def load_idx(bbs, board, thread):
                 datadic[name] = ""
     return datadic
 
-def save_idx(bbs, board, thread, datadic):
+def save_idx(bbs_type, datadic):
     """Saves thread metadatas to a index file
 
     bbs: bbs id
@@ -79,7 +79,7 @@ def save_idx(bbs, board, thread, datadic):
     """
 
     # create a directory where idx file should belong if does not exist
-    idxfile_path = get_thread_idx_path(bbs, board, thread)
+    idxfile_path = misc.get_thread_idx_path(bbs_type)
     basedir = os.path.dirname(idxfile_path)
     if not os.path.isdir(basedir):
         os.makedirs(basedir)