Package elisa :: Package plugins :: Package base :: Module local_media :: Class LocalMedia
[hide private]
[frames] | no frames]

Class LocalMedia

source code


This class implements local filesystem support

Nested Classes [hide private]

Inherited from core.component.Component: __metaclass__

Instance Methods [hide private]
 
__init__(self)
Lazily set name from class name styled with underscores (class ComponentBar -> name component_bar.
source code
 
initialize(self)
Initialize various variables internal to the Component.
source code
 
_get_option(self, name) source code
 
supported_uri_schemes__get(self)
Retrieve the URI schemes supported by the provider, for each scheme there's a priority.
source code
twisted.internet.defer.Deferred
get_media_type(self, uri)
Same as blocking_get_media_type but without blocking (in theory).
source code
twisted.internet.defer.Deferred
is_directory(self, uri)
Same as _blocking_is_directory but without blocking (in theory).
source code
twisted.internet.defer.Deferred
has_children_with_types(self, uri, media_types)
Same as _blocking_has_children_with_types but without blocking (in theory).
source code
twisted.internet.defer.Deferred
get_direct_children(self, uri, list_of_children)
Same as _blocking_get_direct_children but without blocking (in theory).
source code
elisa.core.media_file.MediaFile
_blocking_open(self, uri, mode='r')
Open an uri and return MediaFile.
source code
twisted.internet.defer.Deferred
next_location(self, uri, root='frontend')
Same as _blocking_next_location but without blocking (in theory).
source code
elisa.core.media_uri.MediaUri
_blocking_next_location(self, uri, root='frontend')
Return the uri just next to given uri.
source code
twisted.internet.defer.Deferred
previous_location(self, uri)
Same as _blocking_previous_location but without blocking (in theory).
source code
elisa.core.media_uri.MediaUri
_blocking_previous_location(self, uri)
Return the uri found before given uri
source code
 
monitor_uri(self, uri, callback, *extra_args)
Start monitoring given uri for modification and call a function in case of any change happening on `uri` Raises UriNotMonitorable(uri) if uri can't be monitored
source code
 
_inotify_event_type(self, mask) source code
 
unmonitor_uri(self, uri)
Stop monitoring given uri.
source code
bool
uri_is_monitorable(self, uri)
Check if the uri is monitorable for modification
source code
bool
uri_is_monitored(self, uri)
Check if the uri is currently monitored for modification
source code
twisted.internet.defer.Deferred
copy(self, orig_uri, dest_uri, recursive=True)
Copy one location to another.
source code
twisted.internet.defer.Deferred
move(self, orig_uri, dest_uri)
Move data located at given URI to another URI.
source code
twisted.internet.defer.Deferred
delete(self, uri, recursive=True)
Delete a resource located at given URI.
source code

Inherited from base_components.media_provider.MediaProvider: close, get_real_uri, open, read, scannable_uri_schemes__get, seek

Inherited from core.component.Component: clean, load_config, save_config

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]

Inherited from core.component.Component: __classinit__

Class Variables [hide private]
  hidden_fnmatch_pattern = '[!.]*'
dict default_config = {'hidden_file_chars': '!.'}
used when nothing found in Application's config
string name = 'local_media'
Component's name

Inherited from core.component.Component: checked, config_doc, id, plugin

Inherited from extern.log.log.Loggable: logCategory

Instance Variables [hide private]

Inherited from core.component.Component: config, path

Properties [hide private]
dict mapping string to int supported_uri_schemes
DOCME

