diff --git a/README.md b/README.md index 10dab93..3b089d6 100644 --- a/README.md +++ b/README.md @@ -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. * `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_. - * `mpv_options`: additional options forwarded to `mpv`. - * `show_advanced`: show advanced options in the configuration GUI. + * `buffer_in_advance`: How many songs should be buffered in advanced. + * `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. @@ -77,6 +79,7 @@ Configuration is done under `sources` → `youtube` with the following settings: * `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. * `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. ### S3 @@ -112,8 +115,11 @@ config: secret: server: https://syng.rocks 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: files: dir: . @@ -127,15 +133,16 @@ sources: endpoint: '' extensions: - mp3+cdg - index_file: ~/.cache/syng/s3-index + index_file: ${XDG_CACHE_DIR}/syng/s3-index secret_key: '' secure: true - tmp_dir: /tmp/syng + tmp_dir: ${XDG_CACHE_DIR}/syng youtube: channels: [] enabled: true start_streaming: false - tmp_dir: /tmp/syng + max_res: 720 + tmp_dir: ${XDG_CACHE_DIR}/syng ``` # Server diff --git a/syng/client.py b/syng/client.py index c47d0ef..dedf53c 100644 --- a/syng/client.py +++ b/syng/client.py @@ -61,7 +61,7 @@ def default_config() -> dict[str, Optional[int | str]]: "key": None, "buffer_in_advance": 2, "qr_box_size": 5, - "qr_position": "bottom-left", + "qr_position": "bottom-right", "show_advanced": False, } diff --git a/syng/player_libmpv.py b/syng/player_libmpv.py index 871528f..2778873 100644 --- a/syng/player_libmpv.py +++ b/syng/player_libmpv.py @@ -28,7 +28,7 @@ class QRPosition(Enum): case "bottom-right": return QRPosition.BOTTOM_RIGHT case _: - return QRPosition.BOTTOM_LEFT + return QRPosition.BOTTOM_RIGHT class Player: @@ -93,16 +93,16 @@ class Player: osd_height: int = cast(int, self.mpv.osd_height) match self.qr_position: - case QRPosition.BOTTOM_LEFT: + case QRPosition.BOTTOM_RIGHT: x_pos = osd_width - self.qr.width - 10 y_pos = osd_height - self.qr.height - 10 - case QRPosition.BOTTOM_RIGHT: + case QRPosition.BOTTOM_LEFT: x_pos = 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 y_pos = 10 - case QRPosition.TOP_RIGHT: + case QRPosition.TOP_LEFT: x_pos = 10 y_pos = 10 diff --git a/syng/sources/s3.py b/syng/sources/s3.py index 4d29aff..9bb995f 100644 --- a/syng/sources/s3.py +++ b/syng/sources/s3.py @@ -34,7 +34,7 @@ class S3Source(FileBasedSource): - ``endpoint``, ``access_key``, ``secret_key``, ``secure``, ``bucket``: These will simply be forwarded to the ``minio`` client. - ``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 files from the s3 instance to this file. If it exists, loads the list of files from this file. diff --git a/syng/sources/youtube.py b/syng/sources/youtube.py index 443a00f..b912d2d 100644 --- a/syng/sources/youtube.py +++ b/syng/sources/youtube.py @@ -19,7 +19,6 @@ from yt_dlp.utils import DownloadError from platformdirs import user_cache_dir - from ..entry import Entry from ..result import Result from .source import Source, available_sources @@ -165,7 +164,7 @@ class YoutubeSource(Source): Examples are ``/c/CCKaraoke`` or ``/channel/UCwTRjvjVge51X-ILJ4i22ew`` - ``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 downloaded/streamed. Default is 720. - ``start_streaming``: If set to ``True``, the client starts streaming