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
|
import json, sys
|
||||||
from os import path
|
from os import path
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
import functions
|
import functions
|
||||||
from listing import YahooAuctionsItem, JST
|
from listing import YahooAuctionsItem, JST
|
||||||
|
@ -153,7 +154,7 @@ class BuypeebApp:
|
||||||
print(self.settings.watchlist)
|
print(self.settings.watchlist)
|
||||||
for id, item in self.settings.watchlist.items():
|
for id, item in self.settings.watchlist.items():
|
||||||
if item.ready:
|
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:
|
else:
|
||||||
self.items.append([item.name, "...", "...", id])
|
self.items.append([item.name, "...", "...", id])
|
||||||
|
|
||||||
|
@ -161,9 +162,16 @@ class BuypeebApp:
|
||||||
|
|
||||||
def updateListTimes(self):
|
def updateListTimes(self):
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
for item in self.items:
|
ndate = now.strftime("%d %b")
|
||||||
id = item[3]
|
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
|
# BUTTON CLICKS
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ class YahooAuctionsItem:
|
||||||
self.price = 0
|
self.price = 0
|
||||||
self.original_name = None
|
self.original_name = None
|
||||||
self.favourite = None
|
self.favourite = None
|
||||||
|
self.end_date = None
|
||||||
|
|
||||||
if url == None and from_json != None and id != None:
|
if url == None and from_json != None and id != None:
|
||||||
self.id = id
|
self.id = id
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
import json, os, pickle
|
import json, os, pickle
|
||||||
from os import path
|
from os import path
|
||||||
from datetime import datetime, timezone, timedelta
|
from datetime import datetime
|
||||||
|
|
||||||
import functions
|
import functions
|
||||||
from listing import YahooAuctionsItem
|
from listing import YahooAuctionsItem, JST
|
||||||
|
|
||||||
JST = timezone(timedelta(hours = 9))
|
|
||||||
|
|
||||||
class BuypeebSettings:
|
class BuypeebSettings:
|
||||||
def __init__(self, location: str):
|
def __init__(self, location: str):
|
||||||
|
@ -61,8 +59,7 @@ class BuypeebSettings:
|
||||||
time_difference = now - item.last_checked.timestamp()
|
time_difference = now - item.last_checked.timestamp()
|
||||||
ending_soon = False # TODO: this
|
ending_soon = False # TODO: this
|
||||||
|
|
||||||
if \
|
if (item.favourite and time_difference >= self.favouriteUpdateInterval) or \
|
||||||
(item.favourite and time_difference >= self.favouriteUpdateInterval) or \
|
|
||||||
(item.favourite and ending_soon and time_difference >= self.favouriteUpdateIntervalCritical) or \
|
(item.favourite and ending_soon and time_difference >= self.favouriteUpdateIntervalCritical) or \
|
||||||
(time_difference >= self.updateInterval) or \
|
(time_difference >= self.updateInterval) or \
|
||||||
(ending_soon and time_difference >= self.updateIntervalCritical):
|
(ending_soon and time_difference >= self.updateIntervalCritical):
|
||||||
|
|
Loading…
Reference in a new issue