def __init__(self, chum, config, theme, parent): QtWidgets.QDialog.__init__(self, parent) self.setModal(False) self.config = config self.theme = theme self.parent = parent self.mainwindow = parent global _datadir self.handle = parent.profile().handle self.chum = chum self.convos = {} self.logpath = _datadir+"logs" self.setStyleSheet(self.theme["main/defaultwindow/style"]) self.setWindowTitle("Pesterlogs with " + self.chum) self.format = "bbcode" if os.path.exists("%s/%s/%s/%s" % (self.logpath, self.handle, chum, self.format)): self.logList = os.listdir("%s/%s/%s/%s/" % (self.logpath, self.handle, self.chum, self.format)) else: self.logList = [] if not os.path.exists("%s/%s/%s/%s" % (self.logpath, self.handle, chum, self.format)) or len(self.logList) == 0: instructions = QtWidgets.QLabel("No Pesterlogs were found") self.ok = QtWidgets.QPushButton("CLOSE", self, clicked=self.reject) self.ok.setDefault(True) layout_ok = QtWidgets.QHBoxLayout() layout_ok.addWidget(self.ok) layout_0 = QtWidgets.QVBoxLayout() layout_0.addWidget(instructions) layout_0.addLayout(layout_ok) self.setLayout(layout_0) else: self.instructions = QtWidgets.QLabel("Pesterlog with " +self.chum+ " on") self.textArea = PesterLogText(theme, self.parent) self.textArea.setReadOnly(True) self.textArea.setFixedWidth(600) if "convo/scrollbar" in theme: self.textArea.setStyleSheet("QTextEdit { width:500px; %s } QScrollBar:vertical { %s } QScrollBar::handle:vertical { %s } QScrollBar::add-line:vertical { %s } QScrollBar::sub-line:vertical { %s } QScrollBar:up-arrow:vertical { %s } QScrollBar:down-arrow:vertical { %s }" % (theme["convo/textarea/style"], theme["convo/scrollbar/style"], theme["convo/scrollbar/handle"], theme["convo/scrollbar/downarrow"], theme["convo/scrollbar/uparrow"], theme["convo/scrollbar/uarrowstyle"], theme["convo/scrollbar/darrowstyle"] )) else: self.textArea.setStyleSheet("QTextEdit { width:500px; %s }" % (theme["convo/textarea/style"])) self.logList.sort() self.logList.reverse() self.tree = RightClickTree() self.tree.optionsMenu = QtWidgets.QMenu(self) self.tree.setFixedSize(260, 300) self.tree.header().hide() if "convo/scrollbar" in theme: self.tree.setStyleSheet("QTreeWidget { %s } QScrollBar:vertical { %s } QScrollBar::handle:vertical { %s } QScrollBar::add-line:vertical { %s } QScrollBar::sub-line:vertical { %s } QScrollBar:up-arrow:vertical { %s } QScrollBar:down-arrow:vertical { %s }" % (theme["convo/textarea/style"], theme["convo/scrollbar/style"], theme["convo/scrollbar/handle"], theme["convo/scrollbar/downarrow"], theme["convo/scrollbar/uparrow"], theme["convo/scrollbar/uarrowstyle"], theme["convo/scrollbar/darrowstyle"] )) else: self.tree.setStyleSheet("%s" % (theme["convo/textarea/style"])) self.tree.itemSelectionChanged.connect(self.loadSelectedLog) self.tree.setSortingEnabled(False) child_1 = None last = ["",""] for (i,l) in enumerate(self.logList): my = self.fileToMonthYear(l) if my[0] != last[0]: child_1 = QtWidgets.QTreeWidgetItem(["%s %s" % (my[0], my[1])]) self.tree.addTopLevelItem(child_1) if i == 0: child_1.setExpanded(True) child_1.addChild(QtWidgets.QTreeWidgetItem([self.fileToTime(l)])) last = self.fileToMonthYear(l) self.hilight = PesterLogHighlighter(self.textArea) if len(self.logList) > 0: self.loadLog(self.logList[0]) self.search = PesterLogSearchInput(theme, self) self.search.setFocus() self.find = QtWidgets.QPushButton("Find", self) font = self.find.font() font.setPointSize(8) self.find.setFont(font) self.find.setDefault(True) self.find.setFixedSize(40, 20) layout_search = QtWidgets.QHBoxLayout() layout_search.addWidget(self.search) layout_search.addWidget(self.find) self.qdb = QtWidgets.QPushButton("Pesterchum QDB", self, clicked=self.openQDB) self.qdb.setFixedWidth(260) self.ok = QtWidgets.QPushButton("CLOSE", self, clicked=self.reject) self.ok.setFixedWidth(80) layout_ok = QtWidgets.QHBoxLayout() layout_ok.addWidget(self.qdb) layout_ok.addWidget(self.ok) layout_ok.setAlignment(self.ok, QtCore.Qt.AlignRight) layout_logs = QtWidgets.QHBoxLayout() layout_logs.addWidget(self.tree) layout_right = QtWidgets.QVBoxLayout() layout_right.addWidget(self.textArea) layout_right.addLayout(layout_search) layout_logs.addLayout(layout_right) layout_0 = QtWidgets.QVBoxLayout() layout_0.addWidget(self.instructions) layout_0.addLayout(layout_logs) layout_0.addLayout(layout_ok) self.setLayout(layout_0)
def __init__(self, chum, config, theme, parent): QtGui.QDialog.__init__(self, parent) self.setModal(False) self.config = config self.theme = theme self.parent = parent self.mainwindow = parent global _datadir self.handle = parent.profile().handle self.chum = chum self.convos = {} self.logpath = _datadir + "logs" self.setStyleSheet(self.theme["main/defaultwindow/style"]) self.setWindowTitle("Pesterlogs with " + self.chum) self.format = "bbcode" if os.path.exists("%s/%s/%s/%s" % (self.logpath, self.handle, chum, self.format)): self.logList = os.listdir( "%s/%s/%s/%s/" % (self.logpath, self.handle, self.chum, self.format)) else: self.logList = [] if not os.path.exists( "%s/%s/%s/%s" % (self.logpath, self.handle, chum, self.format)) or len( self.logList) == 0: instructions = QtGui.QLabel("No Pesterlogs were found") self.ok = QtGui.QPushButton("CLOSE", self) self.ok.setDefault(True) self.connect(self.ok, QtCore.SIGNAL('clicked()'), self, QtCore.SLOT('reject()')) layout_ok = QtGui.QHBoxLayout() layout_ok.addWidget(self.ok) layout_0 = QtGui.QVBoxLayout() layout_0.addWidget(instructions) layout_0.addLayout(layout_ok) self.setLayout(layout_0) else: self.instructions = QtGui.QLabel("Pesterlog with " + self.chum + " on") self.textArea = PesterLogText(theme, self.parent) self.textArea.setReadOnly(True) self.textArea.setFixedWidth(600) if theme.has_key("convo/scrollbar"): self.textArea.setStyleSheet( "QTextEdit { width:500px; %s } QScrollBar:vertical { %s } QScrollBar::handle:vertical { %s } QScrollBar::add-line:vertical { %s } QScrollBar::sub-line:vertical { %s } QScrollBar:up-arrow:vertical { %s } QScrollBar:down-arrow:vertical { %s }" % (theme["convo/textarea/style"], theme["convo/scrollbar/style"], theme["convo/scrollbar/handle"], theme["convo/scrollbar/downarrow"], theme["convo/scrollbar/uparrow"], theme["convo/scrollbar/uarrowstyle"], theme["convo/scrollbar/darrowstyle"])) else: self.textArea.setStyleSheet("QTextEdit { width:500px; %s }" % (theme["convo/textarea/style"])) self.logList.sort() self.logList.reverse() self.tree = RightClickTree() self.tree.optionsMenu = QtGui.QMenu(self) self.tree.setFixedSize(260, 300) self.tree.header().hide() if theme.has_key("convo/scrollbar"): self.tree.setStyleSheet( "QTreeWidget { %s } QScrollBar:vertical { %s } QScrollBar::handle:vertical { %s } QScrollBar::add-line:vertical { %s } QScrollBar::sub-line:vertical { %s } QScrollBar:up-arrow:vertical { %s } QScrollBar:down-arrow:vertical { %s }" % (theme["convo/textarea/style"], theme["convo/scrollbar/style"], theme["convo/scrollbar/handle"], theme["convo/scrollbar/downarrow"], theme["convo/scrollbar/uparrow"], theme["convo/scrollbar/uarrowstyle"], theme["convo/scrollbar/darrowstyle"])) else: self.tree.setStyleSheet("%s" % (theme["convo/textarea/style"])) self.connect(self.tree, QtCore.SIGNAL('itemSelectionChanged()'), self, QtCore.SLOT('loadSelectedLog()')) self.tree.setSortingEnabled(False) child_1 = None last = ["", ""] for (i, l) in enumerate(self.logList): my = self.fileToMonthYear(l) if my[0] != last[0]: child_1 = QtGui.QTreeWidgetItem(["%s %s" % (my[0], my[1])]) self.tree.addTopLevelItem(child_1) if i == 0: child_1.setExpanded(True) child_1.addChild(QtGui.QTreeWidgetItem([self.fileToTime(l)])) last = self.fileToMonthYear(l) self.hilight = PesterLogHighlighter(self.textArea) if len(self.logList) > 0: self.loadLog(self.logList[0]) self.search = PesterLogSearchInput(theme, self) self.search.setFocus() self.find = QtGui.QPushButton("Find", self) font = self.find.font() font.setPointSize(8) self.find.setFont(font) self.find.setDefault(True) self.find.setFixedSize(40, 20) layout_search = QtGui.QHBoxLayout() layout_search.addWidget(self.search) layout_search.addWidget(self.find) self.qdb = QtGui.QPushButton("Pesterchum QDB", self) self.qdb.setFixedWidth(260) self.connect(self.qdb, QtCore.SIGNAL('clicked()'), self, QtCore.SLOT('openQDB()')) self.ok = QtGui.QPushButton("CLOSE", self) self.ok.setFixedWidth(80) self.connect(self.ok, QtCore.SIGNAL('clicked()'), self, QtCore.SLOT('reject()')) layout_ok = QtGui.QHBoxLayout() # Website is offline so there's no point. #layout_ok.addWidget(self.qdb) layout_ok.addWidget(self.ok) layout_ok.setAlignment(self.ok, QtCore.Qt.AlignRight) layout_logs = QtGui.QHBoxLayout() layout_logs.addWidget(self.tree) layout_right = QtGui.QVBoxLayout() layout_right.addWidget(self.textArea) layout_right.addLayout(layout_search) layout_logs.addLayout(layout_right) layout_0 = QtGui.QVBoxLayout() layout_0.addWidget(self.instructions) layout_0.addLayout(layout_logs) layout_0.addLayout(layout_ok) self.setLayout(layout_0)
class PesterLogViewer(QtWidgets.QDialog): def __init__(self, chum, config, theme, parent): QtWidgets.QDialog.__init__(self, parent) self.setModal(False) self.config = config self.theme = theme self.parent = parent self.mainwindow = parent global _datadir self.handle = parent.profile().handle self.chum = chum self.convos = {} self.logpath = _datadir+"logs" self.setStyleSheet(self.theme["main/defaultwindow/style"]) self.setWindowTitle("Pesterlogs with " + self.chum) self.format = "bbcode" if os.path.exists("%s/%s/%s/%s" % (self.logpath, self.handle, chum, self.format)): self.logList = os.listdir("%s/%s/%s/%s/" % (self.logpath, self.handle, self.chum, self.format)) else: self.logList = [] if not os.path.exists("%s/%s/%s/%s" % (self.logpath, self.handle, chum, self.format)) or len(self.logList) == 0: instructions = QtWidgets.QLabel("No Pesterlogs were found") self.ok = QtWidgets.QPushButton("CLOSE", self, clicked=self.reject) self.ok.setDefault(True) layout_ok = QtWidgets.QHBoxLayout() layout_ok.addWidget(self.ok) layout_0 = QtWidgets.QVBoxLayout() layout_0.addWidget(instructions) layout_0.addLayout(layout_ok) self.setLayout(layout_0) else: self.instructions = QtWidgets.QLabel("Pesterlog with " +self.chum+ " on") self.textArea = PesterLogText(theme, self.parent) self.textArea.setReadOnly(True) self.textArea.setFixedWidth(600) if "convo/scrollbar" in theme: self.textArea.setStyleSheet("QTextEdit { width:500px; %s } QScrollBar:vertical { %s } QScrollBar::handle:vertical { %s } QScrollBar::add-line:vertical { %s } QScrollBar::sub-line:vertical { %s } QScrollBar:up-arrow:vertical { %s } QScrollBar:down-arrow:vertical { %s }" % (theme["convo/textarea/style"], theme["convo/scrollbar/style"], theme["convo/scrollbar/handle"], theme["convo/scrollbar/downarrow"], theme["convo/scrollbar/uparrow"], theme["convo/scrollbar/uarrowstyle"], theme["convo/scrollbar/darrowstyle"] )) else: self.textArea.setStyleSheet("QTextEdit { width:500px; %s }" % (theme["convo/textarea/style"])) self.logList.sort() self.logList.reverse() self.tree = RightClickTree() self.tree.optionsMenu = QtWidgets.QMenu(self) self.tree.setFixedSize(260, 300) self.tree.header().hide() if "convo/scrollbar" in theme: self.tree.setStyleSheet("QTreeWidget { %s } QScrollBar:vertical { %s } QScrollBar::handle:vertical { %s } QScrollBar::add-line:vertical { %s } QScrollBar::sub-line:vertical { %s } QScrollBar:up-arrow:vertical { %s } QScrollBar:down-arrow:vertical { %s }" % (theme["convo/textarea/style"], theme["convo/scrollbar/style"], theme["convo/scrollbar/handle"], theme["convo/scrollbar/downarrow"], theme["convo/scrollbar/uparrow"], theme["convo/scrollbar/uarrowstyle"], theme["convo/scrollbar/darrowstyle"] )) else: self.tree.setStyleSheet("%s" % (theme["convo/textarea/style"])) self.tree.itemSelectionChanged.connect(self.loadSelectedLog) self.tree.setSortingEnabled(False) child_1 = None last = ["",""] for (i,l) in enumerate(self.logList): my = self.fileToMonthYear(l) if my[0] != last[0]: child_1 = QtWidgets.QTreeWidgetItem(["%s %s" % (my[0], my[1])]) self.tree.addTopLevelItem(child_1) if i == 0: child_1.setExpanded(True) child_1.addChild(QtWidgets.QTreeWidgetItem([self.fileToTime(l)])) last = self.fileToMonthYear(l) self.hilight = PesterLogHighlighter(self.textArea) if len(self.logList) > 0: self.loadLog(self.logList[0]) self.search = PesterLogSearchInput(theme, self) self.search.setFocus() self.find = QtWidgets.QPushButton("Find", self) font = self.find.font() font.setPointSize(8) self.find.setFont(font) self.find.setDefault(True) self.find.setFixedSize(40, 20) layout_search = QtWidgets.QHBoxLayout() layout_search.addWidget(self.search) layout_search.addWidget(self.find) self.qdb = QtWidgets.QPushButton("Pesterchum QDB", self, clicked=self.openQDB) self.qdb.setFixedWidth(260) self.ok = QtWidgets.QPushButton("CLOSE", self, clicked=self.reject) self.ok.setFixedWidth(80) layout_ok = QtWidgets.QHBoxLayout() layout_ok.addWidget(self.qdb) layout_ok.addWidget(self.ok) layout_ok.setAlignment(self.ok, QtCore.Qt.AlignRight) layout_logs = QtWidgets.QHBoxLayout() layout_logs.addWidget(self.tree) layout_right = QtWidgets.QVBoxLayout() layout_right.addWidget(self.textArea) layout_right.addLayout(layout_search) layout_logs.addLayout(layout_right) layout_0 = QtWidgets.QVBoxLayout() layout_0.addWidget(self.instructions) layout_0.addLayout(layout_logs) layout_0.addLayout(layout_ok) self.setLayout(layout_0) @QtCore.pyqtSlot() def loadSelectedLog(self): if len(self.tree.currentItem().text(0)) > len("September 2011"): self.loadLog(self.timeToFile(self.tree.currentItem().text(0))) @QtCore.pyqtSlot() def openQDB(self): QtGui.QDesktopServices.openUrl(QtCore.QUrl("http://qdb.pesterchum.net/index.php?p=browse", QtCore.QUrl.TolerantMode)) def loadLog(self, fname): fp = codecs.open("%s/%s/%s/%s/%s" % (self.logpath, self.handle, self.chum, self.format, fname), encoding='utf-8', mode='r') self.textArea.clear() for line in fp: cline = line.replace("\r\n", "").replace("[/color]","</c>").replace("[url]","").replace("[/url]","") cline = re.sub("\[color=(#.{6})]", r"<c=\1>", cline) self.textArea.append(convertTags(cline)) textCur = self.textArea.textCursor() textCur.movePosition(1) self.textArea.setTextCursor(textCur) self.instructions.setText("Pesterlog with " +self.chum+ " on " + self.fileToTime(str(fname))) def logSearch(self, search): self.hilight.searchTerm = search self.hilight.rehighlight() def fileToMonthYear(self, fname): time = strptime(fname[(fname.index(".")+1):fname.index(".txt")], "%Y-%m-%d.%H.%M") return [strftime("%B", time), strftime("%Y", time)] def fileToTime(self, fname): timestr = fname[(fname.index(".")+1):fname.index(".txt")] return strftime("%a %d %b %Y %H %M", strptime(timestr, "%Y-%m-%d.%H.%M")) def timeToFile(self, time): return self.chum + strftime(".%Y-%m-%d.%H.%M.txt", strptime(str(time), "%a %d %b %Y %H %M"))
class PesterLogViewer(QtGui.QDialog): def __init__(self, chum, config, theme, parent): QtGui.QDialog.__init__(self, parent) self.setModal(False) self.config = config self.theme = theme self.parent = parent self.mainwindow = parent global _datadir self.handle = parent.profile().handle self.chum = chum self.convos = {} self.logpath = _datadir + "logs" self.setStyleSheet(self.theme["main/defaultwindow/style"]) self.setWindowTitle("Pesterlogs with " + self.chum) self.format = "bbcode" if os.path.exists("%s/%s/%s/%s" % (self.logpath, self.handle, chum, self.format)): self.logList = os.listdir( "%s/%s/%s/%s/" % (self.logpath, self.handle, self.chum, self.format)) else: self.logList = [] if not os.path.exists( "%s/%s/%s/%s" % (self.logpath, self.handle, chum, self.format)) or len( self.logList) == 0: instructions = QtGui.QLabel("No Pesterlogs were found") self.ok = QtGui.QPushButton("CLOSE", self) self.ok.setDefault(True) self.connect(self.ok, QtCore.SIGNAL('clicked()'), self, QtCore.SLOT('reject()')) layout_ok = QtGui.QHBoxLayout() layout_ok.addWidget(self.ok) layout_0 = QtGui.QVBoxLayout() layout_0.addWidget(instructions) layout_0.addLayout(layout_ok) self.setLayout(layout_0) else: self.instructions = QtGui.QLabel("Pesterlog with " + self.chum + " on") self.textArea = PesterLogText(theme, self.parent) self.textArea.setReadOnly(True) self.textArea.setFixedWidth(600) if theme.has_key("convo/scrollbar"): self.textArea.setStyleSheet( "QTextEdit { width:500px; %s } QScrollBar:vertical { %s } QScrollBar::handle:vertical { %s } QScrollBar::add-line:vertical { %s } QScrollBar::sub-line:vertical { %s } QScrollBar:up-arrow:vertical { %s } QScrollBar:down-arrow:vertical { %s }" % (theme["convo/textarea/style"], theme["convo/scrollbar/style"], theme["convo/scrollbar/handle"], theme["convo/scrollbar/downarrow"], theme["convo/scrollbar/uparrow"], theme["convo/scrollbar/uarrowstyle"], theme["convo/scrollbar/darrowstyle"])) else: self.textArea.setStyleSheet("QTextEdit { width:500px; %s }" % (theme["convo/textarea/style"])) self.logList.sort() self.logList.reverse() self.tree = RightClickTree() self.tree.optionsMenu = QtGui.QMenu(self) self.tree.setFixedSize(260, 300) self.tree.header().hide() if theme.has_key("convo/scrollbar"): self.tree.setStyleSheet( "QTreeWidget { %s } QScrollBar:vertical { %s } QScrollBar::handle:vertical { %s } QScrollBar::add-line:vertical { %s } QScrollBar::sub-line:vertical { %s } QScrollBar:up-arrow:vertical { %s } QScrollBar:down-arrow:vertical { %s }" % (theme["convo/textarea/style"], theme["convo/scrollbar/style"], theme["convo/scrollbar/handle"], theme["convo/scrollbar/downarrow"], theme["convo/scrollbar/uparrow"], theme["convo/scrollbar/uarrowstyle"], theme["convo/scrollbar/darrowstyle"])) else: self.tree.setStyleSheet("%s" % (theme["convo/textarea/style"])) self.connect(self.tree, QtCore.SIGNAL('itemSelectionChanged()'), self, QtCore.SLOT('loadSelectedLog()')) self.tree.setSortingEnabled(False) child_1 = None last = ["", ""] for (i, l) in enumerate(self.logList): my = self.fileToMonthYear(l) if my[0] != last[0]: child_1 = QtGui.QTreeWidgetItem(["%s %s" % (my[0], my[1])]) self.tree.addTopLevelItem(child_1) if i == 0: child_1.setExpanded(True) child_1.addChild(QtGui.QTreeWidgetItem([self.fileToTime(l)])) last = self.fileToMonthYear(l) self.hilight = PesterLogHighlighter(self.textArea) if len(self.logList) > 0: self.loadLog(self.logList[0]) self.search = PesterLogSearchInput(theme, self) self.search.setFocus() self.find = QtGui.QPushButton("Find", self) font = self.find.font() font.setPointSize(8) self.find.setFont(font) self.find.setDefault(True) self.find.setFixedSize(40, 20) layout_search = QtGui.QHBoxLayout() layout_search.addWidget(self.search) layout_search.addWidget(self.find) self.qdb = QtGui.QPushButton("Pesterchum QDB", self) self.qdb.setFixedWidth(260) self.connect(self.qdb, QtCore.SIGNAL('clicked()'), self, QtCore.SLOT('openQDB()')) self.ok = QtGui.QPushButton("CLOSE", self) self.ok.setFixedWidth(80) self.connect(self.ok, QtCore.SIGNAL('clicked()'), self, QtCore.SLOT('reject()')) layout_ok = QtGui.QHBoxLayout() # Website is offline so there's no point. #layout_ok.addWidget(self.qdb) layout_ok.addWidget(self.ok) layout_ok.setAlignment(self.ok, QtCore.Qt.AlignRight) layout_logs = QtGui.QHBoxLayout() layout_logs.addWidget(self.tree) layout_right = QtGui.QVBoxLayout() layout_right.addWidget(self.textArea) layout_right.addLayout(layout_search) layout_logs.addLayout(layout_right) layout_0 = QtGui.QVBoxLayout() layout_0.addWidget(self.instructions) layout_0.addLayout(layout_logs) layout_0.addLayout(layout_ok) self.setLayout(layout_0) @QtCore.pyqtSlot() def loadSelectedLog(self): if len(self.tree.currentItem().text(0)) > len("September 2011"): self.loadLog(self.timeToFile(self.tree.currentItem().text(0))) @QtCore.pyqtSlot() def openQDB(self): QtGui.QDesktopServices.openUrl( QtCore.QUrl("http://qdb.pesterchum.net/index.php?p=browse", QtCore.QUrl.TolerantMode)) def loadLog(self, fname): fp = codecs.open( "%s/%s/%s/%s/%s" % (self.logpath, self.handle, self.chum, self.format, fname), encoding='utf-8', mode='r') self.textArea.clear() for line in fp: cline = line.replace("\r\n", "").replace("[/color]", "</c>").replace( "[url]", "").replace("[/url]", "") cline = re.sub("\[color=(#.{6})]", r"<c=\1>", cline) self.textArea.append(convertTags(cline)) textCur = self.textArea.textCursor() textCur.movePosition(1) self.textArea.setTextCursor(textCur) self.instructions.setText("Pesterlog with " + self.chum + " on " + self.fileToTime(unicode(fname))) def logSearch(self, search): self.hilight.searchTerm = search self.hilight.rehighlight() def fileToMonthYear(self, fname): time = strptime(fname[(fname.index(".") + 1):fname.index(".txt")], "%Y-%m-%d.%H.%M") return [strftime("%B", time), strftime("%Y", time)] def fileToTime(self, fname): timestr = fname[(fname.index(".") + 1):fname.index(".txt")] return strftime("%a %d %b %Y %H %M", strptime(timestr, "%Y-%m-%d.%H.%M")) def timeToFile(self, time): return self.chum + strftime(".%Y-%m-%d.%H.%M.txt", strptime(str(time), "%a %d %b %Y %H %M"))