title('Manually Reprocess Media'); if (empty($stationName)) { $io->section('Reprocessing media for all stations...'); $storageLocation = null; } else { $station = $stationRepo->findByIdentifier($stationName); if (!$station instanceof Station) { $io->error('Station not found.'); return 1; } $storageLocation = $station->getMediaStorageLocation(); $io->writeln(sprintf('Reprocessing media for station: %s', $station->getName())); } $reprocessMediaQueue = $em->createQueryBuilder() ->update(Entity\StationMedia::class, 'sm') ->set('sm.mtime', 'NULL'); if (null !== $storageLocation) { $reprocessMediaQueue = $reprocessMediaQueue->where('sm.storage_location = :storageLocation') ->setParameter('storageLocation', $storageLocation); } $recordsAffected = $reprocessMediaQueue->getQuery()->getSingleScalarResult(); $io->writeln(sprintf('Marked %d records for reprocessing.', $recordsAffected)); return 0; } }