This repository has been archived by the owner on Apr 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 208
Added queue position and approx wait time. #402 #404
Open
SuhanKoh
wants to merge
18
commits into
freyacodes:dev
Choose a base branch
from
SuhanKoh:add-position-and-timer
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
db9d3f0
Added queue position and approx wait time. #402
SuhanKoh 8d853a5
Removed selection embed.
SuhanKoh b3bc027
Changes on remaining time formatting and string wording.
SuhanKoh 661d6d5
Modified selection string to be two lines.
SuhanKoh e516f21
Added live stream check for queuing message.
SuhanKoh db1c8b1
Removed formatting in i18n file.
SuhanKoh 890a0b9
Removed formatting in translation properties file.
SuhanKoh 4dcd645
Merge branch 'dev' into add-position-and-timer
schnapster bb12678
Fix compiling
schnapster 8446102
Fix i18n warning
schnapster e7ba42c
Fix live stream message if there is any live stream in queue.
SuhanKoh d1d36bc
Added queue message support for adding url directly.
SuhanKoh dcde4c8
Added queue message to playlist, and fix timer for direct url.
SuhanKoh f92647a
Added limit check for split command.
SuhanKoh a06fa87
Added a check for ignoring empty or null title on split command reply.
SuhanKoh 59f7ca2
Reduced max queue message display for split and load playlist. Added …
SuhanKoh b462449
Updated selection queue message.
SuhanKoh 21f847d
Merge branch 'dev' into add-position-and-timer
SuhanKoh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package fredboat.util; | ||
|
||
import fredboat.audio.player.GuildPlayer; | ||
import fredboat.messaging.internal.Context; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
public class PlayerUtil { | ||
|
||
/** | ||
* No initialization! | ||
*/ | ||
private PlayerUtil() { | ||
} | ||
|
||
/** | ||
* Resolve which message to be replying to the discord channel based on how many audio is in the queue. | ||
* | ||
* @param player Guild player. | ||
* @param context Context object to be used for retrieving i18n strings. | ||
* @return String represent of the current state of the player for adding audio. | ||
*/ | ||
public static String resolveStatusOrQueueMessage(@Nonnull GuildPlayer player, @Nonnull Context context) { | ||
String playingStatusOrQueueTime; | ||
int positionInQueue = player.getTrackCount() + 1; | ||
if (player.getTrackCount() < 1) { | ||
playingStatusOrQueueTime = TextUtils.italicizeText(context.i18n("selectSuccessPartNowPlaying")); | ||
} else { | ||
if (player.getRemainingTracks() | ||
.stream() | ||
.noneMatch( | ||
audioTrackContext -> audioTrackContext.getTrack().getInfo().isStream)) { | ||
|
||
// Currently is not playing any live stream. | ||
long remainingTimeInMillis = player.getTotalRemainingMusicTimeMillis(); | ||
String remainingTime = TextUtils.formatTime(remainingTimeInMillis); | ||
playingStatusOrQueueTime = context.i18nFormat( | ||
"selectSuccessPartQueueWaitTime", | ||
TextUtils.boldenText(positionInQueue), | ||
TextUtils.boldenText(remainingTime)); | ||
|
||
} else { | ||
playingStatusOrQueueTime = context.i18nFormat( | ||
"selectSuccessPartQueueHasStream", | ||
TextUtils.boldenText(positionInQueue)); | ||
} | ||
} | ||
|
||
return playingStatusOrQueueTime; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though it may make more sense to say "Queued as #{0}"