-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add working dockerfile and update readme
- Loading branch information
Showing
4 changed files
with
81 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM php:8.1-apache | ||
|
||
|
||
# prep folders and perms | ||
RUN mkdir -p /var/www/html/episodes | ||
|
||
# prep env vars | ||
ENV \ | ||
ITEM_COUNT=10000 \ | ||
MP3_DIR=/var/www/html/episodes \ | ||
TITLE= \ | ||
AUTO_SAVE_COVER_ART= | ||
|
||
# add any dir2cast.ini options as env vars here | ||
# todo - making this reusable for all env vars | ||
RUN echo '; review options in dir2cast.ini source' > /var/www/html/dir2cast.ini | ||
RUN echo "ITEM_COUNT = ${ITEM_COUNT}" >> /var/www/html/dir2cast.ini | ||
RUN echo "MP3_DIR = ${MP3_DIR}" >> /var/www/html/dir2cast.ini | ||
RUN if [[ $TITLE ]]; then echo "TITLE = ${TITLE}" >> /var/www/html/dir2cast.ini; fi; | ||
RUN if [[ $AUTO_SAVE_COVER_ART ]]; then echo "AUTO_SAVE_COVER_ART = ${AUTO_SAVE_COVER_ART}" >> /var/www/html/dir2cast.ini; fi; | ||
|
||
# copy source files to docker | ||
COPY ./dir2cast.php /var/www/html/ | ||
# skip creating ini. generated above | ||
# COPY ./dir2cast.ini /var/www/html/ | ||
COPY ./getID3/ /var/www/html/getID3/ | ||
|
||
EXPOSE 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,8 @@ Features: | |
* You can set a per-file iTunes Summary by creating a text file with the same | ||
name as the media file (e.g. for file.mp3, create file.txt). | ||
|
||
* You can deploy a container using the ctkcoding/dir2cast Docker image | ||
|
||
|
||
QUICK HOW TO GUIDES | ||
================================================================================ | ||
|
@@ -98,6 +100,46 @@ podcast that it generates uses the tags from your files. | |
the "`temp`" folder that is created. | ||
|
||
|
||
DOCKER SETUP | ||
================================================================================ | ||
Note: There are many ways to get dir2cast working under docker, and this guide | ||
is a product of trial and error. There are settings in dir2cast and SWAG that are | ||
not covered in this guide. | ||
|
||
Local setup | ||
----------- | ||
1. Map the container's port 80 to whatever port you want to access it with on your | ||
local network (e.g. port 8080) | ||
2. Episodes will be scanned for at `/var/www/html/episodes` unless you pass in a different MP3_DIR, so make sure to create a volume to map under `/var/www/html`, or directly bind the episodes folder to a location on your file system where you wish to store episodes | ||
4. To start the container, try something like: | ||
`docker run --name dir2cast -d -p 8080:80 -v podcast_volume:/var/www/html/episodes ctkcoding/dir2cast:v0.1` and add env vars for settings in dir2cast.ini that you'd like to change from the default. Note below on env vars that are supported | ||
5. Once you add media files to the podcast_volume (or local folder), your podcast | ||
feed should now exist at `<docker server ip>:<container port>/dir2cast.php` | ||
|
||
Remote using SWAG | ||
----------------- | ||
1. Install SWAG and test that you can remotely access your docker server. Here's | ||
a guide https://docs.linuxserver.io/general/swag | ||
2. Create a `<name>.subdomain.conf` file for your podcast server container as | ||
specified in the SWAG guide | ||
3. Add your dir2cast container to the network that you created with SWAG | ||
4. Check that podcasts can be played/downloaded. If your feed exists and can be | ||
subscribed to, but files aren't available, try setting `MP3_URL` in the | ||
`dir2cast.ini` file with an https:// URL rather than http://. (see comment in | ||
that file) | ||
|
||
Notes | ||
----- | ||
* If you have shared folders that are accessible from your computer, using a bind mount | ||
(rather than a docker volume) is an easy way to enable a simple workflow for you to | ||
drag and drop content into the podcast feed. | ||
* If you see '.\_' prefixed junk files in your feed, that is an unfortunate side-effect | ||
of using network shares from macOS, and not dir2cast's fault. | ||
* 502 errors are likely SWAG configuration problems. Check container name, port mapping, etc. | ||
* currently the only docker env vars that can be fed in at startup and set in dir2cast.ini are ITEM_COUNT, MP3_DIR, TITLE, AUTO_SAVE_COVER_ART. Copy the RUN commands in Dockerfile for any new env vars needed | ||
|
||
Thank you to @ctkcoding for the contribution of this guide. | ||
|
||
UNDERSTANDING HOW THE CACHING WORKS | ||
================================================================================ | ||
|
||
|
@@ -218,7 +260,7 @@ To run the unit tests: | |
COPYRIGHT & LICENSE | ||
================================================================================ | ||
|
||
Copyright (c) 2008-2021, Ben XO ([email protected]). | ||
Copyright (c) 2008-2023, Ben XO (@benxo on most platforms). | ||
|
||
The software is released under the BSD License. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/****************************************************************************** | ||
* Copyright (c) 2008-2022, Ben XO ([email protected]). | ||
* Copyright (c) 2008-2023, Ben XO (@benxo on most platforms). | ||
* | ||
* All rights reserved. | ||
* | ||
|
@@ -1246,7 +1246,13 @@ protected function scan() | |
if(self::$EMPTY_PODCAST_IS_ERROR && 0 == $item_count) | ||
{ | ||
http_response_code(404); | ||
throw new Exception("No content yet."); | ||
if (0 == $item_count) { | ||
throw new Exception("Item count zero."); | ||
} | ||
if (self::$EMPTY_PODCAST_IS_ERROR) { | ||
throw new Exception("Self empty podcast error."); | ||
} | ||
|
||
} | ||
|
||
$this->calculateItemHash(); | ||
|