Skip to content

Commit

Permalink
docs(Wiki): Song#duration diff when upgrading to v5
Browse files Browse the repository at this point in the history
  • Loading branch information
skick1234 committed Jun 28, 2024
1 parent 4a00b74 commit 619943d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions wiki/Major-Upgrade-Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@ ytPlugin.search(query, { type: "video", limit: 5, safeSearch: true }).then(conso
- Remove `Song#chapters`

```diff
- const streamURL = song.streamURL
+ const streamURL = song.stream.playFromSource ? song.stream.url : song.stream.song.stream.url
- const ageRestricted = song.age_restricted
+ const ageRestricted = song.ageRestricted
- const duration = song.duration
+ const streamURL = song.stream.playFromSource ? song.duration : song.stream.song.duration
- const streamURL = song.streamURL
+ const streamURL = song.stream.playFromSource ? song.stream.url : song.stream.song.stream.url
```

On v5, `Song` info is not represented the `Song` will be streamed to the voice channel if `Song#playFromSource` is `false`

Example: `s` is a Spotify `Song`, `s.source` is `spotify`, `s.playFromSource` is `false`. When the song plays, `s.stream.song` will be a streamable `Song` searched with an `ExtractorPlugin`. And DisTube will play the `s.stream.song` instead of `s`
Example: `s` is a Spotify `Song`, `s.source` is `spotify`, `s.playFromSource` is `false`. When the song plays, `s.stream.song` will be a stream-able `Song` searched with an `ExtractorPlugin`. And DisTube will play the `s.stream.song` instead of `s`

Note: `Song#stream.url` or `Song#stream.song` is only available when the song is playing.

Expand Down

0 comments on commit 619943d

Please sign in to comment.