├── .github └── workflows │ └── docker-publish.yml ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.MD └── resumer.sh /.github/workflows/docker-publish.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: 4 | push: 5 | tags: 6 | - "v*.*.*" 7 | jobs: 8 | docker: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout 12 | uses: actions/checkout@v4 13 | 14 | - name: Login to Docker Hub 15 | uses: docker/login-action@v3 16 | with: 17 | username: ${{ vars.DOCKERHUB_USERNAME }} 18 | password: ${{ secrets.DOCKERHUB_TOKEN }} 19 | 20 | - name: Docker meta 21 | id: meta 22 | uses: docker/metadata-action@v5 23 | with: 24 | images: | 25 | sonaryr/qbt-resumer 26 | tags: | 27 | type=ref,event=branch 28 | type=ref,event=pr 29 | type=semver,pattern={{version}} 30 | type=semver,pattern={{major}}.{{minor}} 31 | - name: Set up QEMU 32 | uses: docker/setup-qemu-action@v3 33 | 34 | - name: Set up Docker Buildx 35 | uses: docker/setup-buildx-action@v3 36 | 37 | - name: Build and push 38 | uses: docker/build-push-action@v6 39 | with: 40 | context: . 41 | file: ./Dockerfile 42 | platforms: linux/amd64,linux/arm64,linux/arm/v7 43 | push: ${{ github.event_name != 'pull_request' }} 44 | tags: ${{ steps.meta.outputs.tags }} 45 | labels: ${{ steps.meta.outputs.labels }} 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | # idea files 3 | /.idea/ 4 | qbt-resumer.iml -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.21.0 2 | ENV QBT_USER admin 3 | ENV QBT_PASSWORD adminadmin 4 | ENV QBT_URL http://localhost:8080 5 | ENV QBT_RECHECK_SECONDS 60 6 | ENV QBT_CLI_VERSION 1.8.24285.1 7 | ARG TARGETPLATFORM 8 | 9 | RUN apk add --no-cache icu-libs krb5-libs libgcc libintl libssl3 libstdc++ zlib curl gzip tar bash jq 10 | 11 | RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then ARCHITECTURE=x64; elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then ARCHITECTURE=arm; elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCHITECTURE=arm64; else ARCHITECTURE=x64; fi \ 12 | && curl -sS -L -O --output-dir /tmp/ --create-dirs "https://github.com/fedarovich/qbittorrent-cli/releases/download/v1.8.24285.1/qbt-linux-alpine-${ARCHITECTURE}-${QBT_CLI_VERSION}.tar.gz" \ 13 | && cd /tmp && mkdir qbittorrent-cli && tar xzf "/tmp/qbt-linux-alpine-${ARCHITECTURE}-${QBT_CLI_VERSION}.tar.gz" -C qbittorrent-cli && mv qbittorrent-cli /usr/lib/ 14 | 15 | RUN chmod a+x /usr/lib/qbittorrent-cli/qbt 16 | RUN ln -sf /usr/lib/qbittorrent-cli/qbt /usr/bin/qbt 17 | 18 | COPY resumer.sh resumer.sh 19 | RUN chmod a+x /resumer.sh 20 | 21 | CMD ["sh","/resumer.sh"] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | # qbt-resumer 2 | 3 | Restart your errored qBittorrent downloads automatically 4 | 5 | ## Getting Started 6 | 7 | These instructions will cover usage information and for the docker container 8 | 9 | ### Prerequisities 10 | 11 | 12 | In order to run this container you'll need docker installed. 13 | 14 | * [Windows](https://docs.docker.com/windows/started) 15 | * [OS X](https://docs.docker.com/mac/started/) 16 | * [Linux](https://docs.docker.com/linux/started/) 17 | 18 | ### Usage 19 | 20 | #### Quickstart 21 | 22 | ```shell 23 | docker run sonaryr/qbt-resumer:latest 24 | ``` 25 | 26 | Or in a compose file 27 | 28 | ```shell 29 | services: 30 | qbt-resumer: 31 | environment: 32 | - QBT_USER=admin 33 | - QBT_PASSWORD=adminadmin 34 | - QBT_URL=http://localhost:8080 35 | - QBT_RECHECK_SECONDS=60 36 | container_name: qbt-resumer 37 | image: sonaryr/qbt-resumer:latest 38 | restart: unless-stopped 39 | ``` 40 | 41 | #### Environment Variables 42 | 43 | * `QBT_USER` - username for the Web UI of qBittorrent (defaults to `admin`) 44 | * `QBT_PASSWORD` - password for the Web UI of qBittorrent (defaults to `adminadmin`) 45 | * `QBT_URL` -URL for the Web UI of qBittorrent (defaults to `http://localhost:8080`) 46 | * `QBT_RECHECK_SECONDS` - amount of seconds the script will sleep before rechecking again (defaults to `60`) 47 | 48 | ## Built With 49 | 50 | * [qbittorrent-cli](https://github.com/fedarovich/qbittorrent-cli) 51 | 52 | ## Authors 53 | 54 | * **Sonaryr** - *Initial work* - [Sonaryr](https://github.com/Sonaryr) 55 | 56 | See also the list of [contributors](https://github.com/your/repository/contributors) who 57 | participated in this project. 58 | 59 | ## License 60 | 61 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. -------------------------------------------------------------------------------- /resumer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | while true 3 | do 4 | echo 'Checking errored torrents...' 5 | RESULTS=`qbt torrent list --username $QBT_USER --password $QBT_PASSWORD --url $QBT_URL --format json --filter errored | jq -r '.[].hash'` 6 | 7 | if [ ! -z "$RESULTS" ]; then 8 | echo $RESULTS | while IFS= read -r line ; do qbt torrent resume --username $QBT_USER --password $QBT_PASSWORD --url $QBT_URL $line; done 9 | else 10 | echo 'No errored torrent found' 11 | fi 12 | echo 'Done, sleeping...' 13 | sleep $QBT_RECHECK_SECONDS 14 | done --------------------------------------------------------------------------------