6

With mentions being broken and retoor creating an RSS feed for mentions, I made a small python script that reads retoor's feed and filters out only mentions of you and sends them as desktop notifications:
https://github.com/yuriKhordal/...

It's technically cross platform, but I've only tested this on linux with KDE, so no idea how or if it works on windows, and the tools around the script (install script, systemd service, run script, and the instructions on github) are currently linux only. Sorry Windows people, hadn't had the time to test this on windows and I've already spent more time on it than I originally allocated for it (accidentally sat 16 hours straight programming yesterday until mornimg and then "collapsed" into bed :P), I'll try to get to it somewhen this week. But it's still possible to run the "manual way" as `python dr-mentions.py` from CMD.

Bug reports are welcome, and round of Applause for retoor and every one of you that is keeping this dying platform alive <3

Comments
  • 3
  • 3
    Props.

    Side note: I fucking hate GitHub. I don't know how they made their site, but my theme just doesn't work well there. Can't see anything. So I'm forced to switch off my theme in order to see any code over there. https://devrant.molodetz.nl/preview... .

    ...so annoying.
  • 5
    Nice! DevRant on life support! 😅
  • 5
    @Lensflare *Raspy voice* "Back in my dayyyy... You used to open devRant hourly and get new postss... *cough cough*, we had comment sections you had a looong scroll down for-"
    Okay grandpa, lets go get our pills shall we?

    XD XD XD XD

    Damn I miss the devrant of 2017-2020
  • 4
    @SoldierOfCode

    That's a great job! But the path in dr-mentiond is hardcoded to your local project directory. After I fixed that, installing and configuring went well.

    I only think the service will not boot on my XFCE machine because of: Unit /usr/lib/systemd/user/dr-mentiond.service is added as a dependency to a non-existent unit graphical.target.

    It should be probably something else on XFCE. Is there a chance that it would work there anyway?

    I could fix and contribute :P But retoorii no github (anymore).

    @Lensflare / @SoldierOfCode

    well, let's pull some stats for humans: https://static.molodetz.nl/dr.stats...

    for automation: https://static.molodetz.nl/dr.stats...
  • 2
    @retoor What? No it's not, it's "hard-code" to `/usr/share/dr-mentions`...

    About the graphical.target, it's distro-dependant, not desktop dependant, in my distro graphical.target also doesn't work, if you change it to default.target it does work (graphical.target *should* be the runlevel for desktop-environments instead of headless, but *should* doesn't work in linux *sigh*.

    I thought it only didn't work on my distro because it's stupid, but if it happens on others too I'll change it to default.target

    I went to check `dr-mentiond` on just in case and it does indeed for my local directory, with the /usr/share/ path commented out, must have changed it for testing and accidentally commited it like that.
  • 2
    @retoor, @Lensflare - Fixed, new release is on github
  • 2
    @SoldierOfCode will try with two hours. Stay tuned.
  • 2
    @SoldierOfCode I realize that with your follow functionality I can get notifs for all my accounts 😁
  • 2
    @retoor What do you mean by follow functionality?

    Also do mind that I have no idea if this script even works with the real RSS feed becuase this platform gets a message once on a blue moon so I did not get to test it on "Real" data, only on downloaded RSS feeds at different times to see if it sees the difference between them.
  • 2
    @SoldierOfCode it's very easy to test, i have different account on my phone and on my laptop. On phone: whimsical, on laptop: retoor. But that's a secret.

    You called it follow functionality yourself: https://devrant.molodetz.nl/preview...
  • 1
    @retoor test test test. Should give notif in less than 5 minutes right? :)
  • 1
    @retoor test test test.
    @whimsical test test test.
  • 2
    @SoldierOfCode ah, it has a missing status field: https://devrant.molodetz.nl/preview...

    Do you expect that to exist for some reason?
  • 1
    @retoor Hmm? But it does, there's literally a status field (i.e. the HTTP status from the request) that exists:

    https://devrant.molodetz.nl/preview...
  • 1
    @retoor Did you uncomment any of the `RSS_URL = open('someRSSfile.xml').read()` lines? Cuz if you did then yes, files naturally don't have the HTTP status field, those line are just for testing and to uncomment them you need to comment out other lines (like lines about status or etag and stuff)
  • 2
    @SoldierOfCode no, i have originally repository version, unchanged. I added some log lines and ran the script manually and it seems ok. Some sort of hick-up i guess. Could be internet connection. It kinda blows here. I also did not expect 'status' in a dict.
  • 0
  • 1
    @SoldierOfCode I've added some logging: https://devrant.molodetz.nl/preview...

    Will debug from there what happens.

    @whimsical

    @retoor
  • 1
  • 1
  • 1
  • 1
    @SoldierOfCode Yeah, i had it working by excluding a line but then all notifs came, that's not OK. It has something to do with date parsing maybe and my timezone maybe? Investigating still. Check if your latest version is pushed.
  • 1
  • 1
    @SoldierOfCode this is how it looks at my machine too: https://devrant.molodetz.nl/preview...

    But the original way isn't working yet but service runs well: https://devrant.molodetz.nl/preview...

    Maybe i've just missed some? Hmm, let's just wait.

    @retoor

    @whimsical
  • 1
    I think I realized why it doesn't work most of the time!

    This needs to be tested but I think it has to do with the time of posting and the time that the RSS feed claims to be updated at.

    I noticed that when looking at the feed at 19:09:xx GMT the last item was 19:02:16 GMT (devrant-mention-19384907-to-SoldierOfCode)

    But then, the next RSS update was at 19:14:31 GMT, as expected, BUT the two new messages it shared were devrant-mention-19384908-to-whimsical and devrant-mention-19384908-to-retoor at 19:08:50 GMT, so messages that would've expected to be at the feed before that at 19:09:xx GMT! It's "remembering" up new items from the past which should've been included in the previous feed.

    And that why my script doesn't see them, after each feed it updates it's date to match the date of the feed's update date, any messages before the previous feed are ignored - That's how my script know which mesages are new
  • 1
    Let's test: @whimsical, @retoor, @SoldierOfCode

    Current time: 19:28:21 GMT

    RSS time: 19:24:31 GMT

    Last item time: 19:18:41 GMT
  • 1
    @SoldierOfCode You are right, it works. The file does not always seem up to date somehow. See the contents. This comment you'll not see.

    @whimsical xx

    @retoor xx
  • 0
    Yep, I'm correct

    Current time: 19:30:30 GMT

    RSS time: 19:29:50 GMT

    Last messages:

    19:22:55 GMT (x3), 19:22:55 GMT, 19:18:41 GMT
  • 1
    @SoldierOfCode oh, rss seems to be working fine (still i will make it faster / more live). Have not seen notifications yet. I will just let it rest for a night. Maybe magically i will see one pop up sometime.
  • 1
    So basically, even tho the current RSS feed should be showing NEW items between 19:24:31 GMT(last feed) and 19:29:50 GMT (new feed)

    It's actually ONLY showing items older than 19:24:31 GMT - the previous feed, and wasn't showing any of the new mentions that happened between the times of the feeds. The feed is "one update behind", and that's why it breaks the script
  • 1
    @SoldierOfCode the buildDate from xml is indeed later than the last comment.

    Oke, so, how will we continue on fixing this? Do you expect anything from my end / what exactly?
  • 1
    It's an easy "fix" on my end (instead of relying on the faulty RSS, I will make it rely on the most recent message in the feed, to fix the RSS's one step behind issue.

    On your end... I'm not sure what the fix would be because I don't know why it would "jump back" like it does. It's weird. Almost as if it first updates the RSS feed, and then reads new messages(instead of first reading new messages and then updating the RSS feed), which would make it always being one leg behind. Idk
  • 1
    @retoor

    > Oke, so, how will we continue on fixing this? Do you expect anything from my end / what exactly?

    I don't know what you did, but you fixed it, I just saw that in the new XML the new items are actually withing 5 minutes of the XML's update date, instead of 10 minutes like the previous cases.

    I.e. the date is 19:44:20 GMT, (so prev should be 19:39:xx GMT) and the last message is 19:42:15 GMT, so between 19:39 and 19:44
  • 1
    @SoldierOfCode I dunno why, here is the source code: https://retoor.molodetz.nl/retoor/...

    It became an async beast.
  • 1
    @SoldierOfCode it's logic, fetching the comments takes some time. So, it can be minutes behind, but this new version will be almost live.
  • 1
    Oh...

    You just made it update much faster, I'm seeing on my logs we get a new RSS feed at least once per minute

    Let's see, last was 19:50:17 GMT

    When's the new one? Ah 19:51:32 GMT
  • 1
    @SoldierOfCode https://devrant.molodetz.nl/preview...

    So it works but is kinda late? Well, i think I resolved that already.
  • 1
    @retoor

    > it's logic, fetching the comments takes some time. So, it can be minutes behind, but this new version will be almost live.

    No no, it's a different error. Making the delta (difference between feeds) smaller doesn't make the problem go away, because it would still make messages appear 2 deltas behind (instead of one delta as it should)

    There's no need to overload the dR APIs because it's still the same error, no matter how quick you'll make it poll it would still be the same error

    (Well, unless you make the RSS feed more than twice as fast as my script, but that's not a good solution, 5 minutes was a good delta)
  • 1
    @SoldierOfCode it'll be ok. devRant API aint no sissy :) I received your notification almost instant.

    @retoor
  • 1
    @12bitfloat hey floatii, install the tool mentioned in the original post. Then you have to scroll less :P It will give notifications like this on xfce / kde (those two are tested): https://devrant.molodetz.nl/preview...
  • 1
    @retoor, so the interval/sleep/timer/whatever is now every 60 seconds?

    I'm testing the fix I mentioned (relying on last actual item, and not rss date) on my end right now, I'm going to make the sleep interval close to yours.

    In the original script it was 300(i.e. 5 minutes like yours) but I accidentally commited the test version which had SECONDS set to 15 instead of 300 after I was testing with text files.
  • 1
    @12bitfloat - Don't install yet, update(fix) incoming
  • 0
    @SoldierOfCode yeah, your script refreshes a lot :) But that's totally fine. Backend updates every 1.5 minute or something. One minute break, 26 seconds to crawl 180+ rants.
  • 1
    @whimsical Ah, okay, I'll set it to 90secs then
  • 1
  • 1
    Okay, yeah, it works, I'll push an update to github soon enough
  • 1
    Last test just to be sure @SoldierOfCode
  • 0
    @SoldierOfCode cool. What should we build now? 😁
  • 0
    Oh, totally forgot to update,

    The update is live on GitHub

    @retoor @whimsical @Lensflare @12bitfloat
  • 0
Add Comment