Aeon icon indicating copy to clipboard operation
Aeon copied to clipboard

Beta

Open 5hojib opened this issue 1 month ago • 2 comments

Summary by Sourcery

Introduce a new NAME_PREFIX feature to allow custom filename prefixes throughout the download and upload pipeline, remove the deprecated LEECH_FILENAME_PREFIX setting, implement prefix application logic, and integrate an InstagramResolver for video downloads via InstaDL API.

New Features:

  • Add NAME_PREFIX option to prefix leeched/downloaded file names via UI, config, and CLI (-np)
  • Integrate InstagramResolver with TrueLinkResolver for downloading Instagram videos using external InstaDL API

Enhancements:

  • Rename and remove legacy LEECH_FILENAME_PREFIX usage in code, replacing with NAME_PREFIX
  • Implement proceed_name_prefix method to apply filename prefixes in TaskListener download flow
  • Register InstagramResolver during startup

Documentation:

  • Update configuration docs and config_sample to replace LEECH_FILENAME_PREFIX with NAME_PREFIX
  • Revise help messages to reference NAME_PREFIX instead of LEECH_FILENAME_PREFIX

5hojib avatar Oct 21 '25 15:10 5hojib

Reviewer's Guide

This PR introduces a unified NAME_PREFIX feature to replace the old LEECH_FILENAME_PREFIX, implements logic to apply that prefix to downloaded and leeched files, cleans up legacy prefix code in the uploader, and integrates an Instagram resolver into the TrueLink framework.

Sequence diagram for applying NAME_PREFIX during file processing

sequenceDiagram
participant Listener
participant HelperCommon
participant TaskListener
participant FileSystem

Listener->>HelperCommon: Set name_prefix from user_dict or Config
TaskListener->>HelperCommon: Call proceed_name_prefix(dl_path)
HelperCommon->>FileSystem: Rename file(s) with name_prefix if needed
FileSystem-->>HelperCommon: Return new path
HelperCommon-->>TaskListener: Return updated path

Class diagram for NAME_PREFIX unification and InstagramResolver addition

classDiagram
class Config {
  JD_PASS: str
  IS_TEAM_DRIVE: bool
  LEECH_DUMP_CHAT: list[str]
  LEECH_SPLIT_SIZE: int
  MEDIA_GROUP: bool
  HYBRID_LEECH: bool
  INSTADL_API: str
  HEROKU_APP_NAME: str
  HEROKU_API_KEY: str
  NAME_PREFIX: str
  _convert(key, value)
}
class InstagramResolver {
  DOMAINS: list[str]
  resolve(url: str): LinkResult | FolderResult
}
Config <|-- InstagramResolver: uses

Class diagram for removal of LEECH_FILENAME_PREFIX and related uploader changes

classDiagram
class TelegramUploader {
  _media_dict: dict
  _last_msg_in_group: bool
  _up_path: str
  _user_dump: str
  _lcaption: str
  _media_group: bool
  _nprefix: str
  _user_settings()
  _prepare_file(file_, dirpath)
}

File-Level Changes

Change Details Files
Deprecate LEECH_FILENAME_PREFIX in favor of NAME_PREFIX
  • Removed all references to LEECH_FILENAME_PREFIX
  • Added NAME_PREFIX to Config, sample config, and documentation
  • Updated help messages and user settings menu to reflect NAME_PREFIX
  • Extended mirror_leech and ytdlp modules to accept -np CLI argument
bot/core/config_manager.py
config_sample.py
docs/CONFIGURATIONS.md
bot/helper/ext_utils/help_messages.py
bot/modules/users_settings.py
bot/modules/mirror_leech.py
bot/modules/ytdlp.py
bot/helper/mirror_leech_utils/telegram_uploader.py
Initialize and resolve name_prefix in common listener
  • Added name_prefix attribute in initializer
  • Resolved NAME_PREFIX from user_dict or Config in before_start
bot/helper/common.py
Implement proceed_name_prefix routine and invoke on download complete
  • Added proceed_name_prefix method to rename files/directories with prefix
  • Called proceed_name_prefix in task_listener after download
  • Recomputed is_file and name after renaming
bot/helper/common.py
bot/helper/listeners/task_listener.py
Clean up legacy prefix logic in TelegramUploader
  • Removed _lprefix attribute and related renaming code
  • Replaced prefix logic with new _nprefix resolution
bot/helper/mirror_leech_utils/telegram_uploader.py
Integrate InstagramResolver into TrueLink
  • Imported and registered InstagramResolver with TrueLinkResolver
  • Added new insta_resolver implementing BaseResolver for Instagram API
bot/core/startup.py
bot/helper/mirror_leech_utils/download_utils/insta_resolver.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it. You can also reply to a review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment @sourcery-ai summary on the pull request to (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar Oct 21 '25 15:10 sourcery-ai[bot]

Summary of Changes

Hello @5hojib, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new capability for the bot to download content directly from Instagram by leveraging an external InstaDL API. Alongside this new feature, it undertakes a significant refactoring of the file naming prefix functionality, transitioning from LEECH_FILENAME_PREFIX to a more generalized NAME_PREFIX. This change centralizes the logic for applying prefixes to downloaded files and directories, ensuring a more robust and consistent naming convention across various operations.

Highlights

  • Instagram Downloader Integration: Added support for downloading content from Instagram by integrating with an external InstaDL API, enabling the bot to resolve and fetch Instagram media.
  • Filename Prefix Refactoring: The LEECH_FILENAME_PREFIX setting has been renamed to NAME_PREFIX and its implementation has been refactored for more consistent application across all downloaded files and directories.
  • Centralized Prefix Application: A new proceed_name_prefix method was introduced to handle the renaming of files and folders by applying the configured NAME_PREFIX after download completion.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

[^1]: Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

gemini-code-assist[bot] avatar Oct 21 '25 15:10 gemini-code-assist[bot]