diff --git a/main.py b/main.py index f9843b6..93d1c50 100644 --- a/main.py +++ b/main.py @@ -11,7 +11,6 @@ import sys import os -import platform import webbrowser import threading import natsort @@ -256,13 +255,33 @@ def on_cell_clicked(row,column): name = k.name episode = k.episode website = k.website - updDt = k.updDt - updDt = updDt[:updDt.rfind("T")] + updDtStr = k.updDt + + updDt = datetime.strptime(updDtStr, "%Y-%m-%dT%H:%M:%S") + currentDt = datetime.now(); + + time_diff = currentDt - updDt + time_diff_str = "" + #print("time_diff = " + time_diff) + + time_diff_prefix = " - " + total_sec = time_diff.total_seconds(); + + if total_sec < 60: # 60초 이내 + time_diff_str = time_diff_prefix + str(total_sec) + "초 전" + elif total_sec < 3600: # 60분 이내 + time_diff_str = time_diff_prefix + str(round(total_sec/60)) + "분 전" + elif total_sec < 86400: # 24시간 이내 + time_diff_str = time_diff_prefix + str(round(total_sec/3600)) + "시간 전" + elif total_sec < 2592000: #30일 이내 + time_diff_str = time_diff_prefix + str(round(total_sec/86400)) + "일 전" + else: + time_diff_str = time_diff_prefix + updDtStr[:updDtStr.rfind("T")] if(website == ""): - button = QPushButton("준비중 "+name+ " "+updDt) + button = QPushButton("준비중 "+name+ " "+updDtStr[:updDtStr.rfind("T")]) else: - button = QPushButton(episode+"화 "+name) + button = QPushButton(episode+"화 "+name + time_diff_str) button.clicked.connect(partial(open_url,website)) button.setMinimumSize(0, 60) diff --git a/main.ui b/main.ui index 1cd429a..63d5082 100644 --- a/main.ui +++ b/main.ui @@ -3655,7 +3655,7 @@ font-size: 30px; font-weight: bold; - v1.2.0 + v1.3.0 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter diff --git a/modules/ui_main.py b/modules/ui_main.py index 8f4b232..77471d9 100644 --- a/modules/ui_main.py +++ b/modules/ui_main.py @@ -1952,6 +1952,6 @@ def retranslateUi(self, MainWindow): self.btn_print.setText(QCoreApplication.translate("MainWindow", u"Print", None)) self.btn_logout.setText(QCoreApplication.translate("MainWindow", u"Logout", None)) self.creditsLabel.setText(QCoreApplication.translate("MainWindow", u"Made By KUDONG", None)) - self.version.setText(QCoreApplication.translate("MainWindow", u"v1.2.0", None)) + self.version.setText(QCoreApplication.translate("MainWindow", u"v1.3.0", None)) # retranslateUi