Jellyfin Forum
Jellyfin for kodi: Scan on start - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+---- Forum: Media Scanning & Identification (https://forum.jellyfin.org/f-media-scanning-identification)
+---- Thread: Jellyfin for kodi: Scan on start (/t-jellyfin-for-kodi-scan-on-start)



Jellyfin for kodi: Scan on start - Ejz - 2024-01-14

Hi!

Having Jellyfin server installed on my Windows 11.
Kodi omega on my Nvidia Shield.

Using drives on both my NAS (NFS) and on Windows.

I'm having problems getting newly added content scanned within a short timeframe. The auto-scan is not really working in JF because of the networkdrives.
Tried Radarr with webhook and that does not seem to work very well either.. 

Anyway... In kodi there is this option "Update library on startup". Meaning, every time I start kodi to watch something, it adds the latest stuff.. 
But I assume this option does not actually trigger a scan within my JF server. (?)

So I'm looking for the same function, but that works with "Jelly for Kodi".
Maybe there is a way to trigger a Phyton script when Kodi starts?

(Bash) Something like:  curl -d "" http://[jellyfin ip]:[port]/library/refresh?api_key=[yourapikey]
(PS1) Invoke-RestMethod -Uri "http://[jellyfin ip]/library/refresh?api_key=[yourapikey]" -Method POST

I'm not a coder, so I don't know how that would look in Phyton.


RE: Jellyfin for kodi: Scan on start - Ejz - 2024-01-14

Okay I think I actually managed to code my first phyton script and get it to run on kodi start.. :P


Android\data\org.xbmc.kodi\files\.kodi\addons\service.autoexec\autoexec.py

Code:
import requests

headers = {
    'Content-Type': 'application/x-www-form-urlencoded',
}

params = {
    'api_key': 'JELLY-API-KEY',
}

response = requests.post('http://YOUR-IP:PORT/library/refresh', params=params, headers=headers)

And then also

Android\data\org.xbmc.kodi\files\.kodi\addons\service.autoexec\addon.xml

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="service.autoexec" name="Autoexec Service" version="1.0.0" provider-name="your username">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.requests" version="3.0.0"/>
</requires>
<extension point="xbmc.service" library="autoexec.py">
</extension>
<extension point="xbmc.addon.metadata">
<summary lang="en_GB">Automatically run python code when Kodi starts.</summary>
<description lang="en_GB">The Autoexec Service will automatically be run on Kodi startup.</description>
<platform>all</platform>
<license>GNU GENERAL PUBLIC LICENSE Version 2</license>
</extension>
</addon>



RE: Jellyfin for kodi: Scan on start - TheDreadPirate - 2024-01-14

If you have real time monitoring on Jellyfin enabled, that feature requires that the filesystem it is monitoring supports inotify. IIRC, NFS does not support inotify.


RE: Jellyfin for kodi: Scan on start - Ejz - 2024-01-14

(2024-01-14, 05:16 PM)TheDreadPirate Wrote: If you have real time monitoring on Jellyfin enabled, that feature requires that the filesystem it is monitoring supports inotify.  IIRC, NFS does not support inotify.

Yea exactly. Question is tho, how does radarr manage to scan on new files created if there is no inotify?


RE: Jellyfin for kodi: Scan on start - TheDreadPirate - 2024-01-14

If those apps are manually scanning, that is one way. But that is resource intensive compared to inotify.