Easy integration with Discord #779
Replies: 12 comments 10 replies
-
@linuxkidd, @ckuethe, @AstroFrank, I'm not a Discord guru. How would a user actually look at the images? |
Beta Was this translation helpful? Give feedback.
-
Very nice... @EricClaeys ... This would provide the startrails, keogram and timelapse files to discord ... I've not looked too much into if it shows up in a private channel to the user, or if it goes into a specific public channel ( likely, this is configurable ) I would not recommend moving to bash... Python is the future, so this will integrate easily in the near future. |
Beta Was this translation helpful? Give feedback.
-
No, you can't do that in bash. It depends on a python library. Good idea, needs to be a little more sophisticated:
@AstroFrank do you feel up to adding that additional functionality? |
Beta Was this translation helpful? Give feedback.
-
@ckuethe, couldn't we put the credentials in ftp-settings.sh.repo like we do with other upload settings (not just FTP)? Eventually of course ftp-settings.sh will be included in the unified json config file. @AstroFrank, the code should probably go in a Python version of upload.sh, or in a new python file that upload.sh calls (until we convert all the scripts to Python). upload.sh doesn't know what it's uploading - it's simply given a few arguments including the file to be uploaded, and then determines the upload method by looking at variables in ftp-settings.sh. |
Beta Was this translation helpful? Give feedback.
-
I think I got it mostly figured out for functionality. I am currently
testing my code, I will cleanup formatting, comment and confirm everything
works as intended and will post it here and see what is the next review
steps, I am sure I will have missed something.
Frank
…On Thu., Nov. 11, 2021, 8:58 p.m. EricClaeys, ***@***.***> wrote:
@ckuethe <https://github.com/ckuethe>, couldn't we put the credentials in
ftp-settings.sh.repo like we do with other upload settings (not just FTP)?
Eventually of course ftp-settings.sh will be included in the unified json
config file.
@AstroFrank <https://github.com/AstroFrank>, the code should probably go
in a Python version of upload.sh, or in a new python file that upload.sh
calls (until we convert all the scripts to Python). upload.sh doesn't know
what it's uploading - it's simply given a few arguments including the file
to be uploaded, and then determines the upload method by looking at
variables in ftp-settings.sh.
You can look at scripts/generateForDay.sh to see how upload.sh is called.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#779 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASUAABXSREFJCIAEJ7NWLLULRYETANCNFSM5HZUJ2WA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
-
The simple send to Discord script functions. The user will require hardcoding WEBHOOK_ID, WEBHOOK_TOKEN (we could pass those parameters from the FTP settings. The webhooks are straightforward to setup within discord. https://hackaday.com/2018/02/15/creating-a-discord-webhook-in-python/, https://discordpy.readthedocs.io/en/stable/api.html#webhook. The user would also require the discord.py via Two lines added to the endOfNightend_additionalSteps.sh to indicate action into the logfile and verify the python script is in place here:
And here is the sendToDiscord.sh its python but works just fine in this environment.
Now there are a few different ways this could be integrated with the rest of the project. I am not too sure how to go about that part. |
Beta Was this translation helpful? Give feedback.
-
Ok, I got
Turns out discord webhook file size limit is 8Mb, I will need to find a simple method for reducing the timelapse size. Compression or resolution change via ffmpeg is that the simplest option? |
Beta Was this translation helpful? Give feedback.
-
@AstroFrank what we tell people who have problems creating timelapse videos due to memory constraints is to reduce the resolution. The easiest is to modify the TIMELAPSEWIDTH and TIMELAPSEHEIGHT variables in config.sh. |
Beta Was this translation helpful? Give feedback.
-
@AstroFrank No need to wait. You can run |
Beta Was this translation helpful? Give feedback.
-
IDK if this thread is still alive, but I'm working on how to post my daily images to Discord. I have the code working now, it will compress your LARGE videos down to size (~8MB) which works with Discords limit. I have been able to push to my discord server... BUT I'm having trouble integrating this feature into the Allsky code... I hate messing with someones hard work and nicely laid out code... but I've been trying to JAM this in... to no avail. Attached are the files that will push to Discord... all you need is the webhook url. (no API key or anything else). ANY chance someone can assist in nicely integrating this code into Allsky endOfNight_additionalSteps.sh?? or maybe upload.sh (I think this is where is should be???) APPRECIATE anything... |
Beta Was this translation helpful? Give feedback.
-
I took a brief look and will provide comments next week, after I take a closer look.
Would only the timelapse video be uploaded to Discord? And would that be in addition to, or instead of uploading it to an Allsky Website? Eric |
Beta Was this translation helpful? Give feedback.
-
@clint70 Welcome to programming! command1 && command2 can also be written as: command1 && \
command2 The This would make sense, since you only want the second ffmpeg to run if the first one succeeds. I suggest using debug output, especially during testing. Also suggest checking the return code ( Given what you're trying to do with this, it may be best to add a new PROTOCOL to |
Beta Was this translation helpful? Give feedback.
-
Just a quick idea, how about we add Discord support to the FTP as an option at end of night?
We just need to add the discord python:
sudo python3 -m pip install -U discord.py
Then we can add a few lines to the FTP script or make a separate cron job: where the user just have to input WEBHOOK_ID, WEBHOOK_TOKEN for there particular discord server webhook. Much easier then setting up a whole website or Amazon bucket! Free and simple.
The sky is the limit! What do you folks think?
Beta Was this translation helpful? Give feedback.
All reactions