task/management/commands/runtransfer.py
Similar blocks of code found in 3 locations. Consider refactoring.import loggingSimilar blocks of code found in 3 locations. Consider refactoring.from time import sleepSimilar blocks of code found in 3 locations. Consider refactoring. Similar blocks of code found in 3 locations. Consider refactoring.from django.conf import settingsSimilar blocks of code found in 3 locations. Consider refactoring.from django.core.management.base import BaseCommandSimilar blocks of code found in 3 locations. Consider refactoring. Similar blocks of code found in 3 locations. Consider refactoring.from task.baidupcs import get_baidupcs_clientSimilar blocks of code found in 3 locations. Consider refactoring.from task.leecher import transferSimilar blocks of code found in 3 locations. Consider refactoring.from task.models import TaskSimilar blocks of code found in 3 locations. Consider refactoring. Similar blocks of code found in 3 locations. Consider refactoring.logger = logging.getLogger("runtransfer")Similar blocks of code found in 3 locations. Consider refactoring. Similar blocks of code found in 3 locations. Consider refactoring. Similar blocks of code found in 3 locations. Consider refactoring.class Command(BaseCommand):Similar blocks of code found in 3 locations. Consider refactoring. help = "save shared link to Baidu Pan"Similar blocks of code found in 3 locations. Consider refactoring. Similar blocks of code found in 3 locations. Consider refactoring. def add_arguments(self, parser):Similar blocks of code found in 3 locations. Consider refactoring. parser.add_argument(Similar blocks of code found in 3 locations. Consider refactoring. "--once",Similar blocks of code found in 3 locations. Consider refactoring. action="store_true",Similar blocks of code found in 3 locations. Consider refactoring. help="run transfer for exists tasks and exit immediately.",Similar blocks of code found in 3 locations. Consider refactoring. )Similar blocks of code found in 3 locations. Consider refactoring. Similar blocks of code found in 3 locations. Consider refactoring. def handle(self, *args, **options):Similar blocks of code found in 3 locations. Consider refactoring. logger.info("transfer started.")Similar blocks of code found in 3 locations. Consider refactoring. client = get_baidupcs_client()Similar blocks of code found in 3 locations. Consider refactoring. while True:Similar blocks of code found in 3 locations. Consider refactoring. for task in Task.filter_ready_to_transfer():Similar blocks of code found in 3 locations. Consider refactoring. transfer(client, task)Similar blocks of code found in 3 locations. Consider refactoring. Similar blocks of code found in 3 locations. Consider refactoring. if options["once"]:Similar blocks of code found in 3 locations. Consider refactoring. returnSimilar blocks of code found in 3 locations. Consider refactoring. sleep(settings.RUNNER_SLEEP_SECONDS)