# Class e.p.m.m.MediaScanner(ServiceProvider):

Part of elisa.plugins.media_db.media_scanner View In Hierarchy

    Scan media sources extracting metadata and populating the
    L{elisa.core.media_db.MediaDB}.

    The MediaScanner crawls sources looking for resources from which to get
    metadata. Static source locations can be specified in the configuration
    file. Sources can also be added, removed and updated at runtime with
    L{elisa.core.media_scanner.MediaScanner.add_source},
    L{elisa.core.media_scanner.MediaScanner.remove_source} and
    L{elisa.core.media_scanner.MediaScanner.update_source).

    Sources are periodically rescanned to keep the
    L{elisa.core.media_db.MediaDB} up to date. Monitorable sources are
    automatically watched for metadata changes so they need not be rescanned.
    FIXME: monitoring is not implemented currently.

Line # | Kind | Name | Docs
--- | --- | --- | ---
100 | Method | initialize | Initialize the component.
159 | Method | start | Start the scanner.
176 | Method | stop | Stop the scanner.
213 | Method | add_source | Add a new source to the scan queue.
232 | Method | add_media | Undocumented
235 | Method | remove_source | Mark a source as unavailable in the database and stop monitoring it.
245 | Method | remove_media | Undocumented
249 | Method | update_source | Schedule a new scan of the source located at given uri.

Inherited from Component (via ServiceProvider):

Line # | Kind | Name | Docs
--- | --- | --- | ---
85 | Class | PathDescriptor | Undocumented
97 | Class Method | create | Create and initialize the component.
142 | Method | clean | Clean the component.

Inherited from Loggable (via ServiceProvider, Component):

Line # | Kind | Name | Docs
--- | --- | --- | ---
81 | Method | __init__ | Undocumented

def initialize(self):
overrides elisa.core.component.Component.initialize

Initialize the component.

This method is called by `Component.create` to finish the initialization of a component.

Returns | a deferred called when a component is fully initialized (type: `twisted.internet.defer.Deferred` )

def start(self, delayed_start=5):
overrides elisa.core.components.service_provider.ServiceProvider.start
Start the scanner.

Parameters | delayed_start | number of seconds to wait before starting (type: int )

def stop(self):
overrides elisa.core.components.service_provider.ServiceProvider.stop
Stop the scanner.

def add_source(self, source_uri, media_types=None):
Add a new source to the scan queue.

Parameters | source_uri | The location of the source (type: `elisa.core.media_uri.MediaUri` )
| media_types | a sequence of media types to scan on this source eg: ('audio', 'image') or None (type: sequence )
Returns | defer called when the source scan is complete (type: `twisted.internet.defer.Deferred` )

def add_media(self, source_uri, uri):
Undocumented
def remove_source(self, source_uri):
Mark a source as unavailable in the database and stop monitoring it.

Parameters | source_uri | The location of the source (type: `elisa.core.media_uri.MediaUri` )

def remove_media(self, source_uri, uri):
Undocumented
def update_source(self, source_uri):
Schedule a new scan of the source located at given uri.

Parameters | source_uri | The location of the source (type: `elisa.core.media_uri.MediaUri` )
Returns | defer (type: `twisted.internet.defer.Deferred` called when the source update is complete )