diff --git a/gfile/cmd.py b/gfile/cmd.py index 8932710..4e36b67 100644 --- a/gfile/cmd.py +++ b/gfile/cmd.py @@ -23,6 +23,7 @@ def main(): parser.add_argument('-m', '--copy-size', dest='chunk_copy_size', default="1MB", help='specifies size to copy the main file into pieces [default: 1MB]') parser.add_argument('-t', '--timeout', type=int, default=10, help='specifies timeout time (in seconds) [default: 10]') parser.add_argument('-k', '--key', '--password', dest='key', default=None, help='specifies the key/password for the file') + parser.add_argument('--mute', action='store_true', help='mute warnings') args = parser.parse_args() diff --git a/gfile/gfile.py b/gfile/gfile.py index 32cf980..598df5f 100644 --- a/gfile/gfile.py +++ b/gfile/gfile.py @@ -80,7 +80,8 @@ def split_file(input_file, out, target_size=None, start=0, chunk_copy_size=1024* class GFile: - def __init__(self, uri, progress=False, thread_num=4, chunk_size=1024*1024*10, chunk_copy_size=1024*1024, timeout=10, aria2=False, key=None, **kwargs) -> None: + def __init__(self, uri, progress=False, thread_num=4, chunk_size=1024*1024*10, chunk_copy_size=1024*1024, timeout=10, + aria2=False, key=None, mute=False, **kwargs) -> None: self.uri = uri self.chunk_size = size_str_to_bytes(chunk_size) self.chunk_copy_size = size_str_to_bytes(chunk_copy_size) @@ -94,6 +95,7 @@ def __init__(self, uri, progress=False, thread_num=4, chunk_size=1024*1024*10, c self.cookies = None self.current_chunk = 0 self.aria2 = aria2 + self.mute = mute self.key = key @@ -146,8 +148,9 @@ def gen(): streamer = StreamingIterator(size, gen()) resp = self.session.post(f"https://{self.server}/upload_chunk.php", data=streamer, headers=headers) except Exception as ex: - print(ex) - print('Retrying...') + if not self.mute: + print(ex) + print('Retrying...') else: break