It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
avatar
Gede: prince checking bug.
avatar
JMich: Prince checking? There are royalties check as well?
Hahaha. That was actually a good pun.

avatar
phaolo: fancy_sound=True doesn't work for me.
It is supposed to play one of the standard MS Windows notification sounds. It is supposed to use your sound card and speakers. Unfortunately I do not run a Windows machine to test it.

avatar
phaolo: fancy_sound=False works, but often beeps without a match (and always at the start).
Hmm... that sounds odd. It should only beep when it finds a match. If there is no wishlist.txt file, every new game counts as a positive match the first time it is seen (the script does not store information between runs).

Is there an entry that may be matching too many games? I added some output that may help you if that is the case.
avatar
Gede: Is there an entry that may be matching too many games? I added some output that may help you if that is the case.
I checked various times, but I don't have idea.
I'll try the new version, but could you also look at this error, please?

Traceback (most recent call last):
File "the_napping_gamer.py", line 498, in <module>
wait_time = max(min(sleep_time, check_games()), minimum_sleep_value)
File "the_napping_gamer.py", line 432, in check_games
for game_info in extract_game_data(read_from_url(url)):
File "the_napping_gamer.py", line 368, in extract_game_data
for product_id in data["bundle"][productIds]:
NameError: name 'productIds' is not defined
avatar
phaolo: I checked various times, but I don't have idea.
I'll try the new version, but could you also look at this error, please?
Yep. I just caught that one too. You'll find it fixed already.
avatar
phaolo: I checked various times, but I don't have idea.
I'll try the new version, but could you also look at this error, please?
avatar
Gede: Yep. I just caught that one too. You'll find it fixed already.
Cool thanks.

About the wishlist instead.. what should be the new info?
The script doesn't tell me what's the current match or if it didn't find wishlist.txt
It still beeps at almost every new game.
avatar
phaolo: About the wishlist instead.. what should be the new info?
The script doesn't tell me what's the current match or if it didn't find wishlist.txt
It still beeps at almost every new game.
Err... you are right, it could say something when starting. However, the wishlist file is reloaded every time a new game is seen. That way you can update it after buying a game and keep the script running (forgotten in the background).

In the text you see scrolling you will find a line saying 'Match found for "FOO"' when a new game shows up and the script beeps. If you see nothing and still hear the beep, then it means it did not find the "wishlist.txt" file (located at the same directory where the script is).

You may want to play a little with this file. Add an obvious match like "e", or include only an impossible match like "foobarbaz". Let me know if you still find it misbehaving.
avatar
Gede: In the text you see scrolling you will find a line saying 'Match found for "FOO"' [..]
You may want to play a little with this file. Add an obvious match like "e", or include only an impossible match like "foobarbaz". Let me know if you still find it misbehaving.
I see the 'Match found for "FOO"' and hear the beep every time.
Even by using only these 3 lines:

xxxxx
yyyyy
zzzzz
avatar
phaolo: I see the 'Match found for "FOO"' and hear the beep every time.
Even by using only these 3 lines:

xxxxx
yyyyy
zzzzz
Odd. I am unable to reproduce what you describe. I'll need your help to solve that problem.
Which line is it matching with? (That is, what match is is reporting?)

Also, please try an empty wishlist.txt file. Let me know if it still beeps.
avatar
Gede: In the text you see scrolling you will find a line saying 'Match found for "FOO"' [..]
You may want to play a little with this file. Add an obvious match like "e", or include only an impossible match like "foobarbaz". Let me know if you still find it misbehaving.
avatar
phaolo: I see the 'Match found for "FOO"' and hear the beep every time.
Even by using only these 3 lines:

xxxxx
yyyyy
zzzzz
Is your wishlist.txt in the same directory as the script?


I found it didn't trigger for games added to the wishlist after the script had been started. Added a few debug statements, and it merrily reported "wishlist_entry" as False despite this obviously not being so. So I looked around, and saw provide_notification was being called in check_games only if game_id was not in seen_games. Makes sense, we don't want to spam the user with a ton of browser instances. But it also means that adding a previously seen game to the wishlist won't trigger anything.

Here's an example:

"witcher" is in the wishlist:

02:07:10 NEW! "the witcher 2" at USD 2.99 (-85%) 7/50 copies ('https://www.gog.com//game/the_witcher_2',)
DEBUG: this is wishlist_entry witcher
(Match found for "witcher")
01:07:10 "the witcher 2" USD 2.99 7/50
You may nap for 0.3 more minutes (01:07:31). I'll stand guard! Next peek in 21 seconds.
01:07:31 "the witcher 2" USD 2.99 5/50 expected sale time: 0.9 min (01:08:23))
You may nap for 0.9 more minutes (01:08:23). I'll stand guard! Next peek in 30 seconds.
01:08:02 "the witcher 2" USD 2.99 3/50 expected sale time: 0.7 min (01:08:43))
You may nap for 0.7 more minutes (01:08:43). I'll stand guard! Next peek in 30 seconds.

"tales" isn't:

