Compare commits

...

1 Commits

Author SHA1 Message Date
1f0d29b92e wip: starting work 2025-05-01 16:10:38 -05:00
4 changed files with 30 additions and 3 deletions

View File

@@ -1,2 +1,2 @@
# $1 = movies/tvshows/etc, $2 = title of media, $3 = URL of download
cd /var/download/${1} && if [ ! -d "${2}" ]; then mkdir "${2}"; fi && cd "${2}" && wget "${3}"
cd /var/download/${1} && if [ ! -d "${2}" ]; then mkdir "${2}"; fi && cd "${2}" && wget -c "${3}"

View File

@@ -37,4 +37,25 @@ class DownloadController extends AbstractController
return $this->json(['status' => 200, 'message' => 'Added to Queue']);
}
#[Route('/download/test', name: 'app_download_test', methods: ['GET'])]
public function downloadTest(
): Response {
$download = $this->downloadRepository->find(32);
try {
$this->bus->dispatch(new \App\Download\Action\Command\DownloadMediaCommand(
$download->getUrl(),
$download->getTitle(),
$download->getFilename(),
$download->getMediaType(),
$download->getImdbId(),
$download->getId(),
));
} catch (\Throwable $exception) {
return $this->json(['error' => $exception->getMessage()], Response::HTTP_INTERNAL_SERVER_ERROR);
}
return $this->json(['status' => 200, 'message' => 'Added to Queue']);
}
}

View File

@@ -41,7 +41,7 @@ class DownloadRepository extends ServiceEntityRepository
$firstResult = ($pageNumber - 1) * $perPage;
$query = $this->createQueryBuilder('d')
->andWhere('d.status IN (:statuses)')
->orderBy('d.id', 'DESC')
->orderBy('d.id', 'ASC')
->setParameter('statuses', ['New', 'In Progress'])
->setFirstResult($firstResult)
->setMaxResults($perPage)
@@ -66,6 +66,7 @@ class DownloadRepository extends ServiceEntityRepository
->setImdbId($imdbId)
->setMediaType($mediaType)
->setBatchId($batchId)
->setProgress(0)
->setStatus($status);
$this->getEntityManager()->persist($download);

View File

@@ -17,7 +17,7 @@
{% for download in this.getDownloads() %}
<tr id="ad_download_{{ download.id }}">
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-stone-800 min-w-[45ch] max-w-[45ch] truncate">
{{ download.title }}
{{ download.filename }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-end text-gray-800 dark:text-gray-50">
<span class="p-1.5 bg-purple-600 rounded-full">
@@ -26,6 +26,11 @@
</td>
</tr>
{% endfor %}
<tr class="bg-amber-600">
<td class="px-6 py-4 whitespace-nowrap text-xs uppercase text-center col-span-2 font-medium text-gray-50 dark:text-gray-50" colspan="2">
<a href="#">View all active downloads</a>
</td>
</tr>
{% else %}
<tr>
<td class="px-6 py-4 whitespace-nowrap text-xs uppercase text-center col-span-2 font-medium text-gray-800 dark:text-stone-800" colspan="2">