show auction end time/date
This commit is contained in:
parent
277fbd6311
commit
24a2bf55af
3 changed files with 16 additions and 10 deletions
16
buypeeb.py
16
buypeeb.py
|
@ -25,6 +25,7 @@ from gi.repository import Gtk
|
|||
import json, sys
|
||||
from os import path
|
||||
from threading import Thread
|
||||
from datetime import datetime
|
||||
|
||||
import functions
|
||||
from listing import YahooAuctionsItem, JST
|
||||
|
@ -153,7 +154,7 @@ class BuypeebApp:
|
|||
print(self.settings.watchlist)
|
||||
for id, item in self.settings.watchlist.items():
|
||||
if item.ready:
|
||||
self.items.append([item.name, item.price_aud(self.rate), "heenlo", id])
|
||||
self.items.append([item.name, item.price_aud(self.rate), "...", id])
|
||||
else:
|
||||
self.items.append([item.name, "...", "...", id])
|
||||
|
||||
|
@ -161,9 +162,16 @@ class BuypeebApp:
|
|||
|
||||
def updateListTimes(self):
|
||||
now = datetime.now()
|
||||
for item in self.items:
|
||||
id = item[3]
|
||||
|
||||
ndate = now.strftime("%d %b")
|
||||
for listing in self.items:
|
||||
id = listing[3]
|
||||
item = self.settings.watchlist[id]
|
||||
if item.end_date != None:
|
||||
idate, itime = item.end_date.strftime("%d %b"), item.end_date.strftime("%H:%M")
|
||||
if idate == ndate:
|
||||
listing[2] = itime
|
||||
else:
|
||||
listing[2] = f"{idate} {itime}"
|
||||
|
||||
# BUTTON CLICKS
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ class YahooAuctionsItem:
|
|||
self.price = 0
|
||||
self.original_name = None
|
||||
self.favourite = None
|
||||
self.end_date = None
|
||||
|
||||
if url == None and from_json != None and id != None:
|
||||
self.id = id
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import json, os, pickle
|
||||
from os import path
|
||||
from datetime import datetime, timezone, timedelta
|
||||
from datetime import datetime
|
||||
|
||||
import functions
|
||||
from listing import YahooAuctionsItem
|
||||
|
||||
JST = timezone(timedelta(hours = 9))
|
||||
from listing import YahooAuctionsItem, JST
|
||||
|
||||
class BuypeebSettings:
|
||||
def __init__(self, location: str):
|
||||
|
@ -61,8 +59,7 @@ class BuypeebSettings:
|
|||
time_difference = now - item.last_checked.timestamp()
|
||||
ending_soon = False # TODO: this
|
||||
|
||||
if \
|
||||
(item.favourite and time_difference >= self.favouriteUpdateInterval) or \
|
||||
if (item.favourite and time_difference >= self.favouriteUpdateInterval) or \
|
||||
(item.favourite and ending_soon and time_difference >= self.favouriteUpdateIntervalCritical) or \
|
||||
(time_difference >= self.updateInterval) or \
|
||||
(ending_soon and time_difference >= self.updateIntervalCritical):
|
||||
|
|
Loading…
Reference in a new issue