# Bunkrr Uploader
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/BunkrrUploader) ![PyPI - Version](https://img.shields.io/pypi/v/BunkrrUploader)
A python script to upload files or directories to Bunkrro
Built using `asyncio`, `aiohttp`, and `tqdm`
## Supports
- Bunkrr accounts
- TODO: Private and public directory uploads
- Parallel uploads
- Retries
- Progress bars
- TODO: Upload logging
- TODO: Skipping duplicate uploads
## Usage
1. `pip install BunkrrUploader`
```
usage: bunkrr-upload [-h] [-t TOKEN] [-z {na,eu}] [-f FOLDER] [-d]
[--debug-save-js-locally | --no-debug-save-js-locally]
[-c CONNECTIONS] [--public | --no-public]
[--save | --no-save] [--use-config | --no-use-config]
[-r RETRIES]
file
Bunkrro Uploader supporting parallel uploads
positional arguments:
file File or directory to look for files in to upload
options:
-h, --help show this help message and exit
-t TOKEN, --token TOKEN
API token for your account so that you can upload to a
specific account/folder. You can also set the
GOFILE_TOKEN environment variable for this
-z {na,eu}, --zone {na,eu}
Server zone to prefer uploading to
-f FOLDER, --folder FOLDER
Folder to upload files to overriding the directory
name if used
-d, --dry-run Don't create folders or upload files
--debug-save-js-locally, --no-debug-save-js-locally
Debug option to save the retrieved js file locally
-c CONNECTIONS, --connections CONNECTIONS
Maximum parallel uploads to do at once
--public, --no-public
Make all files uploaded public. By default they are
private and not unsharable
--save, --no-save Don't save uploaded file urls to a
"bunkrr_upload_<unixtime>.csv" file
--use-config, --no-use-config
Whether to create and use a config file in
$HOME/.config/bunkrr_upload/config.json
-r RETRIES, --retries RETRIES
How many times to retry a failed upload
```
## Details
### Duplicate Files
If you try to upload a file and it already exists then the upload will be skipped. This comparison is based on MD5 sums,
This check is based on the account being used. You can upload the same file twice to an account if different directories were specified.
### History
Configs are stored in `$HOME/.config/bunkrr_upload/config.json` and all successful uploads and md5 sum hashes will be saved in there.
Each time you complete an upload a `bunkrr_upload_<timestamp>.csv` will be created with the items uploaded and the following metadata:
`filePath,filePathMD5,fileNameMD5,uploadSuccess,code,downloadPage,fileId,fileName,guestToken,md5,parentFolder`
## Examples
Given
```
directory/
├── sample2.mkv
└── sample.mkv
```
**Upload single file anonymously**
`bunkrr-upload directory/sample.mkv`
**Upload single file to your account**
`bunkrr-upload --token 123 foo directory/sample.mkv`
**Upload single file to directory `foo` in your account**
`bunkrr-upload --token 123 --folder foo directory/sample.mkv`
**Upload directory to your account**
`bunkrr-upload --token 123 directory`
**Upload directory to directory `foo` in your account**
`bunkrr-upload --token 123 --folder foo directory`
# Development
## Optional Prerequesites
- tk `sudo pacman -S base-devel tk`
- [pyenv](https://github.com/pyenv/pyenv?tab=readme-ov-file#set-up-your-shell-environment-for-pyenv)
- [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv?tab=readme-ov-file#installing-as-a-pyenv-plugin)
```bash
pyenv install 3.9
```
## Setup
```bash
pip install -r requirements-dev.txt
pre-commit install
```
## Packaging
```bash
python3 -m build
python3 -m twine upload --skip-existing --repository pypi dist/*
```
# Improvements Wishlist
- [ ] Update README
- [ ] Make it work
- [ ] Add file zipping and cleanup
- [ ] Add tests
- [ ] Add github runners for tests
- [ ] Recursive directory upload support
# Thanks
- https://stackoverflow.com/questions/68690141/how-to-show-progress-on-aiohttp-post-with-both-form-data-and-file
- https://github.com/londarks/Unofficial-bunkrr.io-API-Documentation
- https://github.com/Samridh212/File_Uploader_goFile
- https://github.com/rkwyu/bunkrr-dl
- https://stackoverflow.com/questions/1131220/get-the-md5-hash-of-big-files-in-python
- https://packaging.python.org/en/latest/tutorials/packaging-projects/
- https://json2pyi.pages.dev/
Raw data
{
"_id": null,
"home_page": null,
"name": "BunkrrUploader",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "Alex Mi <alexmi3.14@gmail.com>",
"keywords": "bunkrr, upload, storage, parallel",
"author": null,
"author_email": "Alex Mi <alexmi3.14@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/b6/13/4467e99af4cdac7b8eaf4b2ba591f5a90f1744cc273b5e05d40db834d104/bunkrruploader-0.10.7.tar.gz",
"platform": null,
"description": "# Bunkrr Uploader\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/BunkrrUploader) ![PyPI - Version](https://img.shields.io/pypi/v/BunkrrUploader)\n\nA python script to upload files or directories to Bunkrro\nBuilt using `asyncio`, `aiohttp`, and `tqdm`\n\n## Supports\n- Bunkrr accounts\n- TODO: Private and public directory uploads\n- Parallel uploads\n- Retries\n- Progress bars\n- TODO: Upload logging\n- TODO: Skipping duplicate uploads\n\n## Usage\n1. `pip install BunkrrUploader`\n\n```\nusage: bunkrr-upload [-h] [-t TOKEN] [-z {na,eu}] [-f FOLDER] [-d]\n [--debug-save-js-locally | --no-debug-save-js-locally]\n [-c CONNECTIONS] [--public | --no-public]\n [--save | --no-save] [--use-config | --no-use-config]\n [-r RETRIES]\n file\n\nBunkrro Uploader supporting parallel uploads\n\npositional arguments:\n file File or directory to look for files in to upload\n\noptions:\n -h, --help show this help message and exit\n -t TOKEN, --token TOKEN\n API token for your account so that you can upload to a\n specific account/folder. You can also set the\n GOFILE_TOKEN environment variable for this\n -z {na,eu}, --zone {na,eu}\n Server zone to prefer uploading to\n -f FOLDER, --folder FOLDER\n Folder to upload files to overriding the directory\n name if used\n -d, --dry-run Don't create folders or upload files\n --debug-save-js-locally, --no-debug-save-js-locally\n Debug option to save the retrieved js file locally\n -c CONNECTIONS, --connections CONNECTIONS\n Maximum parallel uploads to do at once\n --public, --no-public\n Make all files uploaded public. By default they are\n private and not unsharable\n --save, --no-save Don't save uploaded file urls to a\n \"bunkrr_upload_<unixtime>.csv\" file\n --use-config, --no-use-config\n Whether to create and use a config file in\n $HOME/.config/bunkrr_upload/config.json\n -r RETRIES, --retries RETRIES\n How many times to retry a failed upload\n\n```\n## Details\n### Duplicate Files\nIf you try to upload a file and it already exists then the upload will be skipped. This comparison is based on MD5 sums,\nThis check is based on the account being used. You can upload the same file twice to an account if different directories were specified.\n\n### History\nConfigs are stored in `$HOME/.config/bunkrr_upload/config.json` and all successful uploads and md5 sum hashes will be saved in there.\nEach time you complete an upload a `bunkrr_upload_<timestamp>.csv` will be created with the items uploaded and the following metadata:\n`filePath,filePathMD5,fileNameMD5,uploadSuccess,code,downloadPage,fileId,fileName,guestToken,md5,parentFolder`\n\n## Examples\nGiven\n```\ndirectory/\n\u251c\u2500\u2500 sample2.mkv\n\u2514\u2500\u2500 sample.mkv\n```\n**Upload single file anonymously**\n\n`bunkrr-upload directory/sample.mkv`\n\n**Upload single file to your account**\n\n`bunkrr-upload --token 123 foo directory/sample.mkv`\n\n**Upload single file to directory `foo` in your account**\n\n`bunkrr-upload --token 123 --folder foo directory/sample.mkv`\n\n**Upload directory to your account**\n\n`bunkrr-upload --token 123 directory`\n\n**Upload directory to directory `foo` in your account**\n\n`bunkrr-upload --token 123 --folder foo directory`\n\n# Development\n## Optional Prerequesites\n- tk `sudo pacman -S base-devel tk`\n- [pyenv](https://github.com/pyenv/pyenv?tab=readme-ov-file#set-up-your-shell-environment-for-pyenv)\n- [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv?tab=readme-ov-file#installing-as-a-pyenv-plugin)\n\n```bash\npyenv install 3.9\n```\n\n## Setup\n```bash\npip install -r requirements-dev.txt\npre-commit install\n```\n\n## Packaging\n```bash\npython3 -m build\npython3 -m twine upload --skip-existing --repository pypi dist/*\n```\n\n\n# Improvements Wishlist\n- [ ] Update README\n- [ ] Make it work\n- [ ] Add file zipping and cleanup\n- [ ] Add tests\n- [ ] Add github runners for tests\n- [ ] Recursive directory upload support\n\n# Thanks\n- https://stackoverflow.com/questions/68690141/how-to-show-progress-on-aiohttp-post-with-both-form-data-and-file\n- https://github.com/londarks/Unofficial-bunkrr.io-API-Documentation\n- https://github.com/Samridh212/File_Uploader_goFile\n- https://github.com/rkwyu/bunkrr-dl\n- https://stackoverflow.com/questions/1131220/get-the-md5-hash-of-big-files-in-python\n- https://packaging.python.org/en/latest/tutorials/packaging-projects/\n- https://json2pyi.pages.dev/\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Bunkrr uploader supporting parallel uploads",
"version": "0.10.7",
"project_urls": {
"Homepage": "https://github.com/alexmi256/bunkrr-uploader",
"Repository": "https://github.com/alexmi256/bunkrr-uploader.git"
},
"split_keywords": [
"bunkrr",
" upload",
" storage",
" parallel"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "72bf66f8ea09231a0798c9884a15f66cf9464ae82cf46a280755a3293ba0b6b7",
"md5": "fc5d25ee302c9f39246c043adc86ef1a",
"sha256": "0224c40c03c0e3adde1b135710808c70bc50d1d467346be93780a9f42618b615"
},
"downloads": -1,
"filename": "BunkrrUploader-0.10.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fc5d25ee302c9f39246c043adc86ef1a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 12472,
"upload_time": "2024-05-19T14:34:17",
"upload_time_iso_8601": "2024-05-19T14:34:17.849418Z",
"url": "https://files.pythonhosted.org/packages/72/bf/66f8ea09231a0798c9884a15f66cf9464ae82cf46a280755a3293ba0b6b7/BunkrrUploader-0.10.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b6134467e99af4cdac7b8eaf4b2ba591f5a90f1744cc273b5e05d40db834d104",
"md5": "2cafccc74532b0bc6e5435ebb6388459",
"sha256": "3cdff53fcdfcbb9971030f1bcba697fdefa465831da609d646e0aaeeac43edb3"
},
"downloads": -1,
"filename": "bunkrruploader-0.10.7.tar.gz",
"has_sig": false,
"md5_digest": "2cafccc74532b0bc6e5435ebb6388459",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 10833,
"upload_time": "2024-05-19T14:34:19",
"upload_time_iso_8601": "2024-05-19T14:34:19.328035Z",
"url": "https://files.pythonhosted.org/packages/b6/13/4467e99af4cdac7b8eaf4b2ba591f5a90f1744cc273b5e05d40db834d104/bunkrruploader-0.10.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-19 14:34:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "alexmi256",
"github_project": "bunkrr-uploader",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "bunkrruploader"
}