Package elisa :: Package core :: Module media_scanner :: Class MediaScanner
[hide private]
[frames] | no frames]

Class MediaScanner

source code



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.



Nested Classes [hide private]
  __metaclass__
Instance Methods [hide private]
 
__init__(self, media_manager, metadata_manager)
Create the elisa.core.media_scanner.MediaScanner.
source code
 
_get_option(self, name, default='frontend') source code
 
_set_option(self, name, value) source code
 
_save_config(self) source code
 
enabled__get(self) source code
 
start(self, delayed_start=0)
Start the scanner.
source code
 
stop(self)
Stop the scanner.
source code
twisted.internet.defer.Deferred
add_source(self, source_uri, media_types='frontend')
Add a new source to the scan queue.
source code
 
add_media(self, source_uri, uri) source code
 
remove_source(self, source_uri)
Mark a source as unavailable in the database and stop monitoring it.
source code
 
remove_media(self, source_uri, uri) source code

twisted.internet.defer.Deferred called when the

source update is complete
update_source(self, source_uri)
Schedule a new scan of the source located at given uri.
source code
 
_schedule_source_update(self, source_uri, current_uri='frontend', requested_media_types='frontend') source code
 
_ensure_running(self) source code
 
_enqueue(self, item) source code
 
_dequeue(self) source code
 
_process_next(self, seconds='frontend', delayed=True) source code
 
_checkpoint(self) source code
 
_process_next_real(self, delayed=True) source code
 
_schedule_periodic_updates(self) source code
 
_periodic_update(self, interval_label) source code
 
_process(self, item) source code
 
_process_media_file(self, item) source code

Inherited from extern.log.log.Loggable: debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Static Methods [hide private]
 
__classinit__(cls, new_attrs)
Given a class and a new set of attributes (as passed in by __classinit__), create or modify properties based on functions with special names ending in __get, __set, and __del.
source code
Class Variables [hide private]
  default_config = {'commit_interval': '5', 'database': 'elisa.d...
  min_commit_interval = 1
  min_scan_interval = 0.01
  name = 'media_scanner'

Inherited from extern.log.log.Loggable: logCategory

Properties [hide private]
  enabled

Inherited from object: __class__

Method Details [hide private]

__init__(self, media_manager, metadata_manager)
(Constructor)

source code 
Create the elisa.core.media_scanner.MediaScanner.
Parameters:
Overrides: log.Loggable.__init__

start(self, delayed_start=0)

source code 
Start the scanner.
Parameters:
  • delayed_start (int) - number of seconds to wait before starting

add_source(self, source_uri, media_types='frontend')

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

remove_source(self, source_uri)

source code 
Mark a source as unavailable in the database and stop monitoring it.
Parameters:

update_source(self, source_uri)

source code 
Schedule a new scan of the source located at given uri.
Parameters:
Returns:

twisted.internet.defer.Deferred called when the

source update is complete
defer

Class Variable Details [hide private]

default_config

Value:
{'commit_interval': '5',
 'database': 'elisa.db',
 'db_backend': 'sqlite',
 'hostname': '',
 'password': '',
 'scan_interval': '0.01',
 'username': ''}

Property Details [hide private]

enabled

Get Method:
elisa.core.media_scanner.MediaScanner.enabled__get(self)
Set Method:
'frontend'
Delete Method:
'frontend'