1 # Copyright (C) 2006 by Aiwota Programmer
2 # aiwotaprog@tetteke.tk
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 def get_logs_dir_path():
24 return os.path.join(config.get_config_dir_path(), "logs")
26 def get_board_base_url(bbs, board):
28 None: this function uses brdlist.get function, so brdlist.read function
29 should have been called before this function is called
31 # if parameter is empty, raise ValueError
32 if not bbs or not board:
33 raise ValueError, "parameter must not be empty"
35 return "http://" + brdlist.get(bbs, board, "host") + "/" + board + "/"
37 def get_board_subjecttxt_url(bbs, board):
38 """Returns subject.txt file url
45 # if parameter is empty, raise ValueError
46 if not bbs or not board:
47 raise ValueError, "parameter must not be empty"
49 return get_board_base_url(bbs, board) + "subject.txt"
51 def get_board_subjecttxt_path(bbs, board):
52 """Returns subject.txt file path
59 # if parameter is empty, raise ValueError
60 if not bbs or not board:
61 raise ValueError, "parameter must not be empty"
63 return os.path.join(get_logs_dir_path(), bbs, board, "subject.txt")
65 def get_board_dir_path(bbs, board):
66 """Returns board dir path
73 # if parameter is empty, raise ValueError
74 if not bbs or not board:
75 raise ValueError, "parameter must not be empty"
77 return os.path.join(get_logs_dir_path(), bbs, board)
79 def get_thread_idx_path(bbs, board, thread):
80 """Returns idx file path of thread
88 Note: if parameter is empty, raise ValueError
91 # if parameter is empty, raise ValueError
92 if not bbs or not board or not thread:
93 raise ValueError, "parameter must not be empty"
95 return os.path.join(get_logs_dir_path(), bbs, board, thread + ".idx")
97 def get_board_cache_path(bbs, board):
98 """ Returns .cache file path of board
104 Note: if parameter is empty, raise ValueError
107 # if parameter is empty, raise ValueError
108 if not bbs or not board:
109 raise ValueError, "parameter must not be empty"
111 return os.path.join(get_logs_dir_path(), bbs, board, ".cache")