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

createProgressBar options #1757

Merged
merged 6 commits into from Jul 5, 2023
Merged

createProgressBar options #1757

merged 6 commits into from Jul 5, 2023

Conversation

chimnayajith
Copy link
Contributor

Changes

Additional two options for played time ( leftChar ) and for unplayed time (rightChar) . As it is for the line it goes to ▬ when not provided

Status

image

Progress bar can have different characters for played and un-played durations
@vercel
Copy link

vercel bot commented Jul 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
discord-player-website ⬜️ Ignored (Inspect) Jul 5, 2023 1:47am

@twlite twlite added the area:main Related to discord-player label Jul 4, 2023
if (timecodes) {
return `${timestamp.current.label} ${bar.join('')} ${timestamp.total.label}`;
return `${timestamp.current.label} \u2503 ${bar.join("")} \u2503 ${timestamp.total.label}`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

could we add an option for \u2503 as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea so then it could be

createProgressBar(options) {
  const timestamp = this.getTimestamp();
  if (!timestamp)
    return null;
  const { indicator = "\u{1F518}", leftChar = "\u25AC", rightChar = "\u25AC", length = 15, timecodes = true, separator = "\u2503" } = options || {};
  if (isNaN(length) || length < 0 || !Number.isFinite(length)) {
    throw Exceptions.ERR_OUT_OF_RANGE("[PlayerProgressBarOptions.length]", String(length), "0", "Finite Number");
  }
  const index = Math.round(timestamp.current.value / timestamp.total.value * length);
  if (index >= 1 && index <= length) {
    const bar = leftChar.repeat(index - 1).split("");
    bar.push(indicator);
    bar.push(rightChar.repeat(length - index));
    if (timecodes) {
      return `${timestamp.current.label} ${separator} ${bar.join("")} ${separator} ${timestamp.total.label}`;
    } else {
      return `${bar.join("")}`;
    }
  } else {
    if (timecodes) {
      return `${timestamp.current.label} ${separator} ${indicator}${rightChar.repeat(length - 1)} ${separator} ${timestamp.total.label}`;
    } else {
      return `${indicator}${rightChar.repeat(length - 1)}`;
    }
  }
}

} else {
return `${bar.join('')}`;
return `${bar.join("")}`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like formatting is not done, could you run yarn format from the root?

* @property {string} [indicator] The indicator
*/
export interface PlayerProgressbarOptions {
timecodes?: boolean;
length?: number;
line?: string;
leftChar?: string;
rightChar? : string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
rightChar? : string;
rightChar?: string;

line?: string;
leftChar?: string;
rightChar? : string;
separator? : string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
separator? : string;
separator?: string;

@Crocross
Copy link
Contributor

Crocross commented Jul 5, 2023

I forgot all about changing progress bar stuff.
This makes sense to me, similar to my previous idea from Discord!

Thanks for doing this cause I completely forgot. I originally had the following:

  • indicator
  • length
  • emptyLine
  • filledLine
  • timecodes
  • timecodeSeparator

Which I think is all covered :)

Copy link
Collaborator

@twlite twlite left a comment

Choose a reason for hiding this comment

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

LGTM!

@twlite twlite merged commit 36ff0c0 into Androz2091:master Jul 5, 2023
2 checks passed
github-merge-queue bot pushed a commit to PixelPizza/OurTube that referenced this pull request Jul 15, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [discord-player](https://discord-player.js.org)
([source](https://togithub.com/Androz2091/discord-player)) | [`^5.4.0`
->
`^6.6.1`](https://renovatebot.com/diffs/npm/discord-player/5.4.0/6.6.1)
|
[![age](https://badges.renovateapi.com/packages/npm/discord-player/6.6.1/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/discord-player/6.6.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/discord-player/6.6.1/compatibility-slim/5.4.0)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/discord-player/6.6.1/confidence-slim/5.4.0)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>Androz2091/discord-player (discord-player)</summary>

###
[`v6.6.1`](https://togithub.com/Androz2091/discord-player/releases/tag/discord-player%406.6.1)

[Compare
Source](https://togithub.com/Androz2091/discord-player/compare/discord-player@6.6.0...discord-player@6.6.1)

#### What's Changed

- docs(resource): update flowease's discord-player version in
showcase.ts by [@&#8203;Lutra-Fs](https://togithub.com/Lutra-Fs) in
[Androz2091/discord-player#1755
- Fix typo for userVoiceChannel in the documention by
[@&#8203;L0SER8228](https://togithub.com/L0SER8228) in
[Androz2091/discord-player#1756
- createProgressBar options by
[@&#8203;chimnayajith](https://togithub.com/chimnayajith) in
[Androz2091/discord-player#1757
- feat: introduce BridgeSource by
[@&#8203;skdhg](https://togithub.com/skdhg) in
[Androz2091/discord-player#1760

#### New Contributors

- [@&#8203;Lutra-Fs](https://togithub.com/Lutra-Fs) made their first
contribution in
[Androz2091/discord-player#1755
- [@&#8203;chimnayajith](https://togithub.com/chimnayajith) made their
first contribution in
[Androz2091/discord-player#1757

**Full Changelog**:
https://github.com/Androz2091/discord-player/compare/[@&#8203;discord-player/equalizer](https://togithub.com/discord-player/equalizer)[@&#8203;0](https://togithub.com/0).2.2...discord-player@6.6.1

###
[`v6.6.0`](https://togithub.com/Androz2091/discord-player/releases/tag/discord-player%406.6.0)

[Compare
Source](https://togithub.com/Androz2091/discord-player/compare/discord-player@6.5.0...discord-player@6.6.0)

#### What's Changed

- docs(resources): add Mirasaki Music Bot by
[@&#8203;Mirasaki](https://togithub.com/Mirasaki) in
[Androz2091/discord-player#1745
- Bump community resource version by
[@&#8203;Mirasaki](https://togithub.com/Mirasaki) in
[Androz2091/discord-player#1748
- 📝 Fix broken URL in document by
[@&#8203;GreenScreen410](https://togithub.com/GreenScreen410) in
[Androz2091/discord-player#1752
- refactor: website rewrite by
[@&#8203;skdhg](https://togithub.com/skdhg) in
[Androz2091/discord-player#1753
-   feat: `channelPopulate` and friends

#### New Contributors

- [@&#8203;Mirasaki](https://togithub.com/Mirasaki) made their first
contribution in
[Androz2091/discord-player#1745

**Full Changelog**:
https://github.com/Androz2091/discord-player/compare/[@&#8203;discord-player/extractor](https://togithub.com/discord-player/extractor)[@&#8203;4](https://togithub.com/4).3.1...discord-player@6.6.0

###
[`v6.5.0`](https://togithub.com/Androz2091/discord-player/releases/tag/discord-player%406.5.0)

[Compare
Source](https://togithub.com/Androz2091/discord-player/compare/discord-player@6.4.0...discord-player@6.5.0)

### Changelog

- fix(QueryResolver): spotify playlists were treated as youtube
playlists
-   feat(GuildQueueEvents): add `willPlayTrack` event
- types(GuildQueueEvent): make events constant usable in event listener
-   feat(GuildQueue): expose `maxSize` and `maxHistorySize`
-   feat(GuildQueue): add `options.preferBridgedMetadata`
-   fix(Track): resolve `null` upon metadata query failure
-   feat(GuildQueuePlayerNode): add `.totalDuration` getter
-   feat(GuildQueuePlayerNode): implement `StreamConfig`

##### Example of `willPlayTrack` event

```ts
// listening to this event pauses discord-player's execution process until `done()` is invoked
player.events.on(GuildQueueEvent.willPlayTrack, (queue, track, config, done) => {
    // set volume to 30%
    config.dispatcherConfig.volume = 30;

    // seek to 20 seconds before playing
    config.playerConfig.seek = 20;
    
    // tell discord-player to resume execution process
    return done();
});
```

**Full Changelog**:
https://github.com/Androz2091/discord-player/compare/[@&#8203;discord-player/extractor](https://togithub.com/discord-player/extractor)[@&#8203;4](https://togithub.com/4).3.0...discord-player@6.5.0

###
[`v6.4.0`](https://togithub.com/Androz2091/discord-player/releases/tag/discord-player%406.4.0)

[Compare
Source](https://togithub.com/Androz2091/discord-player/compare/discord-player@6.3.1...discord-player@6.4.0)

#### What's Changed

-   feat: track metadata api
-   fix: spotify regex
-   feat: bridge query resolver
-   feat: track metadata api
-   feat: introduce play method on tracks and queues
-   feat: allow audio player options on play method
-   feat: error codes
- Update my community bot version and description by
[@&#8203;L0SER8228](https://togithub.com/L0SER8228) in
[Androz2091/discord-player#1742

**Full Changelog**:
https://github.com/Androz2091/discord-player/compare/discord-player@6.3.1...discord-player@6.4.0

###
[`v6.3.1`](https://togithub.com/Androz2091/discord-player/releases/tag/discord-player%406.3.1)

[Compare
Source](https://togithub.com/Androz2091/discord-player/compare/discord-player@6.3.0...discord-player@6.3.1)

#### What's Changed

-   fix(FFmpeg): unexpected error from ffmpeg locator
- feat(PlayerInitOptions): add `useFFmpegLegacy` option to utilize
`prism-media`'s ffmpeg
- Update community bot Music-Disc version by
[@&#8203;hmes98318](https://togithub.com/hmes98318) in
[Androz2091/discord-player#1737
- Added my bot by [@&#8203;L0SER8228](https://togithub.com/L0SER8228) in
[Androz2091/discord-player#1739

**Full Changelog**:
https://github.com/Androz2091/discord-player/compare/[@&#8203;discord-player/extractor](https://togithub.com/discord-player/extractor)[@&#8203;4](https://togithub.com/4).2.2...discord-player@6.3.1

###
[`v6.3.0`](https://togithub.com/Androz2091/discord-player/releases/tag/discord-player%406.3.0)

[Compare
Source](https://togithub.com/Androz2091/discord-player/compare/discord-player@6.2.1...discord-player@6.3.0)

#### What's Changed

- feat: add custom ffmpeg implementation (supporting more ffmpeg
binaries)
-   fix: proper validation for leaveOnEnd
- fix(Player): set query cache properly by
[@&#8203;skdhg](https://togithub.com/skdhg) in
[Androz2091/discord-player#1721
- Update Docs to reflect autoRegisterExtractor depreciation by
[@&#8203;febkosq8](https://togithub.com/febkosq8) in
[Androz2091/discord-player#1722
- feat: implement custom ffmpeg stream by
[@&#8203;skdhg](https://togithub.com/skdhg) in
[Androz2091/discord-player#1723
- \[DOCS-FIX] Update version of community bot by
[@&#8203;Mittelblut9](https://togithub.com/Mittelblut9) in
[Androz2091/discord-player#1720
- docs: update version botanique by
[@&#8203;Mylloon](https://togithub.com/Mylloon) in
[Androz2091/discord-player#1724
- docs: add wego overseer to community resources by
[@&#8203;rickklaasboer](https://togithub.com/rickklaasboer) in
[Androz2091/discord-player#1727

#### New Contributors

- [@&#8203;Mittelblut9](https://togithub.com/Mittelblut9) made their
first contribution in
[Androz2091/discord-player#1720
- [@&#8203;Mylloon](https://togithub.com/Mylloon) made their first
contribution in
[Androz2091/discord-player#1724
- [@&#8203;rickklaasboer](https://togithub.com/rickklaasboer) made their
first contribution in
[Androz2091/discord-player#1727

**Full Changelog**:
https://github.com/Androz2091/discord-player/compare/discord-player@6.2.1...discord-player@6.3.0

###
[`v6.2.1`](https://togithub.com/Androz2091/discord-player/releases/tag/discord-player%406.2.1)

[Compare
Source](https://togithub.com/Androz2091/discord-player/compare/discord-player@6.2.0...discord-player@6.2.1)

### Changelog

-   fix esm build

**Full Changelog**:
https://github.com/Androz2091/discord-player/compare/discord-player@6.2.0...discord-player@6.2.1

###
[`v6.2.0`](https://togithub.com/Androz2091/discord-player/releases/tag/discord-player%406.2.0)

[Compare
Source](https://togithub.com/Androz2091/discord-player/compare/discord-player@6.1.1...discord-player@6.2.0)

#### What's Changed

- Add `interaction.guild` for player.nodes.create by
[@&#8203;TapsHTS](https://togithub.com/TapsHTS) in
[Androz2091/discord-player#1689
- Add fullTitle property to LyricsExtractor by
[@&#8203;Crocross](https://togithub.com/Crocross) in
[Androz2091/discord-player#1690
- Add Beat-Bot to community bots by
[@&#8203;IslandRhythms](https://togithub.com/IslandRhythms) in
[Androz2091/discord-player#1701
- update references of 'karasu-music-bot' to 'auricle-music-bot' by
[@&#8203;itsauric](https://togithub.com/itsauric) in
[Androz2091/discord-player#1703
- Add Melody to community resources docs page by
[@&#8203;NerdyTechy](https://togithub.com/NerdyTechy) in
[Androz2091/discord-player#1704
- Update community bot Music-disc module version by
[@&#8203;hmes98318](https://togithub.com/hmes98318) in
[Androz2091/discord-player#1711
- added link to DumBot within community resources by
[@&#8203;Mateo-Wallace](https://togithub.com/Mateo-Wallace) in
[Androz2091/discord-player#1714
- docs: use yarn in installation examples by
[@&#8203;skdhg](https://togithub.com/skdhg) in
[Androz2091/discord-player#1712
- feat(ExtractorExecutionContext): infer ext initialization options by
[@&#8203;skdhg](https://togithub.com/skdhg) in
[Androz2091/discord-player#1716
- Remove extractors peer dependencies by
[@&#8203;NotGhex](https://togithub.com/NotGhex) in
[Androz2091/discord-player#1718

#### New Contributors

- [@&#8203;TapsHTS](https://togithub.com/TapsHTS) made their first
contribution in
[Androz2091/discord-player#1689
- [@&#8203;IslandRhythms](https://togithub.com/IslandRhythms) made their
first contribution in
[Androz2091/discord-player#1701
- [@&#8203;hmes98318](https://togithub.com/hmes98318) made their first
contribution in
[Androz2091/discord-player#1711
- [@&#8203;Mateo-Wallace](https://togithub.com/Mateo-Wallace) made their
first contribution in
[Androz2091/discord-player#1714

**Full Changelog**:
https://github.com/Androz2091/discord-player/compare/discord-player@6.1.1...discord-player@6.2.0

###
[`v6.1.1`](https://togithub.com/Androz2091/discord-player/releases/tag/discord-player%406.1.1)

[Compare
Source](https://togithub.com/Androz2091/discord-player/compare/discord-player@6.1.0...discord-player@6.1.1)

#### What's Changed

- Docs : Added new pages for actions, events & hooks by
[@&#8203;febkosq8](https://togithub.com/febkosq8) in
[Androz2091/discord-player#1676
- refactor(karasu): setup, commands and listeners by
[@&#8203;itsauric](https://togithub.com/itsauric) in
[Androz2091/discord-player#1686
-   feat(GuildQueue): move, copy, swap
-   feat(QueryType): add AUTO_SEARCH type
-   refactor(QueryResolver): set fallback query to AUTO_SEARCH
-   refactor(ExtractorExecutionContext): unprioritize youtube extractor

**Full Changelog**:
https://github.com/Androz2091/discord-player/compare/discord-player@6.1.0...discord-player@6.1.1

###
[`v6.1.0`](https://togithub.com/Androz2091/discord-player/releases/tag/discord-player%406.1.0)

[Compare
Source](https://togithub.com/Androz2091/discord-player/compare/v6.0.0...discord-player@6.1.0)

#### Changelog

-   fix: use appropriate source for autoplay
-   feat: add initialization options for extractors
-   fix: apply requestedBy on search results if available
-   feat: add extractor events
- docs: update music bot status by
[@&#8203;Nonolanlan1007](https://togithub.com/Nonolanlan1007) in
[Androz2091/discord-player#1646
- fix(GuildQueuePlayerNode): patch seek method by
[@&#8203;skdhg](https://togithub.com/skdhg) in
[Androz2091/discord-player#1652
- Fix declaration file not found by
[@&#8203;NotGhex](https://togithub.com/NotGhex) in
[Androz2091/discord-player#1647
- fix(GuildQueuePlayerNode): fix stream error by
[@&#8203;Abish-x-lethal](https://togithub.com/Abish-x-lethal) in
[Androz2091/discord-player#1654
- Update docs for AutoComplete and minor changes by
[@&#8203;febkosq8](https://togithub.com/febkosq8) in
[Androz2091/discord-player#1674

#### New Contributors

- [@&#8203;Nonolanlan1007](https://togithub.com/Nonolanlan1007) made
their first contribution in
[Androz2091/discord-player#1646
- [@&#8203;NotGhex](https://togithub.com/NotGhex) made their first
contribution in
[Androz2091/discord-player#1647
- [@&#8203;Abish-x-lethal](https://togithub.com/Abish-x-lethal) made
their first contribution in
[Androz2091/discord-player#1654
- [@&#8203;febkosq8](https://togithub.com/febkosq8) made their first
contribution in
[Androz2091/discord-player#1674

**Full Changelog**:
https://github.com/Androz2091/discord-player/compare/v6.0.0...discord-player@6.1.0

###
[`v6.0.0`](https://togithub.com/Androz2091/discord-player/releases/tag/v6.0.0):
6.0.0

[Compare
Source](https://togithub.com/Androz2091/discord-player/compare/v5.4.0...v6.0.0)

### BREAKING CHANGES!!

> ⚠️ \[`semver:major`] This release contains breaking changes, making
old codes unusable.

Documentation: https://discord-player.js.org
Migration Guide: https://discord-player.js.org/docs/guides/v6-migration

#### What's Changed

- chore: monorepo setup by [@&#8203;skdhg](https://togithub.com/skdhg)
in
[Androz2091/discord-player#1510
- fix(StreamDispatcher): make paused property a getter by
[@&#8203;skdhg](https://togithub.com/skdhg) in
[Androz2091/discord-player#1517
- feat: new docs website by [@&#8203;skdhg](https://togithub.com/skdhg)
in
[Androz2091/discord-player#1530
- Add 'karasu-music-bot' to examples in README.md by
[@&#8203;itsauric](https://togithub.com/itsauric) in
[Androz2091/discord-player#1552
- feat(QueryResolver): apple music user playlists by
[@&#8203;BasboBibbins](https://togithub.com/BasboBibbins) in
[Androz2091/discord-player#1580
- refactor: example commands by
[@&#8203;itsauric](https://togithub.com/itsauric) in
[Androz2091/discord-player#1590
- feat(GuildQueue): add size getter by
[@&#8203;Crocross](https://togithub.com/Crocross) in
[Androz2091/discord-player#1606
- refactor(karasu) by [@&#8203;itsauric](https://togithub.com/itsauric)
in
[Androz2091/discord-player#1607
- Update migrating.md by
[@&#8203;Crocross](https://togithub.com/Crocross) in
[Androz2091/discord-player#1629
- Update migrating.md by
[@&#8203;Crocross](https://togithub.com/Crocross) in
[Androz2091/discord-player#1637
- feat!: discord-player v6 by
[@&#8203;skdhg](https://togithub.com/skdhg) in
[Androz2091/discord-player#1513
    -   Rewrite of the entire queue system
    -   Rewrite of extractors API
    -   New audio filters API
    -   New Query Cache API
    -   New extractors limitation API
    -   New global shortcuts (hooks, player methods)
    -   Singleton by default
    -   Better stream handling
    -   2 events dispatcher (Player & Player.events)
    -   Improved debug logs
    -   New lifecycle events
    -   New stream hook (`onAfterCreateStream`)
    -   Various bugfixes to `StreamDispatcher`
    -   New voice receiving feature
    -   Removal of internal extractors
    -   Apple Music support (including search queries)
- Addition of Biquad filters, 15 band equalizer (lavalink compatible) &
its presets, DSP filters
    -   Stability of audio player
- Improved management of audioplayer lifecycle as well as voice
connection
    -   Removal of smooth volume
    -   Ability to play raw audio resources
    -   Dynamic duration estimation for tracks
    -   New query resolver types
    -   New documentation
    -   New utils package

#### New Contributors

- [@&#8203;itsauric](https://togithub.com/itsauric) made their first
contribution in
[Androz2091/discord-player#1552
- [@&#8203;BasboBibbins](https://togithub.com/BasboBibbins) made their
first contribution in
[Androz2091/discord-player#1580
- [@&#8203;Crocross](https://togithub.com/Crocross) made their first
contribution in
[Androz2091/discord-player#1606

**Full Changelog**:
Androz2091/discord-player@v5.4.0...v6.0.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "every weekend" (UTC), Automerge - At
any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/PixelPizza/OurTube).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xNDQuMiIsInVwZGF0ZWRJblZlciI6IjM2LjUuMyIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jaron <60853956+JaronZ@users.noreply.github.com>
Co-authored-by: mcpsbot <83839790+mcpsbot@users.noreply.github.com>
Co-authored-by: Jaron <jaron_zijlstra@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:main Related to discord-player
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants