Skip to content

Commit

Permalink
Update README.md and runbook
Browse files Browse the repository at this point in the history
  • Loading branch information
dormant-user committed Jan 3, 2024
1 parent c7c5616 commit 9d2b55c
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 33 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,24 @@ if __name__ == '__main__':
```

### Env Variables
> :bulb:   Environment variables can be loaded from any file.
> Defaults to `.env` (_set the env var `env_file` to the filename_)
> :bulb: &nbsp; Environment variables can be loaded from any file. _Defaults to `.env`_<br>
> Set the env var `env_file` to the filename to use custom `.env` files
**Mandatory**
- **USERNAME**: Any username of choice.
- **PASSWORD**: Any password of choice.
- **VIDEO_SOURCE**: Source path for `.mp4` files.
- **VIDEO_SOURCE**: Source path for video files.
> :bulb: &nbsp; Files starting with `_` _(underscore)_ will be ignored
**Optional**
- **VIDEO_HOST**: IP address to host the video. Defaults to `127.0.0.1`
- **VIDEO_PORT**: Port number to host the application. Defaults to `8000`
- **FILE_FORMATS**: Sequence of supported video file formats. Defaults to `(.mp4, .mov)`
- **WORKERS**: Number of workers to spin up the `uvicorn` server. Defaults to `1`
- **WEBSITE**: Website to add to CORS configuration. _Required only if tunneled via CDN_
- **AUTO_THUMBNAIL**: Boolean flag to auto generate thumbnail images for preview. Defaults to `True`
- **SCAN_INTERVAL**: Interval in seconds to scan `VIDEO_SOURCE` in the background. Defaults traditional scan at run time.
- **NGROK_TOKEN**: Ngrok token to initiate tunneling via public endpoint.
> :bulb: &nbsp; When `SCAN_INTERVAL` is set to `None`, `VIDEO_SOURCE` will be scanned in real time whenever the user
> loads the landing page. Setting a `SCAN_INTERVAL` will scan the `VIDEO_SOURCE` in background and reduce runtime
> delays in case of complex directory structure.
Expand Down
8 changes: 5 additions & 3 deletions docs/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ <h2>Usage<a class="headerlink" href="#usage" title="Permalink to this heading">
<section id="env-variables">
<h3>Env Variables<a class="headerlink" href="#env-variables" title="Permalink to this heading"></a></h3>
<blockquote>
<div><p>:bulb:   Environment variables can be loaded from any file.
Defaults to <code class="docutils literal notranslate"><span class="pre">.env</span></code> (<em>set the env var <code class="docutils literal notranslate"><span class="pre">env_file</span></code> to the filename</em>)</p>
<div><p>:bulb:   Environment variables can be loaded from any file. <em>Defaults to <code class="docutils literal notranslate"><span class="pre">.env</span></code></em><br>
Set the env var <code class="docutils literal notranslate"><span class="pre">env_file</span></code> to the filename to use custom <code class="docutils literal notranslate"><span class="pre">.env</span></code> files</p>
</div></blockquote>
<p><strong>Mandatory</strong></p>
<ul class="simple">
<li><p><strong>USERNAME</strong>: Any username of choice.</p></li>
<li><p><strong>PASSWORD</strong>: Any password of choice.</p></li>
<li><p><strong>VIDEO_SOURCE</strong>: Source path for <code class="docutils literal notranslate"><span class="pre">.mp4</span></code> files.</p></li>
<li><p><strong>VIDEO_SOURCE</strong>: Source path for video files.</p></li>
</ul>
<blockquote>
<div><p>:bulb:   Files starting with <code class="docutils literal notranslate"><span class="pre">_</span></code> <em>(underscore)</em> will be ignored</p>
Expand All @@ -93,10 +93,12 @@ <h3>Env Variables<a class="headerlink" href="#env-variables" title="Permalink to
<ul class="simple">
<li><p><strong>VIDEO_HOST</strong>: IP address to host the video. Defaults to <code class="docutils literal notranslate"><span class="pre">127.0.0.1</span></code></p></li>
<li><p><strong>VIDEO_PORT</strong>: Port number to host the application. Defaults to <code class="docutils literal notranslate"><span class="pre">8000</span></code></p></li>
<li><p><strong>FILE_FORMATS</strong>: Sequence of supported video file formats. Defaults to <code class="docutils literal notranslate"><span class="pre">(.mp4,</span> <span class="pre">.mov)</span></code></p></li>
<li><p><strong>WORKERS</strong>: Number of workers to spin up the <code class="docutils literal notranslate"><span class="pre">uvicorn</span></code> server. Defaults to <code class="docutils literal notranslate"><span class="pre">1</span></code></p></li>
<li><p><strong>WEBSITE</strong>: Website to add to CORS configuration. <em>Required only if tunneled via CDN</em></p></li>
<li><p><strong>AUTO_THUMBNAIL</strong>: Boolean flag to auto generate thumbnail images for preview. Defaults to <code class="docutils literal notranslate"><span class="pre">True</span></code></p></li>
<li><p><strong>SCAN_INTERVAL</strong>: Interval in seconds to scan <code class="docutils literal notranslate"><span class="pre">VIDEO_SOURCE</span></code> in the background. Defaults traditional scan at run time.</p></li>
<li><p><strong>NGROK_TOKEN</strong>: Ngrok token to initiate tunneling via public endpoint.</p></li>
</ul>
<blockquote>
<div><p>:bulb:   When <code class="docutils literal notranslate"><span class="pre">SCAN_INTERVAL</span></code> is set to <code class="docutils literal notranslate"><span class="pre">None</span></code>, <code class="docutils literal notranslate"><span class="pre">VIDEO_SOURCE</span></code> will be scanned in real time whenever the user
Expand Down
8 changes: 5 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,24 @@ if __name__ == '__main__':
```

