docs: Fix minor doc issues found during review

- Adds autodoc for mopidy.audio.scan
- Updates ``file://`` to ``local:``
- Minor language fix.
This commit is contained in:
Thomas Adamcik 2013-11-09 13:24:19 +01:00
parent 67c028c31e
commit 3945e437de
4 changed files with 25 additions and 2 deletions

View File

@ -28,3 +28,10 @@ Audio listener
.. autoclass:: mopidy.audio.AudioListener .. autoclass:: mopidy.audio.AudioListener
:members: :members:
Audio scanner
=============
.. autoclass:: mopidy.audio.scan.Scanner
:members:

View File

@ -6,7 +6,7 @@ Mopidy-Local
Extension for playing music from a local music archive. Extension for playing music from a local music archive.
This backend handles URIs starting with ``file:``. This backend handles URIs starting with ``local:``.
Known issues Known issues

View File

@ -353,7 +353,7 @@ Example backend
If you want to extend Mopidy to support new music and playlist sources, you If you want to extend Mopidy to support new music and playlist sources, you
want to implement a backend. A backend does not have access to Mopidy's core want to implement a backend. A backend does not have access to Mopidy's core
API at all and got a bunch of interfaces to implement. API at all and have a bunch of interfaces to implement.
The skeleton of a backend would look like this. See :ref:`backend-api` for more The skeleton of a backend would look like this. See :ref:`backend-api` for more
details. details.

View File

@ -14,6 +14,15 @@ from mopidy.utils import path
class Scanner(object): class Scanner(object):
"""
Helper to get tags and other relevant info from URIs.
:param timeout: timeout for scanning a URI in ms
:type event: int
:param min_duration: minimum duration of scanned URI in ms, -1 for all.
:type event: int
"""
def __init__(self, timeout=1000, min_duration=100): def __init__(self, timeout=1000, min_duration=100):
self.timeout_ms = timeout self.timeout_ms = timeout
self.min_duration_ms = min_duration self.min_duration_ms = min_duration
@ -35,6 +44,13 @@ class Scanner(object):
self.bus.set_flushing(True) self.bus.set_flushing(True)
def scan(self, uri): def scan(self, uri):
"""
Scan the given uri collecting relevant metadata.
:param uri: URI of the resource to scan.
:type event: string
:return: Dictionary of tags, duration, mtime and uri information.
"""
try: try:
self._setup(uri) self._setup(uri)
data = self._collect() data = self._collect()