version: "3"

services:
  transmission:
    image: haugene/transmission-openvpn:latest-armhf  # arm version
    container_name: transmission
    restart: always
    cap_add:
      - NET_ADMIN
    ports:
      - "9091:9091"
    volumes:
      - "./volumes/downloads:/data"
    environment:
      - OPENVPN_PROVIDER=PIA
      - OPENVPN_CONFIG=france
      - OPENVPN_USERNAME=user
      - OPENVPN_PASSWORD=pass
      - OPENVPN_OPTS=--inactive 3600 --ping 10 --ping-exit 60
      - WEBPROXY_ENABLED=false
      - LOCAL_NETWORK=192.168.0.0/16
      - CREATE_TUN_DEVICE=true


  media-sort:
    build:
      context: .
      dockerfile: Dockerfile.media-sort
    command: >-
        --tv-dir /sorted --movie-dir /sorted
        --tv-template '{{ .Name }}/S{{ printf "%02d" .Season }}/{{ .Name }} S{{ printf "%02d" .Season }}E{{ printf "%02d" .Episode }}{{ if ne .ExtraEpisode -1 }}-{{ printf "%02d" .ExtraEpisode }}{{end}}.{{ .Ext }}'
        --movie-template '{{ .Name }}.{{ .Ext }}'
        --action link
        --recursive
        --num-dirs -1
        --accuracy-threshold 80
        --watch
        /unsorted
    container_name: media-sort
    restart: always
    volumes:
      - "./volumes/downloads:/unsorted"
      - "./volumes/data:/sorted"


  minidlna:
    image: vladgh/minidlna
    container_name: minidlna
    restart: always
    ports:
      - "1900:1900/udp"
      - "8200:8200/tcp"
    volumes:
      - "./volumes/data:/data:ro"
    environment:
      - MINIDLNA_MEDIA_DIR=/data
      - MINIDLNA_FRIENDLY_NAME=Media
