Skip to content

feat: Add function to get elapsed time of playing audio on VoiceClient#2587

Merged
Lulalaby merged 14 commits into
Pycord-Development:masterfrom
felix920506:feat-player-elapsed-time
Oct 11, 2024
Merged

feat: Add function to get elapsed time of playing audio on VoiceClient#2587
Lulalaby merged 14 commits into
Pycord-Development:masterfrom
felix920506:feat-player-elapsed-time

Conversation

@felix920506

@felix920506 felix920506 commented Sep 23, 2024

Copy link
Copy Markdown
Contributor

Summary

Adds a function to get the elapsed seconds of currently playing audio file

Information

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.

@felix920506
felix920506 requested a review from a team as a code owner September 23, 2024 02:35
@pullapprove4
pullapprove4 Bot requested a review from Dorukyum September 23, 2024 02:35
@felix920506 felix920506 changed the title feat: Add function to get elapsed time of playing audio feat: Add function to get elapsed time of playing audio on VoiceClient Sep 23, 2024
@JustaSqu1d

Copy link
Copy Markdown
Member

Seconds seem really inflexible, what if we returned a datetime.timedelta object instead?

@felix920506

Copy link
Copy Markdown
Contributor Author

Sounds reasonable

@felix920506

Copy link
Copy Markdown
Contributor Author

Can I have a review on this?

Comment thread discord/player.py Outdated
@felix920506
felix920506 requested a review from Dorukyum October 5, 2024 00:46
@felix920506

Copy link
Copy Markdown
Contributor Author

Changed to use loops + an offset to keep track of when loops gets reset

Comment thread discord/voice_client.py Outdated

@Dorukyum Dorukyum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find client.elapsed() to be clearer and simpler, what do you think?

Comment thread CHANGELOG.md Outdated
Comment thread discord/voice_client.py Outdated
Comment thread discord/voice_client.py Outdated
@felix920506

Copy link
Copy Markdown
Contributor Author

I don't have any preference between client.elapsed() or client.played_time()
If you think client.elapsed() is better then let's use that

Co-authored-by: Dorukyum <[email protected]>
Signed-off-by: felix920506 <[email protected]>
@Lulalaby
Lulalaby merged commit 9a83a2a into Pycord-Development:master Oct 11, 2024
baribarton pushed a commit to baribarton/pycord-no-potential-reconnect that referenced this pull request Oct 24, 2024
Pycord-Development#2587)

* add played_seconds function

* Update CHANGELOG.md

* style(pre-commit): auto fixes from pre-commit.com hooks

* use datetime.timedelta instead of int

* add comment

* style(pre-commit): auto fixes from pre-commit.com hooks

* rename function to reflect change

* style(pre-commit): auto fixes from pre-commit.com hooks

* don't use different counter

* Update discord/voice_client.py

Signed-off-by: Dorukyum <[email protected]>

* Apply suggestions from code review

Co-authored-by: Dorukyum <[email protected]>
Signed-off-by: felix920506 <[email protected]>

---------

Signed-off-by: felix920506 <[email protected]>
Signed-off-by: Dorukyum <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dorukyum <[email protected]>
OmLanke pushed a commit to OmLanke/pycord that referenced this pull request Dec 16, 2024
Pycord-Development#2587)

* add played_seconds function

* Update CHANGELOG.md

* style(pre-commit): auto fixes from pre-commit.com hooks

* use datetime.timedelta instead of int

* add comment

* style(pre-commit): auto fixes from pre-commit.com hooks

* rename function to reflect change

* style(pre-commit): auto fixes from pre-commit.com hooks

* don't use different counter

* Update discord/voice_client.py

Signed-off-by: Dorukyum <[email protected]>

* Apply suggestions from code review

Co-authored-by: Dorukyum <[email protected]>
Signed-off-by: felix920506 <[email protected]>

---------

Signed-off-by: felix920506 <[email protected]>
Signed-off-by: Dorukyum <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dorukyum <[email protected]>
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.

4 participants