Compare commits
2 commits
e522c773b3
...
9c8ffee5ce
Author | SHA1 | Date | |
---|---|---|---|
9c8ffee5ce | |||
0a73423195 |
3 changed files with 87 additions and 6 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")
|
||||
|
|
25
listing.py
25
listing.py
|
@ -61,6 +61,8 @@ class YahooAuctionsItem:
|
|||
self.favourite = None
|
||||
self.end_date = None
|
||||
self.bids = 0
|
||||
self.auto_extension = None
|
||||
self.rate = 75.0
|
||||
|
||||
if url == None and from_json != None and id != None:
|
||||
self.id = id
|
||||
|
@ -92,11 +94,17 @@ class YahooAuctionsItem:
|
|||
r = requests.get(f"https://page.auctions.yahoo.co.jp/jp/auction/{self.id}").text
|
||||
# r = open("yahoo.html").read()
|
||||
j = json.loads(re.match(r'.*var pageData ?= ?(\{.*?\});', r, re.DOTALL).group(1))
|
||||
ae = re.match(r'自動延長.+\n.+>(.+)<.+', r)
|
||||
if ae != None:
|
||||
ae = re.group(1)
|
||||
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)
|
||||
|
@ -110,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):
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">The Stinchinator</col>
|
||||
<col id="1" translatable="yes"/>
|
||||
<col id="1" translatable="yes">¥599</col>
|
||||
<col id="2" translatable="yes">$5.99</col>
|
||||
<col id="3" translatable="yes">7 hours</col>
|
||||
<col id="4" translatable="yes">12345</col>
|
||||
|
@ -565,6 +565,60 @@
|
|||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Buy it now?</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Auto extension?</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lblSelectedBuyItNow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="yes">Yes</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lblSelectedAutoExtension">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="yes">N/A</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
|
Loading…
Reference in a new issue