Compare commits

..

No commits in common. "9c8ffee5ce12648f46cdb2137bee8fb509fb5694" and "e522c773b3398c04d7decff9d8474a23bd9c25f8" have entirely different histories.

3 changed files with 6 additions and 87 deletions

View file

@ -75,11 +75,6 @@ class WatchlistUpdater(Thread):
future = pool.schedule(item.update) future = pool.schedule(item.update)
future.add_done_callback(watchlist_update_done) future.add_done_callback(watchlist_update_done)
pool.close()
pool.join()
if app.selected:
app.updateSidePane(app.selected)
class BuypeebApp: class BuypeebApp:
# SETUP # SETUP
@ -219,17 +214,14 @@ class BuypeebApp:
"Price": item.price_jpy(), "Price": item.price_jpy(),
"PriceAUD": item.price_aud(), "PriceAUD": item.price_aud(),
"Ending": item.ending_in(), "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(): for label, contents in info.items():
self.builder.get_object(f"lblSelected{label}").set_label(contents if contents is not None else "") self.builder.get_object(f"lblSelected{label}").set_label(contents if contents is not None else "")
def resetSidePane(self): def resetSidePane(self):
for label in ["YahooName", "Price", "PriceAUD", "Ending", "Bids", "BuyItNow", "AutoExtension", "LastUpdated"]: for label in ["YahooName", "Price", "PriceAUD", "Ending", "Bids"]:
self.builder.get_object(f"lblSelected{label}").set_label("") self.builder.get_object(f"lblSelected{label}").set_label("")
self.builder.get_object("lblSelectedName").set_label("buypeeb") self.builder.get_object("lblSelectedName").set_label("buypeeb")

View file

@ -61,8 +61,6 @@ class YahooAuctionsItem:
self.favourite = None self.favourite = None
self.end_date = None self.end_date = None
self.bids = 0 self.bids = 0
self.auto_extension = None
self.rate = 75.0
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
@ -94,17 +92,11 @@ class YahooAuctionsItem:
r = requests.get(f"https://page.auctions.yahoo.co.jp/jp/auction/{self.id}").text r = requests.get(f"https://page.auctions.yahoo.co.jp/jp/auction/{self.id}").text
# r = open("yahoo.html").read() # r = open("yahoo.html").read()
j = json.loads(re.match(r'.*var pageData ?= ?(\{.*?\});', r, re.DOTALL).group(1)) 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: except:
raise raise
j = j['items'] j = j['items']
self.price = float(j['price']) self.price = float(j['price'])
self.win_price = float(j['winPrice'])
self.bids = j['bids'] self.bids = j['bids']
self.start_date = datetime.fromisoformat(j['starttime']).replace(tzinfo = JST) self.start_date = datetime.fromisoformat(j['starttime']).replace(tzinfo = JST)
self.end_date = datetime.fromisoformat(j['endtime']).replace(tzinfo = JST) self.end_date = datetime.fromisoformat(j['endtime']).replace(tzinfo = JST)
@ -118,21 +110,10 @@ class YahooAuctionsItem:
return self.id, self return self.id, self
def price_jpy(self, win = False): def price_jpy(self):
p = self.price return f"¥{self.price:.0f}"
if win:
p = self.win_price
return f"¥{p:.0f}"
def price_aud(self, rate = 0, win = False): def price_aud(self, rate = 75.0):
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}" return f"${self.price / rate:.2f}"
def ending_in(self): def ending_in(self):

View file

@ -18,7 +18,7 @@
<data> <data>
<row> <row>
<col id="0" translatable="yes">The Stinchinator</col> <col id="0" translatable="yes">The Stinchinator</col>
<col id="1" translatable="yes">¥599</col> <col id="1" translatable="yes"/>
<col id="2" translatable="yes">$5.99</col> <col id="2" translatable="yes">$5.99</col>
<col id="3" translatable="yes">7 hours</col> <col id="3" translatable="yes">7 hours</col>
<col id="4" translatable="yes">12345</col> <col id="4" translatable="yes">12345</col>
@ -565,60 +565,6 @@
<property name="top_attach">0</property> <property name="top_attach">0</property>
</packing> </packing>
</child> </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> <child>
<placeholder/> <placeholder/>
</child> </child>