Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what is inputFileGenerated? #126

Closed
sajjad-ser opened this issue Mar 5, 2018 · 8 comments

Comments

Projects
None yet
4 participants
@sajjad-ser
Copy link

commented Mar 5, 2018

hi every one what is what is inputFileGenerated and what's it usage?

@levlam

This comment has been minimized.

Copy link
Contributor

commented Mar 5, 2018

It should be used whenever not yet existed file needs to be sent. For example,

  1. A compressed photo, generated from an existing one.
  2. A compressed video, generated from an existing one.
  3. A file, which first needs to be downloaded from an HTTP URL.
  4. A currently recording voice/video note.
  5. A file outside library cache that needs to be copied and stored in the cache.

To achieve that the client specifies two pretty arbitrary strings original_path and conversion and should be able to generate the file based on value of these parameters whenever it receives updateFileGenerationStart.

For example, a client can use for the mentioned cases:

  1. Path to the original photo as original_path and "compress_photo" as conversion.
  2. Path to the original video as original_path and "compress_video" as conversion.
  3. URL of the file as original_path and "download" as conversion.
  4. ".ogg" as original_path and "record_voice" as conversion.
  5. Path to the original file as original_path and "copy" as conversion.

There are a lot of more complex cases when inputFileGenerated can be used. Basically all cases except sending a local/already sent file should be covered by inputFileGenerated.

@sajjad-ser

This comment has been minimized.

Copy link
Author

commented Mar 6, 2018

tanks

@sajjad-ser sajjad-ser closed this Mar 6, 2018

@blacksailer

This comment has been minimized.

Copy link

commented Mar 11, 2019

is there any list of conversions? Or should dev implement each?

@levlam

This comment has been minimized.

Copy link
Contributor

commented Mar 11, 2019

There is no built-in conversions except "#url#" used for files, which need to de downloaded from an HTTP/HTTPS URL. But even that conversion needs to be handled and implemented by the client.

Also, all conversions beginning with '#' are reserved for internal TDLib usage.

@blacksailer

This comment has been minimized.

Copy link

commented Mar 11, 2019

How to register conversion so tdlib can know which method to call?

@blacksailer

This comment has been minimized.

Copy link

commented Mar 11, 2019

Should I use updateFileGenerationStart and updateFileGenerationStop as wrapper?

@FrayxRulez

This comment has been minimized.

Copy link

commented Mar 11, 2019

You must handle updateFileGenerationStart and updateFileGenerationStop updates from TDLib, and then provide progress about the generation using setFileGenerationProgress and finishFileGeneration.

@levlam

This comment has been minimized.

Copy link
Contributor

commented May 1, 2019

Since TDLib 1.4.0 you can also use the method writeGeneratedFilePart if you have no direct access to TDLib's file system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.