Skip to content

Commit

Permalink
자막 업로드 시간 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
dhku committed Oct 28, 2024
1 parent fdf4f76 commit 264bf68
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
29 changes: 24 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import sys
import os
import platform
import webbrowser
import threading
import natsort
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -3655,7 +3655,7 @@ font-size: 30px; font-weight: bold;</string>
<item>
<widget class="QLabel" name="version">
<property name="text">
<string>v1.2.0</string>
<string>v1.3.0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
Expand Down
2 changes: 1 addition & 1 deletion modules/ui_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 264bf68

Please sign in to comment.