seedsync icon indicating copy to clipboard operation
seedsync copied to clipboard

[Cheated] set permissions for file downloaded

Open devildant opened this issue 1 year ago • 0 comments

Hello,

I modified the local scan python script to force the permissions of the download directory periodically.

here is the file:

# Copyright 2017, Inderpreet Singh, All rights reserved.

import logging
from typing import List

from .scanner_process import IScanner, ScannerError
from common import overrides, Localization, Constants
from system import SystemScanner, SystemFile, SystemScannerError
import os


class LocalScanner(IScanner):
    """
    Scanner implementation to scan the local filesystem
    """
    def __init__(self, local_path: str, use_temp_file: bool):
        self.__scanner = SystemScanner(local_path)
        if use_temp_file:
            self.__scanner.set_lftp_temp_suffix(Constants.LFTP_TEMP_FILE_SUFFIX)
        self.logger = logging.getLogger("LocalScanner")

    @overrides(IScanner)
    def set_base_logger(self, base_logger: logging.Logger):
        self.logger = base_logger.getChild("LocalScanner")

    @overrides(IScanner)
    def scan(self) -> List[SystemFile]:
        try:
            os.system('chmod 777 -R /downloads/*')
            result = self.__scanner.scan()
        except SystemScannerError:
            self.logger.exception("Caught SystemScannerError")
            raise ScannerError(Localization.Error.LOCAL_SERVER_SCAN, recoverable=False)
        return result

you can change and put the permission you want (here 777)

once your file is created (with the right permissions and the right user on your main machine) simply mount it via docker on the link:

/app/python/controller/scan/local_scanner.py

permissions will be updated with each local scan, for frequency go to seedsync settings

devildant avatar Mar 22 '24 18:03 devildant