michaelhball / discogs_alert

Customised, real-time alerting for your hard-to-find wantlist items.
MIT License
29 stars 7 forks source link

general questions on the script (master listings, already alerted list, brave browser for client) #50

Closed Leonas2000 closed 1 year ago

Leonas2000 commented 1 year ago

Hello Michael!

Thank you for the amazing Python script! I cloned the repo and was able to build and install it. Now I want to play around with the code a bit and add some features for myself.

  1. I noticed that If I inputted for the id a master_id 1757517 for the listing of https://www.discogs.com/sell/list?master_id=1757517&ev=mb, I did not get any notifications. Is it how it is programmed?

  2. When I first ran python3 -m discogs_alert -dt ... with my want list, I noticed that sent all the available (old) listing via pushbullet. When uninstalling discogs_alert and reinstalling through git and rerunning the code it did not send those alerts. How does the code work? And it did not notify for all that were for sale. (is maybe the country wrong? and how can I have it use multiple counties to see if shipping is available?)

    get the complete list of previous pushes

    pushes_dict = defaultdict(set)
    for p in pushbullet.get_all_pushes(pushbullet_token):
        if "title" in p and "body" in p:
            pushes_dict[p["title"]].add(p["body"])

    If I understand correctly, does it check through the push bullet api if it has already sent it before and won't send even if the python script is rerun?

  3. I saw that it uses Chrome, I installed it for now but I was curious if I could make it work with Brave browser. I figured it has something to do with the AnonClient(Client) but I can't figure out how to do it. I would be really happy if you could lead me on the right way!

Leonas2000 commented 1 year ago

Furthermore I want the notification to also include the price. I saw there is a self.total_price, but how can I use it in the loop.py?

if we found something, send notification

        message_title = f"Now For Sale: {release.display_title}"
        for listing in valid_listings:
            message_body = f"Listing available: {listing.url}"
            if message_title not in pushes_dict or message_body not in pushes_dict[message_title]:
                print(f"{message_title} — {message_body}")
                pushbullet.send_pushbullet_push(
                    token=pushbullet_token, message_title=message_title, message_body=message_body, verbose=verbose
                )
michaelhball commented 1 year ago

Thanks for your questions!

I noticed that If I inputted for the id a master_id ... I did not get any notifications.

I didn't actually design the script to work with master IDs, so there's a good chance that doesn't work. It will work if you select a specific release though, e.g. https://www.discogs.com/sell/item/2454159833. Is that sufficient for your use-case?

If I understand correctly, does it check through the push bullet api if it has already sent it before and won't send even if the python script is rerun?

This is exactly correct!I You will only receive a notification for a single listing once as it's assumed that, if you do nothing, you don't want to buy it. This is a common use-case for me as there'll be an expensive listing that's currently for sale that I want to ignore in the hope that something cheaper pops up. If you do want to receive notifications for listings more than once, you can delete the pushbullet notification.

and how can I have it use multiple counties to see if shipping is available?

Unfortunately this isn't possible on Discogs itself... you can only have a single address at any given time. The best solution here would probably be to have multiple accounts 🤷.

I saw that it uses Chrome, I installed it for now but I was curious if I could make it work with Brave browser.

It actually doesn't use Chrome, it uses Chromium, the underlying open-source software. Brave is itself just a Chromium implementation.

Furthermore I want the notification to also include the price.

You could just include it in the message_body or message_title of the notification! This is actually a pretty good idea in general, I'll think about making that change in the next release 👍.

Leonas2000 commented 1 year ago

It actually doesn't use Chrome, it uses Chromium, the underlying open-source software. Brave is itself just a Chromium implementation.

Ahh right I see, I installed chrome now and it works fine. But I'm still curious what I should've done to be able to use chromium from brave instead of needing to download chrome. Only if you have the time to explain ofc. Thanks!

You could just include it in the message_body or message_title of the notification! This is actually a pretty good idea in general, I'll think about making that change in the next release 👍.

would I have to add {listing.total_price} into the message_body?

michaelhball commented 1 year ago

Added the listing price to the message in #53 :) will be released shortly