I want to write a telegram bot with the python-telegram-bot package that waits for a url from the user and then asks the user what format he wants the file in.
I had a question regarding calling a token from external sources, which has been answered here.
How would I have to write the bot, so a user doesn't have to call a command, but can send a URL (e.g. https://youtube.com, www.youtube.com or just youtube.com, same for reddit, twitter, etc.)? I would then want the bot to send back a inline keyboard to ask for the format (Video, Audio, or Gif) and send it their way. (also delete the file from the local server afterwards).
The bot will be utilizing youtube-dl to download the videos and convert them to the chosen format. I want to use different presets for different websites/chosen formats. If someone sends a url and chooses GIF, it should automatically choose the preset to remove the audio from the video. Telegram will then recognize it as a gif and auto-play it in chat.
Related
I am learning boost/asio. I can do an endpoint, active and passive sockets. Now I want to write something like a simple client application, which will get specific data from web pages.
So I have few questions about that:
If I have a done an socket, which is related with a web page, how can specify some content on the page. For example, I want to get an image. There are many images on the page. Not only images. I want to identify specific image. How can i do that?(may be and "id" from html or some how else).
After that I want to get that specific image on my PC. How can I download it and save it?
If it is not image, if I want to work with audio file, video file, text, hyperlink and e.t.c. How to generalize it for any type of content?
How can I follow links on web page?
You also may use boost/beast in answer for this question.
offtop
(cpp is not good idea for dealing with that stuff, I know that)
I'm working on a digital photo frame app with the new Google Photo Library API beta.
Assume that multiple devices are able to access the same album (shared album, or login with the same account), when there is a picture uploaded from one device, can other devices receive any notification regarding the new upload? If polling is needed for now (that's not really something efficient), what's the recommended interval for polling?
The platforms are Android (TV+Mobile)/iOS/tvOS
Right now there's no way to be notified of any changes to the library or albums.
You will need to poll an album (ie. list its contents) or the library to see if any new media has been added. For albums you could also just list the albums and check if the number of media inside it has changed.
The polling interval depends on your use case and how long of a wait is acceptable to your users. For example, you could run a manual refresh in the background every hour if your app isn't open and refresh more frequently when the user is interacting with your app. Maybe you could also include a 'refresh' button to trigger it manually?
Alternatively, if the entire process is handled through your application, you could also send a notification through a different notification service (Firebase Cloud Messaging) to notify your apps and server that a new media item has been added. This is something you'd need to implement yourself though.
This is definitely something that has come up before and I'd encourage you to file a feature request on our public issue tracker: https://developers.google.com/photos/library/support/how-to-get-help#missing-features
There was a music event a friend of mine went to and they had a few photographers waling around out there. The photographers took photos that were instantly uploaded to the users facebook account via an NFC wristband. The workflow when it was explained to me looks like this:
Step-1 Get a nfc wristband at the Kiosk- Facebook will be encoded into the wristband.
Step-2 Walk around the event. If a photographer takes your picture, hold your wrist to the camera and the image will be watermarked with event/sponsor logos at the bottom and posted to your facebook account .
So, I was thinking how this could possibly be done- I googled and googled, but I got nothing. Here's my guess- All the FB authentication can be in the wristband. An EyeFi SD card has the ability to take a photo and transmit it. NFC Arduino reader could read the persons wristband, authenticate, then go into the images and pull the last photo that was taken and post it to the users fb page. What do you think?
We have a (beta) product that performs this exact function. It's called Flomio Kiosk. The way it works is with NFC wristbands and Android NFC terminals like the Galaxy S4 Zoom. The system lets guests associate wristbands/cards to their Facebook or Email accounts. The NFC Kiosk application has a photographer mode that allows pictures taken to be tagged and uploaded with the scanned wristband's profile.
The architecture of the stack is straightforward. The UUID of the wristbands are associated with the Facebook token of the associated guest. This needs to be stored in a cloud server so that you can effectively OAuth2.0 to Facebook and post on behalf of the guest. This setup also allows us to remain liability free of ill formed posts. Each developer that uses our system needs to create their own Facebook app and get it approved. If spam or content that violates Facebook T&C is posted then only that Facebook app will be shutdown rather than the whole Flomio Kiosk solution.
In order for us to grab the Facebook token for each guest, the guest must go to the events' landing page (we use eventname.flomio.com), enter their wristband code (5 digit number) and sign in with their Facebook credentials. The guest can then select what permissions to give the event application, such as post to "Only Me" and allow access to their "News Feed". Once this registration process is complete the wristband is considered activated and the OAuth token for accessing the guests Facebook profile is stored in the Flomio database alongside the wristband UUID.
When a wristband is scanned at an access point, the UUID is sent up to Flomio via websockets for ultra-fast responsiveness that reveals the guest name and profile picture. This way event organizers can provide a more personalized experience to guests. In photographer mode, the images are taken and then wristbands are scanned. Images are posted through Flomio where event logos are overlaid on the pictures for added brand recognition. Included are predefined post messages as well that event organizers can curate before hand. Here's a simple diagram of how things come together.
For high end cameras like the Nikon D300 we use the Transcend Wifi SDcards as they're more hacker friendly. These run Linux so we execute some scripts to tag the photos as soon as they're taken but upload them later through a background process. Our Kiosk solution is undergoing maintenance right now to add support for our FloJack and FloBLE product lines. Once complete any smartphone will be able to act as a scan terminal in a multitude of deployment scenarios. Sign up for our blog to stay tuned with our latest releases.
I'm using the GDK with XE16
I would like to save a video using MediaRecorder and then put it on the Timeline so I can let the user share the video to Gplus, YouTube or any contact. I am providing some additional information during the recording process as an overlay on the video preview.
I am able to save the videos into the /mnt/sdcard/Movies path. I am invoking the Intent.ACTION_MEDIA_SCANNER_SCAN_FILE to add the recorded video to the media database.
I have not been able to figure out how to add a share intent to on livecard. The previous API supported static cards, but those did not support video attachments; and the API is no longer available. I have also tried to use AccountManager and the com.google account in Glass to get an ouath token for the Mirror api to write direction via oauth2:https://www.googleapis.com/auth/glass.timeline. The authorization request shows up, but it is impossible for the user to accept the request.
I've considered sending the video file back to a proxy server that will then call mirror, but this seems like a big round trip for nothing.
I suppose I could send the credentials through this proxy, but this seems like a security nightmare.
The difference between Static Cards and a Timeline Item were large enough that the team, apparently, removed Static Cards until they could make the two of them work much more similarly. What you're trying to do is a commonly requested, and it does make sense that both should work mostly the same way.
You're on the right track for how to handle this at the moment - use the Mirror API to get it into the timeline as a Timeline Item. As you've noticed, you can't go through the auth flow since the user is unable to authenticate through Glass directly.
While you're testing, you can code in an auth token and a refresh token to be provided to the library to do this. For production through MyGlass, take a look at the auth flow that is available at https://developers.google.com/glass/develop/gdk/authentication
I need my locally-installed, thick-client application (Qt / C++) to generate a ready-to-be-sent email message on the client's machine:
This message must contain the contents of a relatively small (15K - 200K) binary file.
Many of my users will be disconnected at the time this message is generated, so it is possible the email will need to sit in the outbox until a later time.
This application will run on Windows, Mac OS X, and various Linux distros (official support for Ubuntu/Debian and Fedora), and there is no requirement that specific email clients need to be installed.
I have already tried:
Opening a mailto: link using QDesktopServices::openUrl() with the attach (or attachment) parameter. But those parameters are not officially part of the protocol, and some clients (notably Outlook) ignore them.
Encoding the file using Base64 and adding it as part of the body parameter of a mailto: link. But the length of the mailto link is truncated by some email clients (again, notably Outlook) so this will not work.
Google Picasa achieves this (at least, on Windows; haven't checked other OS's) when you send pictures from within the application. It creates a message with the attachments and some pre-filled text. You can then edit the message and send at your convenience. Any ideas how they are doing this?
You could create an .eml file and open it which should give you the effect you want as long as there is any email client registered in the system to handle files with this extension. I'm sure this is not as universal as the mailto: scheme but if mailto: does not work for you I think this could be the second best option to try.
From http://www.coolutils.com/Formats/EML
Since EML files are created to comply
with the industry RFC 822 standard,
they can be used with most e-mail
clients, servers and applications.
Besides the Microsoft Outlook Express,
EML files can be opened using most
e-mail clients, such as Microsoft
Outlook, Microsoft Entourage, Mozilla
Thunderbird, Apple Mail, and
IncrediMail.
Side note
When I click 'E-mail' in Picasa I get dialog where I can choose which application (Thunderbird or Google Mail) I want to send email with. This means Picasa knows specific email client being used to send email and can use custom method, specific to chosen email client, to send email. This is of course just speculation but it might be that Picasa makes user to choose email client because there's no generic way to do what you ask about.
I dont think you are using the correct approach ; use MAPI / C++. I have done this several times both in Outlook / Thunderbird using MAPI/ C++ . You can choose the default email client by querying the registry ; I think thats what all applications do.
Also see the link here http://lists.trolltech.com/qt-interest/2006-02/thread00861-0.html
Some time ago I've began to write a small library for opening the 'default email client' in a platform independent way. It still may need some work, but you can use it as a base if you want: https://github.com/picaschaf/qt-email