├── README.md ├── custom-images.yml ├── diun.yml ├── notify.sh ├── tools ├── curl └── jq └── user.conf /README.md: -------------------------------------------------------------------------------- 1 | 首先文档奉上 2 | 3 | [Diun](https://crazymax.dev/diun/) 4 | 5 | [https://github.com/WWWWM03/diun_notify](https://github.com/WWWWM03/diun_notify) 6 | 7 | **下载github仓库内容。** 8 | 9 | 1.修改 **custom-images.yml 及 diun.yml** 文件。 10 | 11 | **custom-images.yml** 内容是需要监控的image及tag,不写tag应该是默认latest。 12 | 13 | ```yaml 14 | # /custom-images.yml 15 | - name: yipengfei/movie-robot:beta 16 | - name: linuxserver/emby:beta 17 | - name: linuxserver/overseerr:latest 18 | - name: linuxserver/tautulli:latest 19 | - name: [lscr.io/linuxserver/plex:latest](http://lscr.io/linuxserver/plex:latest) 20 | - name: 6053537/portainer-ce 21 | - name: linuxserver/emby:latest 22 | - name: vergilgao/mdc:latest 23 | ``` 24 | 25 | ```yaml 26 | # /diun.yml 27 | db: 28 | path: "/data/diun.db" 29 | 30 | watch: 31 | workers: 20 32 | schedule: "CRON_TZ=Asia/Shanghai */5 * * * *" 33 | firstCheckNotif: true 34 | 35 | notif: 36 | script: 37 | cmd: "/data/notify.sh" 38 | args: 39 | - "DIUN_VERSION" 40 | - "DIUN_ENTRY_STATUS" 41 | - "DIUN_HOSTNAME" 42 | - "DIUN_ENTRY_PROVIDER" 43 | - "DIUN_ENTRY_IMAGE" 44 | - "DIUN_ENTRY_HUBLINK" 45 | - "DIUN_ENTRY_MIMETYPE" 46 | - "DIUN_ENTRY_DIGEST" 47 | - "DIUN_ENTRY_CREATED" 48 | - "DIUN_ENTRY_PLATFORM" 49 | 50 | providers: 51 | docker: 52 | watchStopped: true 53 | ``` 54 | 55 | 2.修改 **user.conf** 文件相关推送通道参数 56 | 57 | ```yaml 58 | # 1. bark配置 59 | export BARK_KEY="" 60 | 61 | # 2. 电报参数 62 | export TG_CHAT_ID="" 63 | export TG_TOKEN="" 64 | 65 | # 3. 企微参数 66 | export CORPID="" 67 | export CORP_SECRET="" 68 | export AGENTID="" 69 | export MEDIA_ID="" 70 | export TOUSER="@all" 71 | 72 | # 4. discord配置 73 | export DISCORD_WEBHOOK="" 74 | export DISCORD_PICURL="" 75 | ``` 76 | 77 | 3.自行替换中括号内的内容,替换三个路径。 78 | 79 | ```bash 80 | docker run -d --name diun \ 81 | -e "TZ=Asia/Shanghai" \ 82 | -e "LOG_LEVEL=info" \ 83 | -e "LOG_JSON=false" \ 84 | -e "DIUN_PROVIDERS_DOCKER=true" \ 85 | -e "DIUN_PROVIDERS_FILE_FILENAME=/custom-images.yml" \ 86 | -v "[替换path]:/data" \ 87 | -v "[替换path]/custom-images.yml:/custom-images.yml:ro" \ 88 | -v "[替换path]/diun.yml:/diun.yml:ro" \ 89 | -v "/var/run/docker.sock:/var/run/docker.sock" \ 90 | crazymax/diun:latest 91 | ``` 92 | 93 | 4.测试通知。 94 | 95 | ```bash 96 | docker exec -it [容器名] diun notif test 97 | ``` 98 | 99 | ![image](https://user-images.githubusercontent.com/74545085/194116386-1477a9cb-35f5-45d8-ad24-2d5028bbfd85.png)TG推送通道 100 | 101 | ![image](https://user-images.githubusercontent.com/74545085/195364047-7779a712-4e16-4798-a098-f12ba929d082.png)discord推送通道 102 | 103 | ![image](https://user-images.githubusercontent.com/74545085/194116502-45a70cf9-5a66-4647-86d0-618d8ab2ef5c.png)TG推送通道 104 | 105 | ![image](https://user-images.githubusercontent.com/74545085/194116536-c7e8849f-ffbb-4d48-a5ff-f1a8d34617eb.png)企微推送通道 106 | 107 | **感谢这位大佬的脚本,我在它的基础上魔改了推送脚本的内容。** 108 | https://github.com/Qliangw/emby_notify 109 | -------------------------------------------------------------------------------- /custom-images.yml: -------------------------------------------------------------------------------- 1 | # /custom-images.yml 2 | - name: yipengfei/movie-robot:beta 3 | - name: linuxserver/emby:beta 4 | - name: linuxserver/overseerr:latest 5 | - name: linuxserver/tautulli:latest 6 | - name: lscr.io/linuxserver/plex:latest 7 | - name: 6053537/portainer-ce 8 | - name: linuxserver/emby:latest 9 | - name: vergilgao/mdc:latest 10 | -------------------------------------------------------------------------------- /diun.yml: -------------------------------------------------------------------------------- 1 | # /diun.yml 2 | db: 3 | path: "/data/diun.db" 4 | 5 | watch: 6 | workers: 20 7 | schedule: "CRON_TZ=Asia/Shanghai */5 * * * *" 8 | firstCheckNotif: true 9 | 10 | notif: 11 | script: 12 | cmd: "/data/notify.sh" 13 | args: 14 | - "DIUN_VERSION" 15 | - "DIUN_ENTRY_STATUS" 16 | - "DIUN_HOSTNAME" 17 | - "DIUN_ENTRY_PROVIDER" 18 | - "DIUN_ENTRY_IMAGE" 19 | - "DIUN_ENTRY_HUBLINK" 20 | - "DIUN_ENTRY_MIMETYPE" 21 | - "DIUN_ENTRY_DIGEST" 22 | - "DIUN_ENTRY_CREATED" 23 | - "DIUN_ENTRY_PLATFORM" 24 | 25 | providers: 26 | docker: 27 | watchStopped: true 28 | -------------------------------------------------------------------------------- /notify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . /data/user.conf 3 | export DIUN_VERSION111=$DIUN_VERSION 4 | export DIUN_ENTRY_STATUS111=$DIUN_ENTRY_STATUS 5 | export DIUN_HOSTNAME111=$DIUN_HOSTNAME 6 | export DIUN_ENTRY_PROVIDER111=$DIUN_ENTRY_PROVIDER 7 | export DIUN_ENTRY_IMAGE111=$DIUN_ENTRY_IMAGE 8 | export DIUN_ENTRY_HUBLINK111=$DIUN_ENTRY_HUBLINK 9 | export DIUN_ENTRY_MIMETYPE111=$DIUN_ENTRY_MIMETYPE 10 | export DIUN_ENTRY_DIGEST111=$DIUN_ENTRY_DIGEST 11 | export DIUN_ENTRY_CREATED111=$DIUN_ENTRY_CREATED 12 | export DIUN_ENTRY_PLATFORM111=$DIUN_ENTRY_PLATFORM 13 | 14 | if [[ "$DIUN_ENTRY_HUBLINK111" = *".docker"* ]]; then 15 | DIUN_ENTRY_HUBLINK111="${DIUN_ENTRY_HUBLINK111}/tags" 16 | fi 17 | imagename1="$(echo "$DIUN_ENTRY_IMAGE111" | cut -d / -f3)" 18 | imagename2="$(echo "$DIUN_ENTRY_IMAGE111" | cut -d / -f2-3)" 19 | imagename3="$(echo "$imagename1" | cut -d : -f1)" 20 | # 通知标题首字母大写 21 | imagename3="$(echo ${imagename3:0:1} | tr '[a-z]' '[A-Z]')${imagename3:1}" 22 | imagename="$(echo "$imagename1" | sed 's/[:][:]*//g')" 23 | DIUN_ENTRY_CREATED222="$(echo "$DIUN_ENTRY_CREATED111" | cut -d . -f1)" 24 | time_end="$(echo "$DIUN_ENTRY_CREATED111" | cut -d \ -f3)" 25 | 26 | if [ "$time_end" = "+0000" ]; then 27 | time="$DIUN_ENTRY_CREATED222" 28 | seconds=`date -d "$time" +%s` 29 | seconds_cst=`expr $seconds + 28800` 30 | DIUN_ENTRY_CREATED111=`date -d @$seconds_cst "+%Y-%m-%d %H:%M:%S"` 31 | # echo $DIUN_ENTRY_CREATED ${imagename2} "utc" $DIUN_ENTRY_CREATED111 >> /data/log.txt 32 | else 33 | DIUN_ENTRY_CREATED111=$DIUN_ENTRY_CREATED222 34 | # echo $DIUN_ENTRY_CREATED ${imagename2} "cst" $DIUN_ENTRY_CREATED111 >> /data/log.txt 35 | fi 36 | 37 | function bark() 38 | { 39 | BARK_URL="https://api.day.app/push" 40 | 41 | cat>/data/${imagename}_bark</data/${imagename}_qywx</data/${imagename}_qywxurl</data/${imagename}_qywxmediaid<更新时间:${DIUN_ENTRY_CREATED111}
平  台:${DIUN_ENTRY_PLATFORM111}\n", 128 | "digest": "镜  像:${imagename2}\n更新时间:${DIUN_ENTRY_CREATED111}\n平  台:${DIUN_ENTRY_PLATFORM111}\n", 129 | "content_source_url": "${DIUN_ENTRY_HUBLINK111}" 130 | } 131 | ] 132 | }, 133 | "enable_id_trans": 0, 134 | "enable_duplicate_check": 0, 135 | "duplicate_check_interval": 1800 136 | } 137 | EOF 138 | /data/tools/curl -d @/data/${imagename}_qywxmediaid -XPOST https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token="${KEY}" 139 | rm /data/${imagename}_qywxmediaid 140 | } 141 | 142 | function telegram() 143 | { 144 | TG_URL='https://api.telegram.org/bot'${TG_TOKEN}'/sendMessage' 145 | cat>/data/${imagename}_tg</data/${imagename}_discord<