-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
AutoDJ: Show total track time #4846
base: 2.4
Are you sure you want to change the base?
Conversation
I never use AutoDJ, would it be helpful to show the total remaining play time also in the sidebar item, like it's shown for playlists? |
src/library/autodj/dlgautodj.cpp
Outdated
|
||
int rows = m_pAutoDJTableModel->rowCount(); | ||
for (int row = 0; row < rows; ++row) { | ||
TrackPointer pTrack = m_pAutoDJTableModel->getTrack(m_pAutoDJTableModel->index(row, 0)); |
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.
Loading and instantiating a heavy-weight track object just to obtain the duration is overkill and will certainly block the UI if many tracks are affected.
It somehow works for a quick and dirty prototype hack. But you shouldn't do this in production code.
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.
Do you have a recommendation for a workaround?
I think the track duration will be already in the library cache.
However once we take the real duration into account, we need also the cues.
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.
There are multiple options depending on what information is available in this context (which I am not aware of). This is just the worst option.
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.
I think the best way forward is to introduce the same label we use per playlist.
QList<BasePlaylistFeature::IdAndLabel> PlaylistFeature::createPlaylistLabels() { |
Since Auto DJ is in fact a "hidden" playlist, we can move this function into a common base class.
I suggest to use a "<" prefix to tell the user that the displayed time is the maximum.
In a next step we may calculate also the real runtime for a reasonable amount of tracks only. The main use case is to see I think not more than a time < 1 h ahead, for a timed show or a visit on the rest rooms or at the bar.
For longer times we can fall back to the original "<" display version.
What do you think?
src/library/autodj/dlgautodj.cpp
Outdated
|
||
QString label; | ||
label.append(mixxx::DurationBase::formatTime(duration)); | ||
label.append(QString(" (%1)").arg(rows)); |
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.
here we should reuse the
QString createPlaylistLabel( |
in fact the playlists share the same issue that it shows the max time only and not the resulting time when put to Auto-DJ.
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.
Thank you for picking this up. I think we can merge a first version based on the Playlist solution.
src/library/autodj/dlgautodj.cpp
Outdated
} | ||
|
||
QString label; | ||
label.append(mixxx::DurationBase::formatTime(duration)); |
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.
This needs to communicate that the shown time is an estimate. Users making plans based on this will be mislead if they think this is accurate!
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.
maybe a prefix like "Sum:" clarifies the overlaps/transitions are not considered.
Anyway, such info should be in the tooltip.
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.
I disagree that it should be hidden in the tooltip. Also "sum" is unclear. "Estimate" would convey that this is not reliable.
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.
Ping. The UI still presents this estimate as if it reflects the actual play time.
preempting the stale bot: |
Hi @ronso0 Yes, I am, but I'm short on time lately. However, I will try to find some time to work on this. Stay tuned. ;-) |
* Heavily inspired by CrateStorage * Move playlist summary computation from PlaylistFeature to it * PlaylistFeature no longer contains any raw SQL
This is ready for review. |
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.
Thank you. This woks already good. Added some comments.
src/library/autodj/dlgautodj.cpp
Outdated
@@ -32,7 +32,8 @@ DlgAutoDJ::DlgAutoDJ(WLibrary* parent, | |||
parent->getTrackTableBackgroundColorOpacity(), | |||
/*no sorting*/ false)), | |||
m_bShowButtonText(parent->getShowButtonText()), | |||
m_pAutoDJTableModel(nullptr) { | |||
m_pAutoDJTableModel(nullptr), | |||
m_pTrackCollection(pLibrary->trackCollectionManager()->internalCollection()) { |
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.
This row of "->" looks scary. Can we move the initialization to the code body and add some null checkes?
Or are these checks in place at the calling code and we can pass the final pointer?
Using The not_null pointer might be also an option.
src/library/autodj/dlgautodj.cpp
Outdated
@@ -54,6 +55,13 @@ DlgAutoDJ::DlgAutoDJ(WLibrary* parent, | |||
this, | |||
&DlgAutoDJ::updateSelectionInfo); | |||
|
|||
connect(&pLibrary->trackCollectionManager() | |||
->internalCollection() | |||
->getPlaylistDAO(), |
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.
Another place of a "->" row.
src/library/autodj/dlgautodj.cpp
Outdated
|
||
QString label; | ||
label.append(summary.getTrackDurationText()); | ||
label.append(QString(" (%1)").arg(summary.getTrackCount())); |
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.
label.append(QString(" (%1)").arg(summary.getTrackCount())); | |
label.append(QStringLiteral(" (%1)").arg(summary.getTrackCount())); |
@@ -219,6 +219,13 @@ | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QLabel" name="labelTotalInfo"> |
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.
All other features have the text left aligned. I think we should do it here as well.
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.
Did you consider this comment?
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.
Well, labelSelectionInfo
does not have text alignment set, so I'm slightly confused why labelTotalInfo
would be different.
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.
Did we have a conclusion how to handle the error due to cross-fading and cue points? |
#include "library/trackset/playlist/playlistid.h" | ||
#include "util/db/dbnamedentity.h" | ||
|
||
class Playlist : public DbNamedEntity<PlaylistId> { |
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.
Is this new class used? Can this be just a typedef? The name is IMHO ambiguous.
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.
Yes, PlaylistSummary
class is derived from this class.
Well, I was trying to follow and replicate how CrateStorage
is implemented. The idea is that one day PlaylistStorage
, which is introduced with this PR, will replace PlaylistDAO
, just like CrateStorage
replaced CrateDAO
.
55485d3
to
ea0e42d
Compare
'=': conversion from 'size_t' to 'int', possible loss of data
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.
@@ -219,6 +219,13 @@ | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QLabel" name="labelTotalInfo"> |
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.
The display if the total run time is already visible in the side bar. From that point of view showing only the selected runtime should be good. |
This PR is marked as stale because it has been open 90 days with no activity. |
Oh sorry, conflicts has been developed. |
@daschuer No worries. I am planning to get back and finish this soon. |
This PR adds total track time to AutoDJ pane.
For now, it does NOT take intro/outro cues and AutoDJ mode into account. I am planning to change this when I add "Will Start At" column to track table, which is my next step.