Skip to content

Commit

Permalink
Convert video_host into string right after validation
Browse files Browse the repository at this point in the history
Create a background task with repeated timer for source scan
Remove cache.py and replace it with scheduler.py
Run uvicorn server as an asynchronous task
  • Loading branch information
dormant-user committed Dec 6, 2023
1 parent 7d6ce14 commit a56181c
Show file tree
Hide file tree
Showing 18 changed files with 246 additions and 141 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ if __name__ == '__main__':
- **VIDEO_SOURCE**: Source path for `.mp4` files.

**Optional**
- **AUTO_THUMBNAIL**: Boolean flag to auto generate thumbnail images for preview. Defaults to `True`
- **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`
- **WEBSITE**: Website to add to CORS configuration. _Required only if tunneled via CDN_
- **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 deep scan `VIDEO_SOURCE` for `.mp4` files. Defaults to `30s`, set to `0` to skip

## Coding Standards
Docstring format: [`Google`][google-docs] <br>
Expand Down
14 changes: 7 additions & 7 deletions doc_gen/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ Authenticator
:members:
:undoc-members:

Cache
=====

.. automodule:: pystream.models.cache
:members:
:undoc-members:

Config
======

Expand All @@ -56,6 +49,13 @@ Ngrok
:members:
:undoc-members:

Scheduler
=========

.. automodule:: pystream.models.scheduler
:members:
:undoc-members:

Squire
======

Expand Down
5 changes: 3 additions & 2 deletions docs/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ <h3>Env Variables<a class="headerlink" href="#env-variables" title="Permalink to
</ul>
<p><strong>Optional</strong></p>
<ul class="simple">
<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>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>WEBSITE</strong>: Website to add to CORS configuration. <em>Required only if tunneled via CDN</em></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 deep scan <code class="docutils literal notranslate"><span class="pre">VIDEO_SOURCE</span></code> for <code class="docutils literal notranslate"><span class="pre">.mp4</span></code> files. Defaults to <code class="docutils literal notranslate"><span class="pre">30s</span></code>, set to <code class="docutils literal notranslate"><span class="pre">0</span></code> to skip</p></li>
</ul>
</section>
</section>
Expand Down
5 changes: 3 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ if __name__ == '__main__':
- **VIDEO_SOURCE**: Source path for `.mp4` files.

**Optional**
- **AUTO_THUMBNAIL**: Boolean flag to auto generate thumbnail images for preview. Defaults to `True`
- **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`
- **WEBSITE**: Website to add to CORS configuration. _Required only if tunneled via CDN_
- **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 deep scan `VIDEO_SOURCE` for `.mp4` files. Defaults to `30s`, set to `0` to skip

## Coding Standards
Docstring format: [`Google`][google-docs] <br>
Expand Down
5 changes: 3 additions & 2 deletions docs/_sources/README.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ if __name__ == '__main__':
- **VIDEO_SOURCE**: Source path for `.mp4` files.

**Optional**
- **AUTO_THUMBNAIL**: Boolean flag to auto generate thumbnail images for preview. Defaults to `True`
- **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`
- **WEBSITE**: Website to add to CORS configuration. _Required only if tunneled via CDN_
- **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 deep scan `VIDEO_SOURCE` for `.mp4` files. Defaults to `30s`, set to `0` to skip

## Coding Standards
Docstring format: [`Google`][google-docs] <br>
Expand Down
14 changes: 7 additions & 7 deletions docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ Authenticator
:members:
:undoc-members:

Cache
=====

.. automodule:: pystream.models.cache
:members:
:undoc-members:

Config
======

Expand All @@ -56,6 +49,13 @@ Ngrok
:members:
:undoc-members:

Scheduler
=========

.. automodule:: pystream.models.scheduler
:members:
:undoc-members:

Squire
======

Expand Down
57 changes: 42 additions & 15 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ <h3>Navigation</h3>
<h1 id="index">Index</h1>

<div class="genindex-jumpbox">
<a href="#A"><strong>A</strong></a>
<a href="#_"><strong>_</strong></a>
| <a href="#A"><strong>A</strong></a>
| <a href="#C"><strong>C</strong></a>
| <a href="#E"><strong>E</strong></a>
| <a href="#F"><strong>F</strong></a>
Expand All @@ -61,6 +62,14 @@ <h1 id="index">Index</h1>
| <a href="#W"><strong>W</strong></a>

</div>
<h2 id="_">_</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pystream.models.scheduler.RepeatedTimer._run">_run() (pystream.models.scheduler.RepeatedTimer method)</a>
</li>
</ul></td>
</tr></table>

<h2 id="A">A</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
Expand All @@ -71,6 +80,10 @@ <h2 id="A">A</h2>

<h2 id="C">C</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pystream.models.scheduler.RepeatedTimer.cancel">cancel() (pystream.models.scheduler.RepeatedTimer method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pystream.models.config.Static.chunk_size">chunk_size (pystream.models.config.Static attribute)</a>
</li>
Expand Down Expand Up @@ -166,12 +179,14 @@ <h2 id="I">I</h2>
<h2 id="L">L</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pystream.models.config.FileIO.list_files">list_files (pystream.models.config.FileIO attribute)</a>
<li><a href="index.html#pystream.models.config.Static.landing_page">landing_page (pystream.models.config.Static attribute)</a>
</li>
<li><a href="index.html#pystream.models.squire.log_connection">log_connection() (in module pystream.models.squire)</a>
<li><a href="index.html#pystream.models.config.FileIO.list_files">list_files (pystream.models.config.FileIO attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pystream.models.squire.log_connection">log_connection() (in module pystream.models.squire)</a>
</li>
<li><a href="index.html#pystream.routers.auth.logout">logout() (in module pystream.routers.auth)</a>
</li>
<li><a href="index.html#pystream.models.config.Static.logout_endpoint">logout_endpoint (pystream.models.config.Static attribute)</a>
Expand All @@ -191,14 +206,14 @@ <h2 id="M">M</h2>
<li><a href="index.html#module-pystream.main">pystream.main</a>
</li>
<li><a href="index.html#module-pystream.models.authenticator">pystream.models.authenticator</a>
</li>
<li><a href="index.html#module-pystream.models.cache">pystream.models.cache</a>
</li>
<li><a href="index.html#module-pystream.models.config">pystream.models.config</a>
</li>
<li><a href="index.html#module-pystream.models.images">pystream.models.images</a>
</li>
<li><a href="index.html#module-pystream.models.ngrok">pystream.models.ngrok</a>
</li>
<li><a href="index.html#module-pystream.models.scheduler">pystream.models.scheduler</a>
</li>
<li><a href="index.html#module-pystream.models.squire">pystream.models.squire</a>
</li>
Expand Down Expand Up @@ -227,6 +242,8 @@ <h2 id="N">N</h2>
<h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pystream.models.config.EnvConfig.parse_video_host">parse_video_host() (pystream.models.config.EnvConfig class method)</a>
</li>
<li><a href="index.html#pystream.models.config.EnvConfig.password">password (pystream.models.config.EnvConfig attribute)</a>
</li>
<li><a href="index.html#pystream.models.config.Static.preview">preview (pystream.models.config.Static attribute)</a>
Expand Down Expand Up @@ -255,33 +272,33 @@ <h2 id="P">P</h2>
</li>
</ul></li>
<li>
pystream.models.cache
pystream.models.config

<ul>
<li><a href="index.html#module-pystream.models.cache">module</a>
<li><a href="index.html#module-pystream.models.config">module</a>
</li>
</ul></li>
<li>
pystream.models.config
pystream.models.images

<ul>
<li><a href="index.html#module-pystream.models.config">module</a>
<li><a href="index.html#module-pystream.models.images">module</a>
</li>
</ul></li>
<li>
pystream.models.images
pystream.models.ngrok

<ul>
<li><a href="index.html#module-pystream.models.images">module</a>
<li><a href="index.html#module-pystream.models.ngrok">module</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
pystream.models.ngrok
pystream.models.scheduler

<ul>
<li><a href="index.html#module-pystream.models.ngrok">module</a>
<li><a href="index.html#module-pystream.models.scheduler">module</a>
</li>
</ul></li>
<li>
Expand Down Expand Up @@ -342,10 +359,12 @@ <h2 id="R">R</h2>
<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.routers.basics.root">root() (in module pystream.routers.basics)</a>
<li><a href="index.html#pystream.models.scheduler.RepeatedTimer">RepeatedTimer (class in pystream.models.scheduler)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pystream.routers.basics.root">root() (in module pystream.routers.basics)</a>
</li>
<li><a href="index.html#pystream.logger.RootFilter">RootFilter (class in pystream.logger)</a>
</li>
<li><a href="index.html#pystream.models.ngrok.run_tunnel">run_tunnel() (in module pystream.models.ngrok)</a>
Expand All @@ -356,17 +375,25 @@ <h2 id="R">R</h2>
<h2 id="S">S</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pystream.models.config.EnvConfig.scan_interval">scan_interval (pystream.models.config.EnvConfig attribute)</a>
</li>
<li><a href="index.html#pystream.models.stream.send_bytes_range_requests">send_bytes_range_requests() (in module pystream.models.stream)</a>
</li>
<li><a href="index.html#pystream.models.config.Session">Session (class in pystream.models.config)</a>
</li>
<li><a href="index.html#pystream.main.start">start() (in module pystream.main)</a>

<ul>
<li><a href="index.html#pystream.models.scheduler.RepeatedTimer.start">(pystream.models.scheduler.RepeatedTimer method)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pystream.main.startup_tasks">startup_tasks() (in module pystream.main)</a>
</li>
<li><a href="index.html#pystream.models.config.Static">Static (class in pystream.models.config)</a>
</li>
<li><a href="index.html#pystream.models.scheduler.RepeatedTimer.stop">stop() (pystream.models.scheduler.RepeatedTimer method)</a>
</li>
<li><a href="index.html#pystream.routers.video.stream_video">stream_video() (in module pystream.routers.video)</a>
</li>
Expand All @@ -378,7 +405,7 @@ <h2 id="S">S</h2>
<h2 id="T">T</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pystream.models.cache.timed_cache">timed_cache() (in module pystream.models.cache)</a>
<li><a href="index.html#pystream.main.task">task() (in module pystream.main)</a>
</li>
</ul></td>
</tr></table>
Expand Down
Loading

0 comments on commit a56181c

Please sign in to comment.