Skip to content

feat: implement downloading specific threads from channels (#542)#545

Open
Dineshkarthik wants to merge 11 commits into
masterfrom
feature/542-download-specific-threads
Open

feat: implement downloading specific threads from channels (#542)#545
Dineshkarthik wants to merge 11 commits into
masterfrom
feature/542-download-specific-threads

Conversation

@Dineshkarthik

Copy link
Copy Markdown
Owner

Description

This pull request implements the requested feature to download specific threads from Telegram channels as described in Issue #542.

Changes

  • Configuration updated: Added an optional threads array parameter directly into config.yaml.example under the chat configuration layout to explicitly state a list of thread IDs to process per chat.
  • Message Iterator Rewritten: Created get_messages_iter() within media_downloader.py allowing iterating over Telegram messages and seamlessly looping the telethon client's existing iter_messages function utilizing reply_to=thread_id parameters natively if the user has opted to use the threads list configuration. Falls back completely to traditional behavior otherwise.
  • Web Interface Upgrade: Incorporated a visual configuration text box enabling inserting threads conveniently via the advanced overrides option without interacting with complex file configuration for end users.
  • Tests Added: Wrote test mock structures that simulate iterative reply_to fetching via unittest utilizing explicit event loops to provide assertions tracking how the logic behaves directly within the downloader script independently.

- Added `threads` configuration option in `config.yaml.example` and parsing logic for it.
- Refactored `media_downloader.py` to spawn message iterators that hook into Telethon's `iter_messages` using `reply_to` if threads are specified.
- Added input for Threads in the chat configuration section of `webui/config_tab.py`
- Added unit tests to verify optional threads fallback and iteration behavior.
@Dineshkarthik
Dineshkarthik force-pushed the feature/542-download-specific-threads branch from a1844eb to d0415e2 Compare February 24, 2026 22:23
@codecov

codecov Bot commented Feb 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.24%. Comparing base (0984153) to head (b71dfc1).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
media_downloader.py 79.48% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #545      +/-   ##
==========================================
- Coverage   95.45%   94.24%   -1.22%     
==========================================
  Files           8        8              
  Lines         484      521      +37     
==========================================
+ Hits          462      491      +29     
- Misses         22       30       +8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant