Skip to content

Commit

Permalink
Updates to Files, Episode Page Layout, and Configs
Browse files Browse the repository at this point in the history
- Files are no longer required to be stored under the project root.
- File records in the DB are now immutable.
- Fixed layout issue with <audio> tag on episode page
- Updated config defaults to reflect above changes to file storage
  • Loading branch information
leftouterjoins committed Nov 18, 2023
1 parent cb48b6a commit b0348a2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion conf/podsumer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ store_media_on_disk = false
# Cannot be change once library is established. If changed, some media
# files may no longer be servable.

media_dir = state/media
media_dir = /opt/media

1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
context: .
volumes:
- ./:/opt/podsumer
- ./state/media/:/opt/media
networks:
- default
ports:
Expand Down
3 changes: 1 addition & 2 deletions src/Brickner/Podsumer/FSState.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ class FSState extends State
{
public function getMediaDir(): string
{
return $this->main->getInstallPath()
. $this->main->getConf('podsumer', 'media_dir');
return $this->main->getConf('podsumer', 'media_dir');
}

public function getFeedDir($name): string
Expand Down
4 changes: 2 additions & 2 deletions src/Brickner/Podsumer/State.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function addFeed(Feed $feed): ?int
$feed_rec['image'] = $this->cacheFile($feed->getImage(), $feed_rec);
$feed_rec['image_url'] = $feed->getImage();

$sql = 'INSERT INTO feeds (url_hash, name, last_update, url, description, image, image_url) VALUES (:url_hash, :name, :last_update, :url, :description, :image, :image_url) ON CONFLICT(url_hash) DO UPDATE SET name=:name, last_update=:last_update, description=:description, image=:image, image_url=:image_url';
$sql = 'INSERT INTO feeds (url_hash, name, last_update, url, description, image, image_url) VALUES (:url_hash, :name, :last_update, :url, :description, :image, :image_url) ON CONFLICT(url_hash) DO UPDATE SET id=:id';
$this->query($sql, $feed_rec);
$feed_id = $this->pdo->lastInsertId();

Expand Down Expand Up @@ -274,7 +274,7 @@ protected function addFileContents(string $content_hash, string $contents, ?stri
'data' => $contents
];

$sql = 'INSERT INTO file_contents (content_hash, data) VALUES (:content_hash, :data) ON CONFLICT(content_hash) DO UPDATE SET content_hash=:content_hash';
$sql = 'INSERT INTO file_contents (content_hash, data) VALUES (:content_hash, :data) ON CONFLICT(content_hash) DO UPDATE SET id=id';
$this->query($sql, $file_content);

$sql = 'SELECT id FROM file_contents WHERE content_hash = :content_hash';
Expand Down
17 changes: 9 additions & 8 deletions templates/item.html.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<div class="container py-10 content-center">
<div class="container py-10 content-center clear">

<h1 class="py-5 text-2xl">
<a href="/feed?id=<?= $item['feed_id'] ?>"><?= $feed['name'] ?></a>
<a href="/feed?id=<?= $item['feed_id'] ?>"><?= $feed['name'] ?></a>
</h1>

<h1 class="text-xl pb-5"><?= $item['name'] ?></h1>
<img src="/image?<?= 'item_id='.$item['id'] ?: 'feed_id'.$feed['id'] ?>" class="mx-auto w-3/5 border-solid border-neutral-800 border">
<audio autoplay controls src="/audio?item_id=<?= $item['id'] ?>" class="w-full p-4 h-13"></audio>
<div id="item-desc" class="w-full pb-4 pl-5 pr-5">
<p class="pb-4"><?= $item['description'] ?></p>
</div>

<p><img src="/image?<?= 'item_id='.$item['id'] ?: 'feed_id'.$feed['id'] ?>" class="mx-auto w-3/5 border-solid border-neutral-800 border"></p>

<p><audio autoplay controls src="/audio?item_id=<?= $item['id'] ?>" class="w-full m-4 h-13"></audio></p>

<p><?= $item['description'] ?></p>

</div>

<style type="text/css">
#item-desc a {color: rgb(253, 230, 138);}
#item-desc p {padding-bottom: 1em;}
</style>

0 comments on commit b0348a2

Please sign in to comment.