How to use the watchgod.DefaultDirWatcher function in watchgod

To help you get started, we’ve selected a few watchgod examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EugeneDae / VLC-Scheduler / src / watchers.py View on Github external
from watchgod import DefaultDirWatcher

from config import config


class VLCSchedulerSourceWatcher(DefaultDirWatcher):
    allowed_extensions = tuple(list(config.MEDIA_EXTENSIONS) + list(config.PLAYLIST_EXTENSIONS))
    
    def should_watch_file(self, entry):
        return entry.name.lower().endswith(self.allowed_extensions)