Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix 20240905 #2423

Merged
merged 4 commits into from
Sep 6, 2024
Merged

Bugfix 20240905 #2423

merged 4 commits into from
Sep 6, 2024

Conversation

itsTheFae
Copy link
Contributor

@itsTheFae itsTheFae commented Sep 6, 2024

  • I have tested my changes against the dev branch (the latest developmental version), and this pull request is targeting that branch as a base
  • I have tested my changes on Python 3.8 or higher
  • I have ensured my code is formatted using Black

Description

A few bug fixes for playnext & seek commands, as well as some tweaks to timers to prevent redundant messages.

@BabyBoySnow
Copy link
Collaborator

Did you do any testing on the playnow command to make sure it wasn't having the same behavior? I forgot to get around to it

@itsTheFae
Copy link
Contributor Author

Did you do any testing on the playnow command to make sure it wasn't having the same behavior? I forgot to get around to it

Didn't run the playnow command, but the bug was down in _cmd_play by not passing head to the underlying entry logic in playlists. So it would have similarly not queued up correctly.

@BabyBoySnow
Copy link
Collaborator

Ah ok. Does this also fix play next only working with links?

@itsTheFae
Copy link
Contributor Author

itsTheFae commented Sep 6, 2024

Ah ok. Does this also fix play next only working with links?

I haven't tested that. It should work the same as play for most things. The only thing that changed was passing the head parameter.

@BabyBoySnow
Copy link
Collaborator

Talk to you more on discord lol

@BabyBoySnow BabyBoySnow merged commit 7c49c86 into Just-Some-Bots:dev Sep 6, 2024
BabyBoySnow added a commit to BabyBoySnow/Fae-MusicBot that referenced this pull request Oct 25, 2024
* remove pre commit as a requirment

Didn't work as desired. Leaving files for those who want to use pre commit

* lnp inside of summon cmd

Sets lnp inside the summon command for various instances when it's needed.
A quality of life change surely.

* update self summon to pass message

Added setting lnp in summon, which uses message so we need to pass it in our calls.

* new black version

* update binaries

* Revert "update binaries"

This reverts commit 76e7d36.

* update binaries

* Revert "update binaries"

This reverts commit 0d3b768.

* General stability updates. (Just-Some-Bots#2394)

* just debug logs mostly

* Reorganize a little bit of logging at startup.  still debugging though.

* This should just be empty, for now...

* clean up some logs.

* no more async main in run.py.  
This refactors further signal and shutdown handling for the bot.

* Fix up pip install attempt and make code checks happy.

* Set console title in run.py main.
Improve some more logic with graceful recovery cases.
Fix some check complaints.

* More fixes for graceful startup and shutdown on windows.

* Use asyncio not self.loop.

* Ensure restart still works as expected.

* More fixes

* pylint

* restructure how on-ready fires other events.
try not to send updates while on_ready runs first time.

* fix the obviously broken bits.

* Fix --no-checks only skip optional checks.
Also log python version.

* refine some exception handling in auto playlists and on shutdown.

* Fix logic issue with auto playlist.

* improve replace in autoplaylist.

* Allow run.bat and run.sh to pass CLI args to python.
Simplify checks done in run.sh.

* Bootleg connection resumption. 
Probably still busted and shitty, but it's close.

* Fix custom log functions to use stacklevel 2 on windows.
Organize log formats in order of log level number.

* correct stacklevel ...

* Update voice_state_update warning to be more clear.

* Create player is no serialized player exists.  
oops. :)

* Ensure auto playlists actually kick off in non-serialized guild.

* run formatting and tidy up some spam.

* Move auto_pause and availability into MusicPlayer.

* Change status updates to run on disconnect again, also adds an offline status for logout/shutdown.

* Prevent deadlock if exception is thrown in signal handler.

* change guild auto pause handler to wait for connection.

* Update player.py formatting

* Update network test with ICMP ping via sub process call

* Make sure old queue.json does not stop the show.

* Use shutil.which() to get ping binary path.  Tries to catch errors from sys call.

* Make sure shutil also fails gracefully.

* proper 3.8 compatible types should be part of this too.

* Copy over some missing changes.

* Attempt to handle the discord API connection termination.

* Fix backward logic.

* Don't resume an auto-paused player when returning from network outage.

* Fix race condition in unpause check.

* remove entry_added check in favor of check on play

* refactor playlist entry meta and handle auto-playlist expansion of playlist links differently.
also disables extraction logs.
also adds indicator for autoplaylist entries, though none should be enqueued to playlist queue now.

* Try to avoid excessive auto-pause retry when player is being discarded/reconnected.

* Attempt to rejoin on API termination when configured to auto-join.
If auto-join bot is moved, attempt to join old channel instead.

* remove redundant calls to finish_playing event.

* Fix error with rouge player check in disconnect_all_voice_clients

* Now playing messages should not repeat on reconnect.

* fix erroneous logic in last_np_msg content check.

* dyslexic logic strikes again.  gotta love it.

* Add more sanity checks to play-invoked unpause.
Allow unpause check to trigger summon if perms.summonplay is set.

* update self summon to pass message

Added setting lnp in summon, which uses message so we need to pass it in our calls.

* lnp inside of summon cmd

Sets lnp inside the summon command for various instances when it's needed.
A quality of life change surely.

* last_np_msg should actually compare the content of embed and not just the hash in the collection.

I'm an idiot. : )

* Track last played song subject for better control of last now playing message.

* format fix

* Respect queue persist option, and make sure auto-playlist starts without a queue.

---------

Co-authored-by: Snow <135516526+BabyBoySnow@users.noreply.github.com>

* use essentials build

Use a newer binary file.

* Updates for the Installer and Updater scripts. (Just-Some-Bots#2395)

* Updates for installer and update scripts.
Adds ffmpeg install step to install.ps1 using winget tool
Installers now prompt before installing.
SysD service file requires user and group settings.

* Update requirements.txt to use voice and speed options for discord.py repo pull.

* Round robin patch (Just-Some-Bots#2396)

* Fix index errors in reorder_for_round_robin function.

* Update comments

* Add commands for config and permission editing and reloading. (Just-Some-Bots#2397)

* Add commands for config and permission editing and reloading.
Refactors how options are registered, and adds a new dependency configupdater.

* Update example_options.ini

* Some fixes for setperms

* remove unused bootstrap and travis files. (Just-Some-Bots#2400)

* Installer updates (Just-Some-Bots#2401)

* Update install.sh to work in cloned directory.

* Update install.ps1 to work in cloned directory, and clean up some output.

* Update install.bat to be more informative and less lazy.

* Update run.py to show pip packages when checking, and handle missing discord.py when extensions are installed.

* Tidy up comments

* Update comment for disk check option.

* Don't forget TerminateSignal can set an exit code now.

* Remove refreshenv call

* Seek and speed features (Just-Some-Bots#2402)

* Adds seeking and playback speed support.

* Update example_options.ini

* Add relative seek.

* Add multi-playlist support and local media support. (Just-Some-Bots#2403)

* Bug fixes, QOL tweaks, and code clean up. (Just-Some-Bots#2404)

* Bug fixes, QOL tweaks, and code clean up.

* Fix regression of relative seek.

* Add the follow command

* Add latency and botlatency commands. (Just-Some-Bots#2406)

* Add uptime command (Just-Some-Bots#2407)

Co-authored-by: Snow <135516526+BabyBoySnow@users.noreply.github.com>

* fix broken resolve

* add some with multiple

add latency as ping

* Provide option for auto-unpause, default off. (Just-Some-Bots#2408)

* Provide option for auto-unpause, default off.

* Add option to example_options.ini

* add sub command reset

adds an option to reset config options to default as defined in ConfigDefaults.

Maybe find a way to create option_defaults.ini for use here?

* Update some command help text.

* Potentially fix high-cpu deadlock bug. (Just-Some-Bots#2411)

* Attempt to squash the high-cpu bug.
- Make play calls explicit, rather than implied through adding entries.
- Handle player errors and ensure progress of queue or autoplaylist.
- Prevent early garbage collection of created async tasks.
- Run shutdown on downloader thread pool.  Waits threads rather than let them dangle.
- Reduce usage of infinite loops and update some logging.

* Make pylint happy with 3.8 compatible call.

* Ensure task exceptions are retrieved by the done callback.

* Try to read ffmpeg stderr stream until playback stops or an exception is set.

* return player to stopped state for playback finished or it wont restart later...

* Deal with aiohttp client errors in the safe_*_message functions...

* Move stderr future checking before the return statements in _playback_finished callback.
Otherwise that could loop infinitely...

* Bug-fixes and more options. (Just-Some-Bots#2416)

* Add technical support for cookies.txt passed to yt-dlp.  For those who know the risks and want to take them.

* Remove unused code.

* Fix to_ini for debug level config

* Add dev-only command to make markdown from config / permissions code.

* Fix AttributeError with out-of-date colorama on windows.

* Fix exception handling if aiohttp import fails.

* Add ffmpeg start-up check.

* Ensure windows has colorama 0.4.6+ if colorlog does not require it.

* Change version constant and modification detection logic.

* remove todo

* Add support for spaces in aliased commands, enabling commands with pre-defined arguments to be aliased as well as simple renames.

* format

* More format changes.

* Make debug command more debug-y

* Create some UA string "options" via constants.  
These are not recommended to be changed.  Basically only for debug / ye-who-knows.
I will not provide ANY support for these, use them at your own risk!

* add note about PCMVolumeTransformer

* format & lint

* Pre-download next track in queue.
Does not affect autoplaylist tracks, as they are added 1x1 while q is empty.

* format

* lints

* Add option for status message to count paused players, off by default.

* Make pre-download happen a tad later to reduce network congestion for current entry playback.
Note that this seems to create some jitter in audio playback while download is ongoing.

* Better checks for player inactivity.

* Remove TODO and format.

* Remove bogus statement about {n_paused} status message variable.

* Experimental proxy option for ytdlp.

* Add UA changing option to ini config.

* Revise options and help texts for PR Just-Some-Bots#2416

* Cookie management command & bug fix (Just-Some-Bots#2417)

* Add owner-only command to manage cookies.

* Ensure ytdlp rotates UA strings with each request, while not set static.

* Add warning to setcookies help text.

* Make header check timeout errors graceful.

* format

* Change MusicBot to bot's username in uptime command.

* format and lint

* Fix typo and copy-paste blunder.

* Windows patches 2024-08-05 (Just-Some-Bots#2418)

* Fix windows install.ps1 hanging if winget terms are not accepted yet.
Minor changes to description / informative text.

* Update requirements.txt for windows aiodns bug.

* Fix missing playback_speed on streamed entries. (Just-Some-Bots#2419)

* Ytdlp oauth2 plugin integration (Just-Some-Bots#2421)

* Commit original code with notice of origin and license.

* format original source code

* Integrate the OAuth2 plugin as optional.  
Uses original library if it is installed, to prevent conflicts and provide easier testing.

* fix typo with importlib.

* Updates for lint / formatting.

* Enable ytdlp logging with original oauth2 plugin.
Updates the warning about original plugin use.

* handle ModuleNotFoundError when checking for OAuth2 plugin.

* Address the extractor permissions being too strict and thus confusing.
This also updates some inconsistent documentation and logic around allowing all extractors.

* Update Examples and adjust config parser. (Just-Some-Bots#2422)

* make sure to set default value in new example options.

* update some example options.
tweak how getbool fails.
add getstr for explicit strip of whitespace and fallback on empty.

* Bugfix 20240905 (Just-Some-Bots#2423)

* Fix relative seek and improve feedback of seek command.

* format seek time floats

* Fix playnext not respecting playlists

* ignore activity timer when voice client is already disconnected

* speed handled upstream

since we pull directly, no need to wait to revert this until it's pushed to pypi

* Installer updates mostly (Just-Some-Bots#2428)

* Add Ubuntu 24.xx installer.
Minor update to debian 12 & added 13 - needs testing.

* Make run.sh and update.sh check for venv.

* More compatibility with venv installs

* do testing with debian, and update --list

* Add PopOS 24.04 and Shellcheck updates

* add default case to pop OS

* Add detected OS to install.sh --list

* Allow bypass of system package steps or of musicbot install steps.

* more tweaks and options

* use pypi discord.py

* try to add install path option

* no = supported here

* Move the default check.

* Clean up service install. 
Remove cli alias as unsupported.
Adjust post install message for venv.
Add --no-sudo option.

* more service install tweaks

* output formatting

* don't touch options.ini if it exists already.
fix copy and sed.

* service setup assumes previous cd to clone dir.

* Turn the template into just an example file.
Installer now has its own internal template to generate service files.

* add / change warning about install directory with --service option.

* more output tweaks

* Ap add all (itsTheFae#6)

Adds new sub-command as `autoplaylist [+ | add] all` which allows users to add all songs in the queue to the auto playlist. 

Conflicts:
	musicbot/bot.py

* Use discord via git repo ... test test test






I should have left the installers broken...

* Add some root/sudo checks.

* Try to install winget and restart for env vars.

* Fix env vars maybe, add file extension un-hide logic

* Add anybranch option, fix ffmpeg error when installed but no update.

* Install path and cleaning output.

* fix winget issues with ffmpeg

* set appropriate repo url.

* checks

* add certificate pre-fetch to installer...

* add lock to summon.
also tidy code

* Fix extractor checks to work with and without plugins like oauth2.
SpotifyPlaylist objects only allow track member types.

* fix summon message on stream

* Status msg total should use player count when paused counting is not enabled.

* add request to speak logic

* Move to a function instead

* needs some tlc but sufficient

it's really glitchy, and needs cleaned up most likely

* refactor stage handling

update to handle case where we're moved to audience by a staff

* add some comments

remove one

* unify behavior

* add todo

* follow similar patterns

* it's not always staff

* prevent blocking

uses unique key to make sure we don't block connecting to stages in different servers

* black it

---------

Co-authored-by: Fae <itsthefae@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants