Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""LICENSE
2Copyright 2016 Hermann Krumrey <hermann@krumreyh.com>
4This file is part of xdcc-dl.
6xdcc-dl is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
11xdcc-dl is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
16You should have received a copy of the GNU General Public License
17along with xdcc-dl. If not, see <http://www.gnu.org/licenses/>.
18LICENSE"""
20from typing import List, Optional, Union
21from xdcc_dl.entities.XDCCPack import XDCCPack
22from xdcc_dl.xdcc.XDCCClient import XDCCClient
25def download_packs(
26 packs: List[XDCCPack],
27 timeout: int = 120,
28 fallback_channel: Optional[str] = None,
29 throttle: Union[int, str] = -1,
30 wait_time: int = 0,
31 username: Optional[str] = None,
32 channel_join_delay: Optional[int] = None
33):
34 """
35 Downloads a list of XDCC Packs
36 :param packs: The packs to download
37 :param timeout: Specifies timeout time
38 :param fallback_channel: A fallback channel for when no channels were found
39 :param throttle: Throttles the download to n bytes per second.
40 If this value is <= 0, the download speed will be
41 unlimited
42 :param wait_time: Waits for the specified amount of time before sending
43 a message
44 :param username: The username to use. If not specified, will use a random
45 one.
46 :param channel_join_delay: Delays the joining of channels by a set amount
47 of seconds. If not specified, the bot will wait
48 a random amount of time
49 :return: None
50 """
51 for pack in packs:
52 client = XDCCClient(
53 pack,
54 timeout=timeout,
55 fallback_channel=fallback_channel,
56 throttle=throttle,
57 wait_time=wait_time,
58 username="" if username is None else username,
59 channel_join_delay=channel_join_delay
60 )
61 client.download()