patch d6b83b6ed9dfd2c1692e79da8b54046f96e059f5 Author: E. Bosch Date: Tue Jun 6 00:09:40 CEST 2023 * telegram: Add "media_dir" option to set the download media directory outside of "config_dir" that didn't make sense, but keep it for compatibility if "media_dir" is not set diff -rN -u old-irgramd/irgramd new-irgramd/irgramd --- old-irgramd/irgramd 2024-11-22 20:41:56.332003957 +0100 +++ new-irgramd/irgramd 2024-11-22 20:41:56.336003951 +0100 @@ -78,6 +78,7 @@ tornado.options.define('irc_nicks', type=str, multiple=True, metavar='nick,..', help='List of nicks allowed for IRC, if `pam` and optionally `pam_group` are set, PAM authentication will be used instead') tornado.options.define('irc_password', default='', metavar='PASSWORD', help='Password for IRC authentication, if `pam` is set, PAM authentication will be used instead') tornado.options.define('irc_port', type=int, default=None, metavar='PORT', help='Port to listen on for IRC. (default 6667, default with TLS 6697)') + tornado.options.define('media_dir', default=None, metavar='PATH', help='Directory where Telegram media files are downloaded, default "media" in `config_dir`') tornado.options.define('media_url', default=None, metavar='BASE_URL', help='Base URL for media files, should be configured in the external (to irgramd) webserver') tornado.options.define('pam', default=False, help='Use PAM for IRC authentication, if not set you should set `irc_password`') tornado.options.define('pam_group', default=None, metavar='GROUP', help='Unix group allowed if `pam` enabled, if empty any user is allowed') diff -rN -u old-irgramd/telegram.py new-irgramd/telegram.py --- old-irgramd/telegram.py 2024-11-22 20:41:56.336003951 +0100 +++ new-irgramd/telegram.py 2024-11-22 20:41:56.336003951 +0100 @@ -38,6 +38,7 @@ def __init__(self, irc, settings): self.logger = logging.getLogger() self.config_dir = settings['config_dir'] + self.media_dir = settings['media_dir'] self.media_url = settings['media_url'] self.api_id = settings['api_id'] self.api_hash = settings['api_hash'] @@ -67,7 +68,7 @@ async def initialize_telegram(self): # Setup media folder - self.telegram_media_dir = os.path.join(self.config_dir, 'media') + self.telegram_media_dir = self.media_dir or os.path.join(self.config_dir, 'media') if not os.path.exists(self.telegram_media_dir): os.makedirs(self.telegram_media_dir)