Updated README and documentation and fixed mix up between left and right :/

This commit is contained in:
Christoph Stahl 2024-11-21 14:30:48 +01:00
parent 948bb4da5c
commit 02716a7723
5 changed files with 22 additions and 16 deletions

View file

@ -65,8 +65,10 @@ You can host karaoke events using the default configuration. But if you need mor
* `last_song`: `none` or a time in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601). When a song is added to the queue, and its ending time exceeds this value, it is rejected. * `last_song`: `none` or a time in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601). When a song is added to the queue, and its ending time exceeds this value, it is rejected.
* `preview_duration`: Before every song, there is a short slide for the next performer. This sets how long it is shown in seconds. * `preview_duration`: Before every song, there is a short slide for the next performer. This sets how long it is shown in seconds.
* `key`: If the server, you want to connect to is in _private_ or _restricted_ mode, this will authorize the client. Private server reject unauthorized playback clients, restricted servers limit the searching to be _client only_. * `key`: If the server, you want to connect to is in _private_ or _restricted_ mode, this will authorize the client. Private server reject unauthorized playback clients, restricted servers limit the searching to be _client only_.
* `mpv_options`: additional options forwarded to `mpv`. * `buffer_in_advance`: How many songs should be buffered in advanced.
* `show_advanced`: show advanced options in the configuration GUI. * `qr_box_size`: The size of one box (think pixel) of the QR Code in the playback window.
* `qr_position`: Position of the QR Code in the playback window. One of `bottom-left`, `bottom-right`, `top-left`, `top-right`.
* `show_advanced`: Show advanced options in the configuration GUI.
In addition to the general config, has its own configuration under the `sources` key of the configuration. In addition to the general config, has its own configuration under the `sources` key of the configuration.
@ -77,6 +79,7 @@ Configuration is done under `sources` → `youtube` with the following settings:
* `enabled`: `true` or `false`. * `enabled`: `true` or `false`.
* `channels`: list of YouTube channels. If this is a nonempty list, Syng will only search these channels, otherwise YouTube will be searched as a whole. * `channels`: list of YouTube channels. If this is a nonempty list, Syng will only search these channels, otherwise YouTube will be searched as a whole.
* `tmp_dir`: YouTube videos will be downloaded before playback. This sets the directory, where YouTube videos are stored. * `tmp_dir`: YouTube videos will be downloaded before playback. This sets the directory, where YouTube videos are stored.
* `max_res`: Maximum resolution of a video.
* `start_streaming`: `true` or `false`. If `true`, videos will be streamed directly using `mpv`, if the video is not cached beforehand. Otherwise, Syng waits for the video to be downloaded. * `start_streaming`: `true` or `false`. If `true`, videos will be streamed directly using `mpv`, if the video is not cached beforehand. Otherwise, Syng waits for the video to be downloaded.
### S3 ### S3
@ -112,8 +115,11 @@ config:
secret: <Random secret> secret: <Random secret>
server: https://syng.rocks server: https://syng.rocks
waiting_room_policy: none waiting_room_policy: none
mpv_options: '' show_advanced: false
show_advanced: False buffer_in_advance: 2
qr_box_size: 5
qr_position: bottom-right
sources: sources:
files: files:
dir: . dir: .
@ -127,15 +133,16 @@ sources:
endpoint: '' endpoint: ''
extensions: extensions:
- mp3+cdg - mp3+cdg
index_file: ~/.cache/syng/s3-index index_file: ${XDG_CACHE_DIR}/syng/s3-index
secret_key: '' secret_key: ''
secure: true secure: true
tmp_dir: /tmp/syng tmp_dir: ${XDG_CACHE_DIR}/syng
youtube: youtube:
channels: [] channels: []
enabled: true enabled: true
start_streaming: false start_streaming: false
tmp_dir: /tmp/syng max_res: 720
tmp_dir: ${XDG_CACHE_DIR}/syng
``` ```
# Server # Server

