diff --git a/src/transmissions/indexer/_indexer.py b/src/transmissions/indexer/_indexer.py index e9f7e8a..78d5f38 100644 --- a/src/transmissions/indexer/_indexer.py +++ b/src/transmissions/indexer/_indexer.py @@ -288,11 +288,13 @@ def transmissions(self) -> Iterable[Transmission]: ) for filename in filenames: path = Path(dirpath) / filename - self.log.debug("Found audio file: {path}", path=path) + self.log.debug("Found file: {path}", path=path) try: yield self._transmissionFromFile(path) except InvalidFileError as e: self.log.error("{error}", error=e) + except Exception as e: # noqa: BLE001 + self.log.error("Error: {error}", error=e) async def _addDuration( self, @@ -416,7 +418,7 @@ async def indexIntoStore( self, store: TXDataStore, *, - existingOnly: bool = True, + existingOnly: bool = False, computeChecksum: bool = True, computeTranscription: bool = True, computeDuration: bool = True, diff --git a/src/transmissions/run/_command.py b/src/transmissions/run/_command.py index 3cf2bc5..e94f68a 100644 --- a/src/transmissions/run/_command.py +++ b/src/transmissions/run/_command.py @@ -246,8 +246,14 @@ def main(ctx: Context, config: str) -> None: # noqa: ARG001 @main.command() +@option("--new/--no-new", default=True, help="Search for new transmissions") +@option("--checksum/--no-checksum", default=True, help="Compute checksums") +@option("--duration/--no-duration", default=True, help="Compute durations") +@option("--transcript/--no-transcript", default=True, help="Compute transcripts") @pass_context -def index(ctx: Context) -> None: +def index( + ctx: Context, new: bool, checksum: bool, duration: bool, transcript: bool +) -> None: """ Index audio files. """ @@ -256,7 +262,13 @@ def index(ctx: Context) -> None: async def app(store: TXDataStore) -> None: for event, sourcePath in configuredEvents: indexer = Indexer(event=event, root=sourcePath) - await indexer.indexIntoStore(store) + await indexer.indexIntoStore( + store, + existingOnly=not new, + computeChecksum=checksum, + computeDuration=duration, + computeTranscription=transcript, + ) run(ctx, app)