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

[V3 Audio] Add track length restriction #2465

Merged
merged 4 commits into from Feb 24, 2019

Conversation

@aikaterna
Copy link
Member

commented Feb 17, 2019

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

  • Added [p]audioset maxlength, which takes seconds or 00:00-style of formatted input for restricting the player to songs that have a length under that threshold.

aikaterna added some commits Feb 17, 2019

Update settings display for maxlength
Extra whitespace on title headers is to prevent setting output from wrapping on desktop clients.
async def maxlength(self, ctx, seconds):
"""Max length of a track to queue in seconds. 0 to disable.
Accepts seconds or a value formatted like 00:00:00 (h:m:s) or 00:00 (m:s).

This comment has been minimized.

Copy link
@TrustyJAID

TrustyJAID Feb 21, 2019

Member

(h:m:s) should be (hh:mm:ss) or (h\\:m\\:s) otherwise discord renders the :m: as an emoji. Alternatively surround the time markers with backticks.

return True

async def _time_convert(self, length):
match = re.compile(r"(?:(\d+):)?([0-5][0-9]):([0-5][0-9])").match(length)

This comment has been minimized.

Copy link
@TrustyJAID

TrustyJAID Feb 21, 2019

Member

Replacing this regex with (?:(\d+):)?([0-5]?[0-9]):([0-5][0-9]) can help improve usability where users can supply 8:00 instead of 08:00 for setting the max length a minor usability change.

This comment has been minimized.

Copy link
@aikaterna

aikaterna Feb 23, 2019

Author Member

Thank you for this.

length = round(track.length / 1000)
except AttributeError:
length = round(track / 1000)
if length > 259200:

This comment has been minimized.

Copy link
@TrustyJAID

TrustyJAID Feb 21, 2019

Member

I'm curious about this and if it might have potential problems. Is this in case we're playing a live stream we don't care about the maxlength? Will this cause issues for streams that don't return a value of 72 hours?

This comment has been minimized.

Copy link
@aikaterna

aikaterna Feb 23, 2019

Author Member

Decided to move this value more towards the upper limit instead and added a comment regarding livestream length.

@TrustyJAID
Copy link
Member

left a comment

Working good after testing changes.

@Tobotimus Tobotimus added QA: Passed and removed QA: Needed labels Feb 24, 2019

@Tobotimus Tobotimus merged commit b0ab6bd into Cog-Creators:V3/develop Feb 24, 2019

1 check passed

Travis CI - Pull Request Build Passed
Details

@aikaterna aikaterna deleted the aikaterna:patch-6 branch Feb 24, 2019

@aikaterna aikaterna referenced this pull request Mar 6, 2019
1 of 3 tasks complete

Tobotimus added a commit that referenced this pull request Mar 7, 2019

[Audio] Add songs when search-queuing (#2513)
Searching for a song and pressing the reaction to queue a song would not add the song to the queue if `[p]audioset maxlength` was off. This was an omission from #2465.

Tobotimus added a commit that referenced this pull request Mar 10, 2019

[Audio] Seek command can now seek to position (#2470)
- Seek can now seek to a specific position, formatted like 00:00:00 or 00:00. Using negative or positive ints still functions the same as previously and will seek ahead or behind by that value instead.
- This PR requires the `_time_convert` func added in #2465 and should be merged after that one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.