Inherited from base_components.media_provider.MediaProvider: scannable_uri_schemes

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 
Lazily set name from class name styled with underscores (class ComponentBar -> name component_bar. Also set log category based on component name, with a 'comp_' prefix.
Overrides: core.component.Component.__init__
(inherited documentation)

initialize(self)

source code 

Initialize various variables internal to the Component.

This method is called by the plugin_registry after the component's config has been loaded.

Override this method if you need to perform some initializations that would normally go in Component's constructor but can't be done there because they require access to the component's config.
Overrides: core.component.Component.initialize
(inherited documentation)

supported_uri_schemes__get(self)

source code 

Retrieve the URI schemes supported by the provider, for each scheme there's a priority. Higher priority == 0 means the provider will always be used to read data from a given scheme.

This function is called by the MediaManager to know which media provider it has to use to access a specified URI. You should return a dict containing the uri scheme (such as 'file', 'cdda', ...) and its priority between 0 to 255 (0 being the topmost priority). The prority is used by the MediaManager to know which media provider it should use in case there are more than one who support the desired uri scheme. You might have for example a component which supports more than one scheme, but the support of one of them is not very efficient compared to what it could be. In this case you could modify its priority to tell the MediaManager that another component should be used instead of it to access this scheme.

example: { 'file': 0, 'smb': 10 }

# FIXME: this should be documented in the class docstring as a class # variable
Overrides: base_components.media_provider.MediaProvider.supported_uri_schemes__get
(inherited documentation)

get_media_type(self, uri)

source code 
Same as blocking_get_media_type but without blocking (in theory). This method by default triggers a succeeded callback on a Twisted deferred, using blocking_get_media_type result.
Returns: twisted.internet.defer.Deferred
Overrides: base_components.media_provider.MediaProvider.get_media_type
(inherited documentation)

is_directory(self, uri)

source code 
Same as _blocking_is_directory but without blocking (in theory). This method by default triggers a succeeded callback on a Twisted deferred, using _blocking_is_directory result.
Returns: twisted.internet.defer.Deferred
Overrides: base_components.media_provider.MediaProvider.is_directory
(inherited documentation)

has_children_with_types(self, uri, media_types)

source code 
Same as _blocking_has_children_with_types but without blocking (in theory). This method by default triggers a succeeded callback on a Twisted deferred, using _blocking_has_children_with_types result.
Returns: twisted.internet.defer.Deferred
Overrides: base_components.media_provider.MediaProvider.has_children_with_types
(inherited documentation)

get_direct_children(self, uri, list_of_children)

source code 
Same as _blocking_get_direct_children but without blocking (in theory). This method by default triggers a succeeded callback on a Twisted deferred, using _blocking_get_direct_children result.
Returns: twisted.internet.defer.Deferred
Overrides: base_components.media_provider.MediaProvider.get_direct_children
(inherited documentation)

_blocking_open(self, uri, mode='r')

source code 
Open an uri and return MediaFile.
Returns: elisa.core.media_file.MediaFile
Overrides: base_components.media_provider.MediaProvider._blocking_open
(inherited documentation)

next_location(self, uri, root='frontend')

source code 
Same as _blocking_next_location but without blocking (in theory). This method by default triggers a succeeded callback on a Twisted deferred, using _blocking_next_location result.
Returns: twisted.internet.defer.Deferred
Overrides: base_components.media_provider.MediaProvider.next_location
(inherited documentation)

_blocking_next_location(self, uri, root='frontend')

source code 
Return the uri just next to given uri.
Returns: elisa.core.media_uri.MediaUri
Overrides: base_components.media_provider.MediaProvider._blocking_next_location
(inherited documentation)

previous_location(self, uri)

source code 
Same as _blocking_previous_location but without blocking (in theory). This method by default triggers a succeeded callback on a Twisted deferred, using _blocking_previous_location result.
Returns: twisted.internet.defer.Deferred
Overrides: base_components.media_provider.MediaProvider.previous_location
(inherited documentation)

_blocking_previous_location(self, uri)

source code 
Return the uri found before given uri
Returns: elisa.core.media_uri.MediaUri
Overrides: base_components.media_provider.MediaProvider._blocking_previous_location
(inherited documentation)

monitor_uri(self, uri, callback, *extra_args)

source code 
Start monitoring given uri for modification and call a function in case of any change happening on `uri` Raises UriNotMonitorable(uri) if uri can't be monitored
Overrides: base_components.media_provider.MediaProvider.monitor_uri
(inherited documentation)

unmonitor_uri(self, uri)

source code 
Stop monitoring given uri.
Overrides: base_components.media_provider.MediaProvider.unmonitor_uri
(inherited documentation)

uri_is_monitorable(self, uri)

source code 
Check if the uri is monitorable for modification
Returns: bool
Overrides: base_components.media_provider.MediaProvider.uri_is_monitorable
(inherited documentation)

uri_is_monitored(self, uri)

source code 
Check if the uri is currently monitored for modification
Returns: bool
Overrides: base_components.media_provider.MediaProvider.uri_is_monitored
(inherited documentation)

copy(self, orig_uri, dest_uri, recursive=True)

source code 
Copy one location to another. If both URIs represent a directory and recursive flag is set to True I will recursively copy the directory to the destination URI.
Returns: twisted.internet.defer.Deferred
Overrides: base_components.media_provider.MediaProvider.copy
(inherited documentation)

move(self, orig_uri, dest_uri)

source code 
Move data located at given URI to another URI. If orig_uri represents a directory it will recusively be moved to dest_uri. In the case where orig_uri is a directory, dest_uri can't be a file.
Returns: twisted.internet.defer.Deferred
Overrides: base_components.media_provider.MediaProvider.move
(inherited documentation)

delete(self, uri, recursive=True)

source code 
Delete a resource located at given URI. If that URI represents a directory and recursive flag is set to True I will recursively remove the directory.
Returns: twisted.internet.defer.Deferred
Overrides: base_components.media_provider.MediaProvider.delete
(inherited documentation)

Property Details [hide private]

supported_uri_schemes

DOCME
Get Method:
elisa.plugins.base.local_media.LocalMedia.supported_uri_schemes__get(self) - Retrieve the URI schemes supported by the provider, for each scheme there's a priority.
Set Method:
'frontend'
Delete Method:
'frontend'