Skip to content
Snippets Groups Projects
Commit 8d8298e3 authored by nimrod's avatar nimrod
Browse files

Trigger a Kodi scan after each run.

So it scans the audio library and finds new podcasts.
parent f2f2b136
No related branches found
No related tags found
No related merge requests found
......@@ -3,3 +3,4 @@
!poca.xml
!crontab
!entrypoint
!kodi_scan
......@@ -20,6 +20,7 @@ RUN apk add --update --no-cache --virtual .lxml-build build-base git libxslt-dev
RUN mkdir --mode 777 db Podcasts
COPY --chown=root:root crontab ./
COPY --chown=root:root poca.xml ./
COPY --chown=root:root kodi_scan /usr/local/bin/
COPY --chown=root:root entrypoint /usr/local/sbin/docker-entrypoint
VOLUME db Podcasts
ENTRYPOINT ["docker-entrypoint"]
......
0 */4 * * * poca --config ./ || wget --spider https://notify.shore.co.il/send?message=Poca%20job%20failed.
0 */4 * * * ( poca --config ./ && kodi_scan ) || wget --spider https://notify.shore.co.il/send?message=Poca%20job%20failed.
#!/usr/bin/env python3
"""Trigger a Kodi audio library update."""
import json
import urllib.request
KODI_RPC_URL = "http://172.18.0.1:8080/jsonrpc"
if __name__ == "__main__":
headers = {"content-type": "application/json"}
request_data = {
"jsonrpc": "2.0",
"id": "transmission",
"method": "AudioLibrary.Scan",
}
req = urllib.request.Request(
KODI_RPC_URL,
headers=headers,
data=json.dumps(request_data).encode(),
)
# pylint: disable-next=consider-using-with
urllib.request.urlopen(req) # nosec
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment