Skip to content

Commit

Permalink
fix: change buffer_size to be measured in kb
Browse files Browse the repository at this point in the history
  • Loading branch information
vicwomg committed Jan 3, 2025
1 parent 8134e2c commit 3985511
Show file tree
Hide file tree
Showing 14 changed files with 291 additions and 284 deletions.
9 changes: 8 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ If you want to support this project with a little monetary tip, it's much apprec
- OSX
- Windows
- Linux
- Docker - [See official Dockerhub repo](https://hub.docker.com/repository/docker/vicwomg/pikaraoke)

## Docker instructions

Expand All @@ -51,6 +50,8 @@ For Docker users, you can get going with one command. The deployed images includ
docker run vicwomg/pikaraoke:latest
```

For more information, [see official Dockerhub repo](https://hub.docker.com/repository/docker/vicwomg/pikaraoke)

## Native installation

### Install required programs
Expand Down Expand Up @@ -133,6 +134,12 @@ poetry install
poetry run pikaraoke
```

If you don't want to install poetry, you can alternately install pikaraoke directly from the source code root:

```sh
pip install .
```

See the [Pikaraoke development guide](https://github.com/vicwomg/pikaraoke/wiki/Pikaraoke-development-guide) for more details.

## Troubleshooting and guides
Expand Down
4 changes: 2 additions & 2 deletions pikaraoke/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ def main():
default_log_level = logging.INFO
default_prefer_hostname = False
default_bg_music_volume = 0.3
default_buffer_size = 150000
default_buffer_size = 150

default_dl_dir = get_default_dl_dir(platform)
default_youtubedl_path = "yt-dlp"
Expand Down Expand Up @@ -1026,7 +1026,7 @@ def main():
parser.add_argument(
"-b",
"--buffer-size",
help=f"Buffer size for transcoded video (in bytes). Increase if you experience songs cutting off early. Higher size will transcode more of the file before streaming it to the client. This will increase the delay before playback begins. This value is ignored if --complete-transcode-before-play was specified. Default is: {default_buffer_size}",
help=f"Buffer size for transcoded video (in kilobytes). Increase if you experience songs cutting off early. Higher size will transcode more of the file before streaming it to the client. This will increase the delay before playback begins. This value is ignored if --complete-transcode-before-play was specified. Default is: {default_buffer_size}",
default=default_buffer_size,
type=int,
required=False,
Expand Down
6 changes: 3 additions & 3 deletions pikaraoke/karaoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def __init__(
volume=0.85,
normalize_audio=False,
complete_transcode_before_play=False,
buffer_size=2000000,
buffer_size=150,
log_level=logging.DEBUG,
splash_delay=2,
youtubedl_path="/usr/local/bin/yt-dlp",
Expand Down Expand Up @@ -173,7 +173,7 @@ def __init__(
default volume: {self.volume}
normalize audio: {self.normalize_audio}
complete transcode before play: {self.complete_transcode_before_play}
buffer size: {self.buffer_size}
buffer size (kb): {self.buffer_size}
youtube-dl path: {self.youtubedl_path}
logo path: {self.logo_path}
log_level: {log_level}
Expand Down Expand Up @@ -612,7 +612,7 @@ def play_file(self, file_path, semitones=0):
try:
output_file_size = os.path.getsize(fr.output_file)
if not self.complete_transcode_before_play:
is_buffering_complete = output_file_size > self.buffer_size
is_buffering_complete = output_file_size > self.buffer_size * 1000
if is_buffering_complete:
logging.debug(f"Buffering complete. File size: {output_file_size}")
break
Expand Down
92 changes: 46 additions & 46 deletions pikaraoke/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2025-01-02 17:38-0800\n"
"POT-Creation-Date: 2025-01-03 00:00-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -104,119 +104,119 @@ msgid "Song will appear in the \"available songs\" list."
msgstr ""

#. Message shown after trying to delete a song that is in the queue.
#: app.py:485
#: app.py:494
msgid "Error: Can't delete this song because it is in the current queue"
msgstr ""

#. Message shown after deleting a song. Followed by the song path
#: app.py:493
#: app.py:502
#, python-format
msgid "Song deleted: %s"
msgstr ""

#. Message shown after trying to delete a song without specifying the song.
#: app.py:496
#: app.py:505
msgid "Error: No song specified!"
msgstr ""

#. Message shown after trying to edit a song that is in the queue.
#: app.py:503
#: app.py:512
msgid "Error: Can't edit this song because it is in the current queue: "
msgstr ""

#. Message shown after trying to rename a file to a name that already exists.
#: app.py:531
#: app.py:540
#, python-format
msgid "Error renaming file: '%s' to '%s', Filename already exists"
msgstr ""

#. Message shown after renaming a file.
#: app.py:539
#: app.py:548
#, python-format
msgid "Renamed file: %s to %s"
msgstr ""

#. Message shown after trying to edit a song without specifying the filename.
#: app.py:544
#: app.py:553
msgid "Error: No filename parameters were specified!"
msgstr ""

#: app.py:608
#: app.py:617
msgid "CPU usage query unsupported"
msgstr ""

#. Message shown after starting the youtube-dl update.
#: app.py:692
#: app.py:701
msgid "Updating youtube-dl! Should take a minute or two... "
msgstr ""

#. Message shown after trying to update youtube-dl without admin permissions.
#: app.py:699
#: app.py:708
msgid "You don't have permission to update youtube-dl"
msgstr ""

#. Message shown after trying to refresh the song list without admin
#. permissions.
#. Message shown after trying to shut down the system without admin
#. permissions.
#: app.py:709 app.py:739
#: app.py:718 app.py:748
msgid "You don't have permission to shut down"
msgstr ""

#. Message shown after quitting pikaraoke.
#: app.py:717
#: app.py:726
msgid "Exiting pikaraoke now!"
msgstr ""

#. Message shown after trying to quit pikaraoke without admin permissions.
#: app.py:724
#: app.py:733
msgid "You don't have permission to quit"
msgstr ""

#. Message shown after shutting down the system.
#: app.py:732
#: app.py:741
msgid "Shutting down system now!"
msgstr ""

#. Message shown after rebooting the system.
#: app.py:747
#: app.py:756
msgid "Rebooting system now!"
msgstr ""

#. Message shown after trying to reboot the system without admin permissions.
#: app.py:754
#: app.py:763
msgid "You don't have permission to Reboot"
msgstr ""

#. Message shown after expanding the filesystem.
#: app.py:762
#: app.py:771
msgid "Expanding filesystem and rebooting system now!"
msgstr ""

#. Message shown after trying to expand the filesystem on a non-raspberry pi
#. device.
#: app.py:767
#: app.py:776
msgid "Cannot expand fs on non-raspberry pi devices!"
msgstr ""

#. Message shown after trying to expand the filesystem without admin
#. permissions
#: app.py:770
#: app.py:779
msgid "You don't have permission to resize the filesystem"
msgstr ""

#. Message shown after trying to change preferences without admin permissions.
#: app.py:785
#: app.py:794
msgid "You don't have permission to change preferences"
msgstr ""

#. Message shown after trying to clear preferences without admin permissions.
#: app.py:799
#: app.py:808
msgid "You don't have permission to clear preferences"
msgstr ""

#. Message shown after trying to stream a file that does not exist.
#: app.py:860
#: app.py:867
msgid "File not found."
msgstr ""

Expand Down Expand Up @@ -681,11 +681,11 @@ msgstr ""
msgid "Limit of songs an individual user can add to the queue (0 = unlimited)"
msgstr ""

#. Numberbox label for setting the buffer size in bytes
#. Numberbox label for setting the buffer size in kilobytes
#: templates/info.html:248
msgid ""
"Buffer size in bytes. Transcode this amount of the video before sending "
"it to the splash screen. "
"Buffer size in kilobytes. Transcode this amount of the video before "
"sending it to the splash screen. "
msgstr ""

#. Help text explaining when videos will be transcoded
Expand Down Expand Up @@ -955,99 +955,99 @@ msgid ""
msgstr ""

#. Score review message
#: templates/splash.html:53
#: templates/splash.html:54
msgid "Never sing again... ever."
msgstr ""

#. Score review message
#: templates/splash.html:54
#: templates/splash.html:55
msgid "That was a really good impression of a dying cat!"
msgstr ""

#. Score review message
#: templates/splash.html:55
#: templates/splash.html:56
msgid "Thank God it's over."
msgstr ""

#. Score review message
#: templates/splash.html:56
#: templates/splash.html:57
msgid "Pass the mic, please!"
msgstr ""

#. Score review message
#: templates/splash.html:57
#: templates/splash.html:58
msgid "Well, I'm sure you're very good at your day job."
msgstr ""

#. Score review message
#: templates/splash.html:60
#: templates/splash.html:61
msgid "I've seen better."
msgstr ""

#. Score review message
#: templates/splash.html:61
#: templates/splash.html:62
msgid "Ok... just ok."
msgstr ""

#. Score review message
#: templates/splash.html:62
#: templates/splash.html:63
msgid "Not bad for an amateur."
msgstr ""

#. Score review message
#: templates/splash.html:63
#: templates/splash.html:64
msgid "You put on a decent show."
msgstr ""

#. Score review message
#: templates/splash.html:64
#: templates/splash.html:65
msgid "That was... something."
msgstr ""

#. Score review message
#: templates/splash.html:67
#: templates/splash.html:68
msgid "Congratulations! That was unbelievable!"
msgstr ""

#. Score review message
#: templates/splash.html:68
#: templates/splash.html:69
msgid "Wow, have you tried auditioning for The Voice?"
msgstr ""

#. Score review message
#: templates/splash.html:69
#: templates/splash.html:70
msgid "Please, sing another one!"
msgstr ""

#. Score review message
#: templates/splash.html:70
#: templates/splash.html:71
msgid "You rock! You know that?!"
msgstr ""

#. Score review message
#: templates/splash.html:71
#: templates/splash.html:72
msgid "Woah, who let Freddie Mercury in here?"
msgstr ""

#. Label for the next song to be played in the queue.
#: templates/splash.html:182 templates/splash.html:461
#: templates/splash.html:209 templates/splash.html:501
msgid "Up next:"
msgstr ""

#. Label of the singer for next song to be played in the queue. (Who added it
#. to the queue.)
#. Label for the next singer in the queue.
#: templates/splash.html:184 templates/splash.html:468
#: templates/splash.html:211 templates/splash.html:508
msgid "Next singer:"
msgstr ""

#. The title of the score screen, telling the user their singing score
#: templates/splash.html:484
#: templates/splash.html:524
msgid "Your Score"
msgstr ""

#. Prompt for interaction in order to enable video autoplay.
#: templates/splash.html:498
#: templates/splash.html:538
msgid ""
"Due to limititations with browser permissions, you must interact\n"
" with the page once before it allows autoplay of videos. Pikaraoke "
Expand All @@ -1057,6 +1057,6 @@ msgid ""
msgstr ""

#. Button to confirm to enable video autoplay.
#: templates/splash.html:510
#: templates/splash.html:550
msgid "Confirm"
msgstr ""
4 changes: 2 additions & 2 deletions pikaraoke/templates/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ <h4 style="margin-top: 20px">{# MSG: Title text for the server settings section
</div>

<div class="user-preference-container">
<input id="pref-buffer-size" class="user-preference-input" type="number" min="0" max="999999999" data-pref="buffer_size" data-start-value="{{ buffer_size }}" value="{{ buffer_size }}" />
<input id="pref-buffer-size" class="user-preference-input" type="number" min="0" max="9999" data-pref="buffer_size" data-start-value="{{ buffer_size }}" value="{{ buffer_size }}" />
<label class="label">
{# MSG: Numberbox label for setting the buffer size in bytes #} {% trans %}Buffer size in bytes. Transcode this amount of the video before sending it to the splash screen. {% endtrans %}
{# MSG: Numberbox label for setting the buffer size in kilobytes #} {% trans %}Buffer size in kilobytes. Transcode this amount of the video before sending it to the splash screen. {% endtrans %}
</label>
</div>

Expand Down
Loading

0 comments on commit 3985511

Please sign in to comment.