show buy it now price, if any
This commit is contained in:
parent
0a73423195
commit
9c8ffee5ce
3 changed files with 30 additions and 9 deletions
12
buypeeb.py
12
buypeeb.py
|
@ -75,6 +75,11 @@ class WatchlistUpdater(Thread):
|
|||
future = pool.schedule(item.update)
|
||||
future.add_done_callback(watchlist_update_done)
|
||||
|
||||
pool.close()
|
||||
pool.join()
|
||||
if app.selected:
|
||||
app.updateSidePane(app.selected)
|
||||
|
||||
class BuypeebApp:
|
||||
|
||||
# SETUP
|
||||
|
@ -214,14 +219,17 @@ class BuypeebApp:
|
|||
"Price": item.price_jpy(),
|
||||
"PriceAUD": item.price_aud(),
|
||||
"Ending": item.ending_in(),
|
||||
"Bids": str(item.bids)
|
||||
"Bids": str(item.bids),
|
||||
"BuyItNow": f"{item.price_jpy(win = True)} ({item.price_aud(win = True)})" if item.win_price not in [0, "0", None, ""] else "No",
|
||||
"AutoExtension": "Yes" if item.auto_extension else "No",
|
||||
"LastUpdated": "Last updated: heenlo"
|
||||
}
|
||||
|
||||
for label, contents in info.items():
|
||||
self.builder.get_object(f"lblSelected{label}").set_label(contents if contents is not None else "")
|
||||
|
||||
def resetSidePane(self):
|
||||
for label in ["YahooName", "Price", "PriceAUD", "Ending", "Bids"]:
|
||||
for label in ["YahooName", "Price", "PriceAUD", "Ending", "Bids", "BuyItNow", "AutoExtension", "LastUpdated"]:
|
||||
self.builder.get_object(f"lblSelected{label}").set_label("")
|
||||
|
||||
self.builder.get_object("lblSelectedName").set_label("buypeeb")
|
||||
|
|
23
listing.py
23
listing.py
|
@ -61,7 +61,8 @@ class YahooAuctionsItem:
|
|||
self.favourite = None
|
||||
self.end_date = None
|
||||
self.bids = 0
|
||||
self.automatic_extension = None
|
||||
self.auto_extension = None
|
||||
self.rate = 75.0
|
||||
|
||||
if url == None and from_json != None and id != None:
|
||||
self.id = id
|
||||
|
@ -96,13 +97,14 @@ class YahooAuctionsItem:
|
|||
ae = re.match(r'自動延長.+\n.+>(.+)<.+', r)
|
||||
if ae != None:
|
||||
ae = re.group(1)
|
||||
self.automatic_extension = (ae == "あり")
|
||||
self.auto_extension = (ae == "あり")
|
||||
|
||||
except:
|
||||
raise
|
||||
|
||||
j = j['items']
|
||||
self.price = float(j['price'])
|
||||
self.win_price = float(j['winPrice'])
|
||||
self.bids = j['bids']
|
||||
self.start_date = datetime.fromisoformat(j['starttime']).replace(tzinfo = JST)
|
||||
self.end_date = datetime.fromisoformat(j['endtime']).replace(tzinfo = JST)
|
||||
|
@ -116,10 +118,21 @@ class YahooAuctionsItem:
|
|||
|
||||
return self.id, self
|
||||
|
||||
def price_jpy(self):
|
||||
return f"¥{self.price:.0f}"
|
||||
def price_jpy(self, win = False):
|
||||
p = self.price
|
||||
if win:
|
||||
p = self.win_price
|
||||
return f"¥{p:.0f}"
|
||||
|
||||
def price_aud(self, rate = 75.0):
|
||||
def price_aud(self, rate = 0, win = False):
|
||||
if rate == 0:
|
||||
rate = self.rate
|
||||
else:
|
||||
self.rate = rate
|
||||
|
||||
p = self.price
|
||||
if win:
|
||||
p = self.win_price
|
||||
return f"${self.price / rate:.2f}"
|
||||
|
||||
def ending_in(self):
|
||||
|
|
|
@ -590,7 +590,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lblSelectedEnding1">
|
||||
<object class="GtkLabel" id="lblSelectedBuyItNow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
|
@ -602,7 +602,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lblSelectedEnding2">
|
||||
<object class="GtkLabel" id="lblSelectedAutoExtension">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
|
|
Loading…
Reference in a new issue