show auction end time/date

This commit is contained in:
Lynne Megido 2020-08-23 21:29:53 +10:00
parent 277fbd6311
commit 24a2bf55af
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90
3 changed files with 16 additions and 10 deletions

View file

@ -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

View file

@ -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

View file

@ -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):