View file

@ -61,7 +61,7 @@ def default_config() -> dict[str, Optional[int | str]]:
"key": None, "key": None,
"buffer_in_advance": 2, "buffer_in_advance": 2,
"qr_box_size": 5, "qr_box_size": 5,
"qr_position": "bottom-left", "qr_position": "bottom-right",
"show_advanced": False, "show_advanced": False,
} }

View file

@ -28,7 +28,7 @@ class QRPosition(Enum):
case "bottom-right": case "bottom-right":
return QRPosition.BOTTOM_RIGHT return QRPosition.BOTTOM_RIGHT
case _: case _:
return QRPosition.BOTTOM_LEFT return QRPosition.BOTTOM_RIGHT
class Player: class Player:
@ -93,16 +93,16 @@ class Player:
osd_height: int = cast(int, self.mpv.osd_height) osd_height: int = cast(int, self.mpv.osd_height)
match self.qr_position: match self.qr_position:
case QRPosition.BOTTOM_LEFT: case QRPosition.BOTTOM_RIGHT:
x_pos = osd_width - self.qr.width - 10 x_pos = osd_width - self.qr.width - 10
y_pos = osd_height - self.qr.height - 10 y_pos = osd_height - self.qr.height - 10
case QRPosition.BOTTOM_RIGHT: case QRPosition.BOTTOM_LEFT:
x_pos = 10 x_pos = 10
y_pos = osd_height - self.qr.height - 10 y_pos = osd_height - self.qr.height - 10
case QRPosition.TOP_LEFT: case QRPosition.TOP_RIGHT:
x_pos = osd_width - self.qr.width - 10 x_pos = osd_width - self.qr.width - 10
y_pos = 10 y_pos = 10
case QRPosition.TOP_RIGHT: case QRPosition.TOP_LEFT:
x_pos = 10 x_pos = 10
y_pos = 10 y_pos = 10

View file

@ -34,7 +34,7 @@ class S3Source(FileBasedSource):
- ``endpoint``, ``access_key``, ``secret_key``, ``secure``, ``bucket``: These - ``endpoint``, ``access_key``, ``secret_key``, ``secure``, ``bucket``: These
will simply be forwarded to the ``minio`` client. will simply be forwarded to the ``minio`` client.
- ``tmp_dir``: The folder, where temporary files are stored. Default - ``tmp_dir``: The folder, where temporary files are stored. Default
is ``/tmp/syng`` is ``${XDG_CACHE_DIR}/syng``
- ``index_file``: If the file does not exist, saves the paths of - ``index_file``: If the file does not exist, saves the paths of
files from the s3 instance to this file. If it exists, loads files from the s3 instance to this file. If it exists, loads
the list of files from this file. the list of files from this file.

View file

@ -19,7 +19,6 @@ from yt_dlp.utils import DownloadError
from platformdirs import user_cache_dir from platformdirs import user_cache_dir
from ..entry import Entry from ..entry import Entry
from ..result import Result from ..result import Result
from .source import Source, available_sources from .source import Source, available_sources
@ -165,7 +164,7 @@ class YoutubeSource(Source):
Examples are ``/c/CCKaraoke`` or Examples are ``/c/CCKaraoke`` or
``/channel/UCwTRjvjVge51X-ILJ4i22ew`` ``/channel/UCwTRjvjVge51X-ILJ4i22ew``
- ``tmp_dir``: The folder, where temporary files are stored. Default - ``tmp_dir``: The folder, where temporary files are stored. Default
is ``/tmp/syng`` is ``${XDG_CACHE_DIR}/syng``.
- ``max_res``: The highest video resolution, that should be - ``max_res``: The highest video resolution, that should be
downloaded/streamed. Default is 720. downloaded/streamed. Default is 720.
- ``start_streaming``: If set to ``True``, the client starts streaming - ``start_streaming``: If set to ``True``, the client starts streaming