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
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3,3 +3,4 @@
!poca.xml
!crontab
!entrypoint
!kodi_scan
+1 −0
Original line number Diff line number Diff line
@@ -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"]
+1 −1
Original line number Diff line number Diff line
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.

kodi_scan

0 → 100755
+24 −0
Original line number Diff line number Diff line
#!/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