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

Add support for variables in the caption argument #115

Closed
tissole opened this issue May 2, 2021 · 6 comments
Closed

Add support for variables in the caption argument #115

tissole opened this issue May 2, 2021 · 6 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@tissole
Copy link

tissole commented May 2, 2021

How do I imagine this enhancement? Let's say we have a folder called Photos 2020 and inside are subfolders named 1. January, 2. February, 3. March ...12. December. The app detects the name of the root folder (Photos 2020) and creates a text message with that name in the destination channel before starting uploading files.

Then go recursively and takes the name of the first subfolder and creates again a text message, then start uploading files from that folder (1. January), then creates a message with the name of the second subfolder (2. February) before uploading files from that folder, and so on till the last folder.

Now all the uploaded files have a logical structure that mimics the folder hierarchy.
Photos 2020

  1. January
    Photo 1
    Photo 2
    Photo 3
  2. February
    Photo 1
    Photo 2
    ..
  3. December
    Photo 1
    Photo 2

Can this be done?

@Nekmo
Copy link
Owner

Nekmo commented Jun 1, 2021

It can be interesting although it solves a very specific problem. Perhaps it can be done in a more useful way for other cases.

@tissole
Copy link
Author

tissole commented Jun 3, 2021

Yeah, is not the most elegant solution :). I only mention it because I thought that Telegram can't be used with folders, but then I found these bots @FilesToCloudBot, @cloudy_files_bot, @foldersbot, @tenvsten_bot, @FilesToCloudBot. The implementation is rather crude but it can be done.

If folder structure can be replicated it could be very useful, for example for book collections, courses, and music collections. Now if all songs are organized in folders by artist and album name on PC, when uploaded to Telegram that order is lost, a user can't search by artist name doesn't know from which album the song is. Very cumbersome.

@Yury-MonZon
Copy link

+1 to that!

@tissole
Copy link
Author

tissole commented Sep 17, 2021

Now if all songs are organized in folders by artist and album name on PC, when uploaded to Telegram that order is lost, a user can't search by artist name doesn't know from which album the song is.

At that time that batch of songs was untagged. Testing with a better source has given better results because of hachoir, but I also encounter problems with propper tagging.

I found an implementation that has resolved the issue with preserving folder structure while uploading. It works backward too, when users choose to download files from TG, uploaded with that specific program, the folder structure is remade, all files are put in their folder/subfolder structure. This is the project:

https://github.com/khrj/teledrive
https://teledrive.khushrajrathod.com

Unfortunately, the program seems broken on Windows and the development has ended. The idea that makes it possible to maintain the folder hierarchy is to caption the files with path, like this

folder1/subfolder1/file1
folder1/subfolder1/file2
folder1/subfolder1/file...

folder1/subfolder2/file1
folder1/subfolder2/file2
...

folder2/subfolder1/file1
folder2/subfolder1/file2
...
This structure, along with the file hashes is retained in a JSON file that is uploaded in Saved Messages. This file is updated when files are uploaded and based on hashes prevents duplicate files to be uploaded. It is also used when downloading to remake the folder structure.

Hope it helps!

@Nekmo Nekmo self-assigned this Jun 15, 2023
@Nekmo Nekmo added this to the v0.7.0 milestone Jun 15, 2023
@Nekmo Nekmo added the enhancement New feature or request label Jun 15, 2023
@Nekmo
Copy link
Owner

Nekmo commented Jun 29, 2023

The following caption variables are supported:
https://github.com/Nekmo/telegram-upload/blob/issue-115/docs/caption_format.rst

@Nekmo Nekmo changed the title Feature request - Mimic the folder structure when uploading files Add support for variables in the caption argument Jun 29, 2023
Nekmo added a commit that referenced this issue Jun 29, 2023
Nekmo added a commit that referenced this issue Jun 29, 2023
Nekmo added a commit that referenced this issue Jun 29, 2023
Nekmo added a commit that referenced this issue Jun 29, 2023
Nekmo added a commit that referenced this issue Jun 29, 2023
@Nekmo Nekmo closed this as completed Jun 29, 2023
@Nekmo
Copy link
Owner

Nekmo commented Jun 29, 2023

Fixed in version v0.7.0. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants