• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Support Troubleshooting Media Scanning & Identification Jellyfin for kodi: Scan on start

     
    • 0 Vote(s) - 0 Average

    Jellyfin for kodi: Scan on start

    A way to trigger a Phyton script when Kodi starts?
    Ejz
    Offline

    Junior Member

    Posts: 4
    Threads: 1
    Joined: 2024 Jan
    Reputation: 0
    #1
    2024-01-14, 01:29 PM
    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.
    Ejz
    Offline

    Junior Member

    Posts: 4
    Threads: 1
    Joined: 2024 Jan
    Reputation: 0
    #2
    2024-01-14, 02:19 PM
    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>
    TheDreadPirate
    Offline

    Community Moderator

    Posts: 15,375
    Threads: 10
    Joined: 2023 Jun
    Reputation: 460
    Country:United States
    #3
    2024-01-14, 05:16 PM
    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.
    Jellyfin 10.10.7 (Docker)
    Ubuntu 24.04.2 LTS w/HWE
    Intel i3 12100
    Intel Arc A380
    OS drive - SK Hynix P41 1TB
    Storage
        4x WD Red Pro 6TB CMR in RAIDZ1
    [Image: GitHub%20Sponsors-grey?logo=github]
    Ejz
    Offline

    Junior Member

    Posts: 4
    Threads: 1
    Joined: 2024 Jan
    Reputation: 0
    #4
    2024-01-14, 05:52 PM
    (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?
    TheDreadPirate
    Offline

    Community Moderator

    Posts: 15,375
    Threads: 10
    Joined: 2023 Jun
    Reputation: 460
    Country:United States
    #5
    2024-01-14, 06:09 PM
    If those apps are manually scanning, that is one way. But that is resource intensive compared to inotify.
    Jellyfin 10.10.7 (Docker)
    Ubuntu 24.04.2 LTS w/HWE
    Intel i3 12100
    Intel Arc A380
    OS drive - SK Hynix P41 1TB
    Storage
        4x WD Red Pro 6TB CMR in RAIDZ1
    [Image: GitHub%20Sponsors-grey?logo=github]
    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)


    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode