A clearer top-to-bottom step flow showing exactly how CM content becomes Telegram-stored files and then gets sent to users later by saved file IDs.
One box per step, top to bottom, connected clearly so the whole upload and delivery process is easy to follow.
The system reads titles, episodes, and raw source links from CM, while keeping auth valid with JWT refresh handling.
The importer cleans the data, infers quality when needed, and preserves all fallback links instead of keeping only one source.
CM_M000321_1080P.The cleaned content becomes structured DB rows. One upload target becomes one queue row, and all source alternatives are linked to it.
titles / episodesNormalized content entities.source_linksAll CM fallback links with source details.upload_variantsMain work queue for upload targets.Workers on 3 VPSes claim upload jobs. Each VPS uses one premium Telegram account so retries, failures, and FloodWait behavior stay isolated.
The worker decides whether a file can go straight to Telegram or must be downloaded and processed first for remuxing, probing, or splitting.
The file is stored in private Telegram channels using coded names only. Content is distributed across many channels rather than one big channel.
After upload, the system writes back the final Telegram message ID, file ID, part mapping, and channel/account location for later delivery.
telegram_file_idMain key the bot will use later.part_no and part_count for split files.Users interact with a proper movie service interface instead of the storage channels. They search, browse, and choose what they want.
The API finds the selected content row, chooses the correct uploaded variant, and resolves it to the Telegram file object saved earlier.
telegram_file_id rows.The bot sends the movie or episode using the saved Telegram file ID, so no re-download and no re-upload are needed during delivery.
The key idea is simple: queue uploads first, then save the Telegram file IDs for fast later delivery.
| Table | Purpose |
|---|---|
titles / episodes | Stores normalized CM content metadata |
source_links | Stores all fallback CM source links |
upload_variants | Main queue, one row per target upload |
variant_sources | Maps upload variants to retry-order fallback links |
telegram_objects | Stores final Telegram file IDs and multipart mapping |
upload_attempts | Stores retry, failure, remux, split, and success history |
The upload system should follow the same reliability model as your Drive pipeline, one premium account per VPS.
| VPS | Worker | Telegram account | Role |
|---|---|---|---|
| Main VPS | cm-ember | Ember premium | Main worker, DB host, future dashboard |
| Worker A | cm-rora | Rora premium | Assigned upload worker |
| Worker B | cm-lukas | Lukas premium | Assigned upload worker |