02:08:32 NEW! "tales from the borderlands" at USD 8.49 (-66%) 40/40 copies ('https://www.gog.com//game/tales_from_the_borderlands',)
DEBUG: this is wishlist_entry False
DEBUG: wishlist entry is false
01:08:32 "tales from the borderlands" USD 8.49 40/40
You may nap for 2.0 more minutes (01:10:32). I'll stand guard! Next peek in 30 seconds.

now "tales" has been added:

01:09:02 "tales from the borderlands" USD 8.49 35/40 expected sale time: 3.5 min (01:12:33))
You may nap for 3.5 more minutes (01:12:33). I'll stand guard! Next peek in 30 seconds.
01:09:32 "tales from the borderlands" USD 8.49 17/40 expected sale time: 0.6 min (01:10:08))
You may nap for 0.6 more minutes (01:10:08). I'll stand guard! Next peek in 30 seconds.
01:10:03 "tales from the borderlands" USD 8.49 3/40 expected sale time: 0.1 min (01:10:09))
No time to sleep! Next peek in 6 seconds.

I added dzen2 notifications, and put provide_notifications before the game_id check. This works nicely - for me :)
avatar
Gede: Odd. I am unable to reproduce what you describe. I'll need your help to solve that problem.
Which line is it matching with? (That is, what match is is reporting?)

Also, please try an empty wishlist.txt file. Let me know if it still beeps.
It always reports the full game name (with spaces instead of _ )
No change with an empty wishlist.txt file.

EDIT: wait, I'm stupid, it doesn't say 'Match found for", it just says the name.. O_O

I hope that we'll find the error, as here is a bit late +_+

avatar
hyperagathon: Is your wishlist.txt in the same directory as the script?
Yes. I also tried to put the full path, but I get an error.
Wait, I'll try changing also the working dir..

EDIT: it was the working directory!!! -_-
So the script couldn't find any file, because it searched it in my current folder, instead of its own dir.
Post edited March 22, 2016 by phaolo
avatar
hyperagathon: I added dzen2 notifications, and put provide_notifications before the game_id check. This works nicely - for me :)
Great! It is wonderful to see people tailoring the code to better fit their needs. :-)
I know I cannot satisfy everyone, and did not want to swamp people with command line arguments.

avatar
phaolo: So the script couldn't find any file, because it searched it in my current folder, instead of its own dir.
Oh, your working directory was not the script's directory? I will address that problem. Thank you for solving this issue.
avatar
Gede: Oh, your working directory was not the script's directory? I will address that problem. Thank you for solving this issue.
Thank you for the script, instead.
In the end, I slept well during this Insomnia ;)
Again, random internet guy to the rescue, after GOG chose stupid sale format. Many thanks for the script, GOG already owes you for quite a few $ of purchases.

I had some issues with sound notification, beep doesn't work on my system (running linux under VM). I had to do this:
@@ -217,7 +217,7 @@
if sound_notify:
try:
# Do not forget that beep needs to be SETUID to work.
- subprocess.call(["/usr/bin/beep"])
+ subprocess.call(["/bin/bash", "-c", "/usr/bin/mplayer /tmp/the_napping_gamer/desktop-login.ogg &>/dev/null"])
except FileNotFoundError:
pass

You may want to put configuration into separate file, otherwise updates destroy it. I solved it with diff and apply it to new version, it's just not very friendly, and diff is usually not available on windows (and neither is git, which would serve the same purpose - git stash && git pull && git stash pop).
avatar
huan: You may want to put configuration into separate file, otherwise updates destroy it.
^ I agree with this

Anyway, I got a crash after many hours, due to a failed connection:

sock.connect(sa)
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Post edited March 22, 2016 by phaolo
avatar
huan: - subprocess.call(["/usr/bin/beep"])
+ subprocess.call(["/bin/bash", "-c", "/usr/bin/mplayer /tmp/the_napping_gamer/desktop-login.ogg &>/dev/null"])
thank you for this :) this helped me get my beep going aswell I tried "sudo /usr/bin/beep" but it has to be "usr/bin/sudo","/usr/bin/beep" aparrently ;)
I also modified the notify_send to stay longer and be all red an important ;)

subprocess.call(["/usr/bin/notify-send", "--expire-time=100000", "--urgency=critical", "--app-name=the_napping_gamer", title, short_text])

with the really loud beep and the espeak saying the name of the game, I'm pretty sure I won't miss any wishlisted titles :D now if only they came on sale, too....
avatar
huan: I had some issues with sound notification, beep doesn't work on my system (running linux under VM). I had to do this:
Beep does not come "as standard" with Linux. It is usually some package that needs to be added. I don't know why, since my shell has no trouble beeping at me. :-)

It seems there is a lot of people that like using "fancy sounds". And it makes sense, as mplayer may be more often installed than beep. I'll add mplayer support to my "to do" list, to make it more pleasant to those people who keep their speakers on. I just wish I could get some Mortal Kombat voice over saying "New Game On Sale!".

Your suggestion is accepted, and I will move the configuration into its own file. That may allow me to provide more configuration options. I'm sorry for the trouble it caused you.

I am glad I could be of help.
Post edited March 22, 2016 by Gede