Realization of push function of movie information in Emby Server

The v1.x version will not be updated and maintained in the future, please update and use the v2.x version if necessary! ! !

Introduction

Use the watchdog module ("watchdog") in python to monitor the Emby media library directory, and push the new video information in the Emby media library, including movies and episodes, to channel subscribers through telegram bots and channels.

The project source code has been uploaded to github—— https://github.com/Ccccx159/watchdog_for_Emby.git
docker image uploaded to hub.docker.com—— https://hub.docker.com/r/b1gfac3c4t/overwatch
welcome to use~

Implementation Notes

In the v2.x version, the xmllint dependency in the original version is deleted, and all functions are realized only through python. Therefore, in the dockerfile, the base image is ubuntu:latestchanged from to python:alpine3.17, and the image size is reduced from 231MB to 69.5MB after pulling, which is about 70% smaller .

watchdog_for_Emby monitors the "xxxx.nfo" file generated by Emby Server automatic video scraping. After the new movie is put into the library, Emby Server will automatically perform scraping to generate an nfo file in xml format, and some information about the movie or episode can be parsed through xmllint. The basic information of the current movie can be obtained by parsing the nfo file through the "ElementTree" module. The cover image of the movie and the detailed information of the episode need to be queried through the TMDB API, and the query is completed by calling the "requests.get()" method. After assembling the payload data according to the telegram bot's api document, call the "requests.post()" method to push it to the bot, and the bot will post it to the corresponding channel.

dependencies

  1. python3.10 and above (in version v2.x, the match...case... syntax is used, and it is only supported in 3.10 and above)
  2. python Module: watchdog, requests (cmd: pip3 install watchdog requests),ElementTree
  3. sudo apt-get install libxml2-utilsThis dependency has been removed in xmllint (os: ubuntu 20.04, cmd: ) v2.x

Environment variable settings

parameter illustrate
BOT_TOKEN Telegram bot token
CHAT_ID Telegram channel chat_id
TMDB_API TMDB api token
MEDIA_PATH Emby library path
LOG_PATH <optional> log file path, default is/var/tmp/overwatch.log

Docker Run

docker run -d --name=watchdog-emby --restart=unless-stopped \
  -v "your media lib's host path":"media lib's container path" \
  -e BOT_TOKEN="your telegram bot's token" \
  -e CHAT_ID="your telegram channle's chat_id" \
  -e TMDB_API="tmdb api token" \
  -e MEDIA_PATH="media lib's container path" \
  -e LOG_PATH="log's output path" \
  b1gfac3c4t/overwatch

Show results

Movie:

episodes:

reference documents

  • tmdb api documentation: https://developers.themoviedb.org/3
  • Telegram bot api documentation: https://core.telegram.org/bots/api

Guess you like

Origin blog.csdn.net/qq_38894585/article/details/128466081