From 3945e437de2be2ce1a0d88af0490385eeb2e1318 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Sat, 9 Nov 2013 13:24:19 +0100 Subject: [PATCH] docs: Fix minor doc issues found during review - Adds autodoc for mopidy.audio.scan - Updates ``file://`` to ``local:`` - Minor language fix. --- docs/api/audio.rst | 7 +++++++ docs/ext/local.rst | 2 +- docs/extensiondev.rst | 2 +- mopidy/audio/scan.py | 16 ++++++++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/docs/api/audio.rst b/docs/api/audio.rst index 2b9f6cc5..550ca890 100644 --- a/docs/api/audio.rst +++ b/docs/api/audio.rst @@ -28,3 +28,10 @@ Audio listener .. autoclass:: mopidy.audio.AudioListener :members: + + +Audio scanner +============= + +.. autoclass:: mopidy.audio.scan.Scanner + :members: diff --git a/docs/ext/local.rst b/docs/ext/local.rst index 79307ea4..2615856b 100644 --- a/docs/ext/local.rst +++ b/docs/ext/local.rst @@ -6,7 +6,7 @@ Mopidy-Local 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 diff --git a/docs/extensiondev.rst b/docs/extensiondev.rst index 428751de..9c8464f6 100644 --- a/docs/extensiondev.rst +++ b/docs/extensiondev.rst @@ -353,7 +353,7 @@ Example backend 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 -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 details. diff --git a/mopidy/audio/scan.py b/mopidy/audio/scan.py index 82803379..435cac87 100644 --- a/mopidy/audio/scan.py +++ b/mopidy/audio/scan.py @@ -14,6 +14,15 @@ from mopidy.utils import path 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): self.timeout_ms = timeout self.min_duration_ms = min_duration @@ -35,6 +44,13 @@ class Scanner(object): self.bus.set_flushing(True) 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: self._setup(uri) data = self._collect()