### Env Variables
> :bulb: &nbsp; Environment variables can be loaded from any file.
> Defaults to `.env` (_set the env var `env_file` to the filename_)
> :bulb: &nbsp; Environment variables can be loaded from any file. _Defaults to `.env`_<br>
> Set the env var `env_file` to the filename to use custom `.env` files
**Mandatory**
- **USERNAME**: Any username of choice.
- **PASSWORD**: Any password of choice.
- **VIDEO_SOURCE**: Source path for `.mp4` files.
- **VIDEO_SOURCE**: Source path for video files.
> :bulb: &nbsp; Files starting with `_` _(underscore)_ will be ignored
**Optional**
- **VIDEO_HOST**: IP address to host the video. Defaults to `127.0.0.1`
- **VIDEO_PORT**: Port number to host the application. Defaults to `8000`
- **FILE_FORMATS**: Sequence of supported video file formats. Defaults to `(.mp4, .mov)`
- **WORKERS**: Number of workers to spin up the `uvicorn` server. Defaults to `1`
- **WEBSITE**: Website to add to CORS configuration. _Required only if tunneled via CDN_
- **AUTO_THUMBNAIL**: Boolean flag to auto generate thumbnail images for preview. Defaults to `True`
- **SCAN_INTERVAL**: Interval in seconds to scan `VIDEO_SOURCE` in the background. Defaults traditional scan at run time.
- **NGROK_TOKEN**: Ngrok token to initiate tunneling via public endpoint.
> :bulb: &nbsp; When `SCAN_INTERVAL` is set to `None`, `VIDEO_SOURCE` will be scanned in real time whenever the user
> loads the landing page. Setting a `SCAN_INTERVAL` will scan the `VIDEO_SOURCE` in background and reduce runtime
> delays in case of complex directory structure.
Expand Down
8 changes: 5 additions & 3 deletions docs/_sources/README.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,24 @@ if __name__ == '__main__':
```

### Env Variables
> :bulb: &nbsp; Environment variables can be loaded from any file.
> Defaults to `.env` (_set the env var `env_file` to the filename_)
> :bulb: &nbsp; Environment variables can be loaded from any file. _Defaults to `.env`_<br>
> Set the env var `env_file` to the filename to use custom `.env` files

**Mandatory**
- **USERNAME**: Any username of choice.
- **PASSWORD**: Any password of choice.
- **VIDEO_SOURCE**: Source path for `.mp4` files.
- **VIDEO_SOURCE**: Source path for video files.
> :bulb: &nbsp; Files starting with `_` _(underscore)_ will be ignored

**Optional**
- **VIDEO_HOST**: IP address to host the video. Defaults to `127.0.0.1`
- **VIDEO_PORT**: Port number to host the application. Defaults to `8000`
- **FILE_FORMATS**: Sequence of supported video file formats. Defaults to `(.mp4, .mov)`
- **WORKERS**: Number of workers to spin up the `uvicorn` server. Defaults to `1`
- **WEBSITE**: Website to add to CORS configuration. _Required only if tunneled via CDN_
- **AUTO_THUMBNAIL**: Boolean flag to auto generate thumbnail images for preview. Defaults to `True`
- **SCAN_INTERVAL**: Interval in seconds to scan `VIDEO_SOURCE` in the background. Defaults traditional scan at run time.
- **NGROK_TOKEN**: Ngrok token to initiate tunneling via public endpoint.
> :bulb: &nbsp; When `SCAN_INTERVAL` is set to `None`, `VIDEO_SOURCE` will be scanned in real time whenever the user
> loads the landing page. Setting a `SCAN_INTERVAL` will scan the `VIDEO_SOURCE` in background and reduce runtime
> delays in case of complex directory structure.
Expand Down
4 changes: 4 additions & 0 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ <h2 id="G">G</h2>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pystream.models.squire.get_iter">get_iter() (in module pystream.models.squire)</a>
</li>
<li><a href="index.html#pystream.utils.get_local_ip">get_local_ip() (in module pystream.utils)</a>
</li>
<li><a href="index.html#pystream.utils.get_public_ip">get_public_ip() (in module pystream.utils)</a>
Expand Down Expand Up @@ -363,6 +365,8 @@ <h2 id="R">R</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pystream.models.stream.range_requests_response">range_requests_response() (in module pystream.models.stream)</a>
</li>
<li><a href="index.html#pystream.models.squire.remove_thumbnail">remove_thumbnail() (in module pystream.models.squire)</a>
</li>
<li><a href="index.html#pystream.models.scheduler.RepeatedTimer">RepeatedTimer (class in pystream.models.scheduler)</a>
</li>
Expand Down
58 changes: 43 additions & 15 deletions docs/index.html

Large diffs are not rendered by default.

Binary file modified docs/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions pystream/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ class EnvConfig(BaseSettings):
password: SecretStr
video_source: DirectoryPath

auto_thumbnail: bool = True
video_host: IPv4Address = socket.gethostbyname("localhost")
video_port: PositiveInt = 8000
website: Union[HttpUrl, None] = None
ngrok_token: Union[str, None] = None
file_formats: Sequence[str] = (".mov", ".mp4")
video_host: IPv4Address = socket.gethostbyname("localhost")

workers: int = Field(1, le=os.cpu_count(), ge=1, env="WORKERS")
website: Union[HttpUrl, None] = None
auto_thumbnail: bool = True
scan_interval: Union[PositiveInt, None] = Field(None, ge=30, le=86_400) # range: 30s to 24h

ngrok_token: Union[str, None] = None

class Config:
"""Environment variables configuration."""

Expand Down
2 changes: 1 addition & 1 deletion pystream/models/squire.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import pathlib
import re
from typing import Dict, List, Union, Tuple
from typing import Dict, List, Tuple, Union

from fastapi import Request

Expand Down

0 comments on commit 9d2b55c

Please sign in to comment.