telegram-upload icon indicating copy to clipboard operation
telegram-upload copied to clipboard

Feature request - Mimic the folder structure when uploading files

Open tissole opened this issue 3 years ago • 4 comments

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?

tissole avatar May 02 '21 14:05 tissole

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

Nekmo avatar Jun 01 '21 22:06 Nekmo

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.

tissole avatar Jun 03 '21 11:06 tissole

+1 to that!

Yury-MonZon avatar Sep 12 '21 21:09 Yury-MonZon

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!

tissole avatar Sep 17 '21 17:09 tissole

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

Nekmo avatar Jun 29 '23 01:06 Nekmo

Fixed in version v0.7.0. Thanks!

Nekmo avatar Jun 29 '23 16:06 Nekmo