Skip to content

Commit

Permalink
Main 76595 podcast url (#79)
Browse files Browse the repository at this point in the history
* Podcast episode extUrl, podcast extUrl
* 'avif' support
  • Loading branch information
TomasHermanek authored Mar 12, 2024
1 parent 1f4c220 commit 8d2c9b9
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [1.8.2](https://github.com/anzusystems/core-dam-bundle/compare/1.8.1...1.8.2) (2024-03-12)

### Features
* Podcast episode extUrl, podcast extUrl
* 'avif' support

## [1.8.1](https://github.com/anzusystems/core-dam-bundle/compare/1.8.0...1.8.1) (2024-02-29)
### Changes
* Podcast rss url length validation
Expand Down
13 changes: 7 additions & 6 deletions src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@

final class App extends AnzuApp
{
public const ZERO = 0;
public const DOCTRINE_EXTRA_LAZY = 'EXTRA_LAZY';
public const CACHE_STRATEGY = 'NONSTRICT_READ_WRITE';
public const DATE_TIME_API_FORMAT = 'Y-m-d\TH:i:s.u\Z';
public const int ZERO = 0;
public const string DOCTRINE_EXTRA_LAZY = 'EXTRA_LAZY';
public const string CACHE_STRATEGY = 'NONSTRICT_READ_WRITE';
public const string DATE_TIME_API_FORMAT = 'Y-m-d\TH:i:s.u\Z';
public const string ORDER_ASC = 'ASC';

public const ENTITY_NAMESPACE = __NAMESPACE__ . '\Entity';
public const string ENTITY_NAMESPACE = __NAMESPACE__ . '\Entity';

private const RANDOM_BYTES_LEN = 32;
private const int RANDOM_BYTES_LEN = 32;

/**
* @throws Exception
Expand Down
1 change: 1 addition & 0 deletions src/Domain/Podcast/PodcastManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function update(Podcast $podcast, Podcast $newPodcast, bool $flush = true
;
$podcast->getAttributes()
->setRssUrl($newPodcast->getAttributes()->getRssUrl())
->setExtUrl($newPodcast->getAttributes()->getExtUrl())
->setFileSlot($newPodcast->getAttributes()->getFileSlot())
->setMode($newPodcast->getAttributes()->getMode())
;
Expand Down
1 change: 1 addition & 0 deletions src/Domain/PodcastEpisode/PodcastEpisodeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function update(PodcastEpisode $podcastEpisode, PodcastEpisode $newPodcas
$podcastEpisode->getAttributes()
->setSeasonNumber($newPodcastEpisode->getAttributes()->getSeasonNumber())
->setEpisodeNumber($newPodcastEpisode->getAttributes()->getEpisodeNumber())
->setExtUrl($newPodcastEpisode->getAttributes()->getExtUrl())
;
$podcastEpisode->getTexts()
->setTitle($newPodcastEpisode->getTexts()->getTitle())
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/AssetFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ abstract class AssetFile implements
use NotifyToTrait;

#[ORM\OneToMany(mappedBy: 'assetFile', targetEntity: Chunk::class, fetch: App::DOCTRINE_EXTRA_LAZY)]
#[ORM\OrderBy(value: ['offset' => Criteria::ASC])]
#[ORM\OrderBy(value: ['offset' => App::ORDER_ASC])]
protected Collection $chunks;

#[ORM\OneToOne(targetEntity: AssetFileMetadata::class)]
Expand Down
3 changes: 2 additions & 1 deletion src/Entity/CustomForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use AnzuSystems\Contracts\Entity\Interfaces\UuidIdentifiableInterface;
use AnzuSystems\Contracts\Entity\Traits\TimeTrackingTrait;
use AnzuSystems\Contracts\Entity\Traits\UserTrackingTrait;
use AnzuSystems\CoreDamBundle\App;
use AnzuSystems\CoreDamBundle\Entity\Traits\UuidIdentityTrait;
use AnzuSystems\CoreDamBundle\Repository\CustomFormRepository;
use Doctrine\Common\Collections\ArrayCollection;
Expand All @@ -26,7 +27,7 @@ class CustomForm implements TimeTrackingInterface, UuidIdentifiableInterface, Us
use UserTrackingTrait;

#[ORM\OneToMany(mappedBy: 'form', targetEntity: CustomFormElement::class)]
#[ORM\OrderBy(value: ['position' => Criteria::ASC])]
#[ORM\OrderBy(value: ['position' => App::ORDER_ASC])]
#[Assert\Valid]
private Collection $elements;

Expand Down
3 changes: 2 additions & 1 deletion src/Entity/DistributionCategorySelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use AnzuSystems\Contracts\Entity\Interfaces\UuidIdentifiableInterface;
use AnzuSystems\Contracts\Entity\Traits\TimeTrackingTrait;
use AnzuSystems\Contracts\Entity\Traits\UserTrackingTrait;
use AnzuSystems\CoreDamBundle\App;
use AnzuSystems\CoreDamBundle\Entity\Interfaces\ExtSystemInterface;
use AnzuSystems\CoreDamBundle\Entity\Traits\UuidIdentityTrait;
use AnzuSystems\CoreDamBundle\Model\Enum\AssetType;
Expand Down Expand Up @@ -49,7 +50,7 @@ class DistributionCategorySelect implements TimeTrackingInterface, UserTrackingI

#[Serialize(type: DistributionCategoryOption::class)]
#[ORM\OneToMany(mappedBy: 'select', targetEntity: DistributionCategoryOption::class)]
#[ORM\OrderBy(['position' => Criteria::ASC])]
#[ORM\OrderBy(['position' => App::ORDER_ASC])]
#[Assert\Count(min: 1, minMessage: ValidationException::ERROR_FIELD_LENGTH_MIN)]
#[Assert\Valid]
private Collection $options;
Expand Down
24 changes: 24 additions & 0 deletions src/Entity/Embeds/PodcastAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,24 @@
#[ORM\Embeddable]
class PodcastAttributes
{
/**
* RSS feed URL
*/
#[ORM\Column(type: Types::STRING, length: 2_048, nullable: true)]
#[Assert\Length(max: 2_048, maxMessage: ValidationException::ERROR_FIELD_LENGTH_MAX)]
#[Assert\Url(message: ValidationException::ERROR_FIELD_INVALID)]
#[Serialize]
private string $rssUrl;

/**
* Podcast URL (located in external service)
*/
#[ORM\Column(type: Types::STRING, length: 2_048, options: ['default' => ''])]
#[Assert\Length(max: 2_048, maxMessage: ValidationException::ERROR_FIELD_LENGTH_MAX)]
#[Assert\Url(message: ValidationException::ERROR_FIELD_INVALID)]
#[Serialize]
private string $extUrl;

#[ORM\Column(type: Types::STRING, length: 128, nullable: true)]
#[Assert\Length(max: 128, maxMessage: ValidationException::ERROR_FIELD_LENGTH_MAX)]
#[Serialize]
Expand All @@ -37,6 +49,7 @@ public function __construct()
{
$this->setRssUrl('');
$this->setFileSlot('');
$this->setExtUrl('');
$this->setLastImportStatus(PodcastLastImportStatus::Default);
$this->setMode(PodcastImportMode::Default);
}
Expand Down Expand Up @@ -89,4 +102,15 @@ public function setFileSlot(string $fileSlot): self

return $this;
}

public function getExtUrl(): string
{
return $this->extUrl;
}

public function setExtUrl(string $extUrl): self
{
$this->extUrl = $extUrl;
return $this;
}
}
25 changes: 25 additions & 0 deletions src/Entity/Embeds/PodcastEpisodeAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,21 @@
#[ORM\Embeddable]
class PodcastEpisodeAttributes
{
/**
* Audio track URL provided by external service (obtained from RSS FEED)
*/
#[ORM\Column(type: Types::STRING, length: 2_048)]
private string $rssUrl;

/**
* Podcast episode URL (located in external service)
*/
#[ORM\Column(type: Types::STRING, length: 2_048, options: ['default' => ''])]
#[Assert\Length(max: 2_048, maxMessage: ValidationException::ERROR_FIELD_LENGTH_MAX)]
#[Assert\Url(message: ValidationException::ERROR_FIELD_INVALID)]
#[Serialize]
private string $extUrl;

#[ORM\Column(type: Types::STRING, length: 255)]
private string $rssId;

Expand All @@ -40,6 +52,7 @@ public function __construct()
$this->setLastImportStatus(PodcastEpisodeStatus::Default);
$this->setRssId('');
$this->setRssUrl('');
$this->setExtUrl('');
}

#[Serialize]
Expand Down Expand Up @@ -104,4 +117,16 @@ public function setRssId(string $rssId): self

return $this;
}

public function getExtUrl(): string
{
return $this->extUrl;
}

public function setExtUrl(string $extUrl): self
{
$this->extUrl = $extUrl;

return $this;
}
}
2 changes: 1 addition & 1 deletion src/Entity/ImageFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ImageFile extends AssetFile
private ImageAttributes $imageAttributes;

#[ORM\OneToMany(mappedBy: 'image', targetEntity: ImageFileOptimalResize::class)]
#[ORM\OrderBy(value: ['requestedSize' => Criteria::ASC])]
#[ORM\OrderBy(value: ['requestedSize' => App::ORDER_ASC])]
private Collection $resizes;

#[ORM\OneToMany(mappedBy: 'image', targetEntity: RegionOfInterest::class)]
Expand Down
3 changes: 1 addition & 2 deletions src/Model/Enum/ImageMimeTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ enum ImageMimeTypes: string implements EnumInterface
case MimePng = self::MIME_PNG;
case MimeWebp = self::MIME_WEBP;
case MimeGif = self::MIME_GIF;
// todo fix colors
// case MimeAvif = self::MIME_AVIF;
case MimeAvif = self::MIME_AVIF;
}

0 comments on commit 8d2c9b9

Please sign in to comment.