Skip to content

Commit

Permalink
colored term output
Browse files Browse the repository at this point in the history
also added requirements.txt to manage pip requirements
  • Loading branch information
architdate committed Apr 27, 2020
1 parent 850b239 commit 4a067dc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,32 @@ The tool requires the `'https://www.googleapis.com/auth/drive'` scope as of now.
- Save the `credentials.json` file in the same directory as `drivedl.py`
- Install the Drive API for python by running the following command:
```bash
$ pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib tqdm
$ pip install --r requirements.txt
```

## Usage:

```bash
$ python drivedl.py <folder_id> <path_to_save>
$ python drivedl.py <folder_id / file_id> <path_to_save>
```

It is as straightforward as that!

Note that on the first run, you will have to authorize the scope of the application. This is pretty straightforward as well!

## Default Path [Optional]

```bash
$ python drivedl.py --path <default_path>
```

This lets you specify a default path for your download location.

## TODO:

- [x] Add URL parsing
- [x] Add default path
- [x] Single file download support
- [x] Color support
- [ ] Possible GUI?
- [ ] Search functionality
3 changes: 2 additions & 1 deletion drivedl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pickle, util, sys, tqdm, time, json
import os.path
from multiprocessing import Pool
from colorama import Fore, Style
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
Expand Down Expand Up @@ -83,7 +84,7 @@ def download_helper(args):
pbar = tqdm.tqdm(p.imap(download_helper, file_dest), total=len(file_dest))
start = time.time()
for i in pbar:
pbar.write(f'Downloaded: [Time: {str(int(time.time() - start))}s]\t{i}')
pbar.write(f'{Fore.GREEN}Downloaded:{Style.RESET_ALL} {Fore.BLUE}[Time: {str(int(time.time() - start))}s]{Style.RESET_ALL}\t{i}')
p.close()
p.join()
except ImportError:
Expand Down
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
google-api-python-client
google-auth-httplib2
google-auth-oauthlib
tqdm
colorama

0 comments on commit 4a067dc

Please sign in to comment.