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

AutoDJ: Show total track time #4846

Draft
wants to merge 26 commits into
base: 2.4
Choose a base branch
from
Draft

Conversation

ninomp
Copy link
Contributor

@ninomp ninomp commented Jul 6, 2022

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.

@ronso0
Copy link
Member

ronso0 commented Jul 6, 2022

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?
E.g. when you're in another feature for collecting tracks and need to know how much of your 2h set is left to be filled.
AutoDJ (28:43)


int rows = m_pAutoDJTableModel->rowCount();
for (int row = 0; row < rows; ++row) {
TrackPointer pTrack = m_pAutoDJTableModel->getTrack(m_pAutoDJTableModel->index(row, 0));
Copy link
Contributor

@uklotzde uklotzde Jul 6, 2022

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.

Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Member

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?


QString label;
label.append(mixxx::DurationBase::formatTime(duration));
label.append(QString(" (%1)").arg(rows));
Copy link
Member

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.

Copy link
Member

@daschuer daschuer left a 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.

}

QString label;
label.append(mixxx::DurationBase::formatTime(duration));
Copy link
Contributor

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!

Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

@ronso0
Copy link
Member

ronso0 commented Nov 22, 2022

preempting the stale bot:
@ninomp are you motivated to pick this up again and consider the change requests?

@ninomp
Copy link
Contributor Author

ninomp commented Nov 23, 2022

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
@github-actions github-actions bot added the build label Dec 2, 2022
@ninomp
Copy link
Contributor Author

ninomp commented Dec 10, 2022

This is ready for review.

@daschuer
Copy link
Member

The presentation looks somehow wrong, because one time we have parentheses and one time not.
grafik

Copy link
Member

@daschuer daschuer left a 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/autodjfeature.cpp Outdated Show resolved Hide resolved
@@ -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()) {
Copy link
Member

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.

@@ -54,6 +55,13 @@ DlgAutoDJ::DlgAutoDJ(WLibrary* parent,
this,
&DlgAutoDJ::updateSelectionInfo);

connect(&pLibrary->trackCollectionManager()
->internalCollection()
->getPlaylistDAO(),
Copy link
Member

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 Show resolved Hide resolved

QString label;
label.append(summary.getTrackDurationText());
label.append(QString(" (%1)").arg(summary.getTrackCount()));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
label.append(QString(" (%1)").arg(summary.getTrackCount()));
label.append(QStringLiteral(" (%1)").arg(summary.getTrackCount()));

src/library/autodj/dlgautodj.cpp Outdated Show resolved Hide resolved
@@ -219,6 +219,13 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelTotalInfo">
Copy link
Member

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.

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

This is because in the analysis view the spacer is on the very right.
grafik
I have no strong preferences for one of the options but they should be the same.

src/library/trackset/playlist/playliststorage.h Outdated Show resolved Hide resolved
src/library/trackset/playlist/playliststorage.h Outdated Show resolved Hide resolved
@ronso0 ronso0 removed the build label Jan 17, 2023
@daschuer daschuer changed the base branch from main to 2.4 January 30, 2023 13:31
@daschuer
Copy link
Member

I see now this:
grafik

@daschuer
Copy link
Member

Did we have a conclusion how to handle the error due to cross-fading and cue points?
I thing using a "<" prefix or "~" would be reasonable.

#include "library/trackset/playlist/playlistid.h"
#include "util/db/dbnamedentity.h"

class Playlist : public DbNamedEntity<PlaylistId> {
Copy link
Member

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.

Copy link
Contributor Author

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.

@github-actions github-actions bot added the build label Feb 19, 2023
Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

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

This looks a bit cluttered:
grafik

Maybe we can decorate it with icons or labels?
Another option is to use the total time if one track is selected and show the selected time if we have more selected.

<15:00 (3/15)

@@ -219,6 +219,13 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelTotalInfo">
Copy link
Member

Choose a reason for hiding this comment

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

This is because in the analysis view the spacer is on the very right.
grafik
I have no strong preferences for one of the options but they should be the same.

@daschuer
Copy link
Member

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.

@github-actions
Copy link

This PR is marked as stale because it has been open 90 days with no activity.

@github-actions github-actions bot added the stale Stale issues that haven't been updated for a long time. label Aug 23, 2023
@github-actions github-actions bot removed the stale Stale issues that haven't been updated for a long time. label Dec 24, 2023
@daschuer
Copy link
Member

Oh sorry, conflicts has been developed.

@daschuer daschuer marked this pull request as draft April 23, 2024 06:27
@ninomp
Copy link
Contributor Author

ninomp commented Apr 23, 2024

@daschuer No worries. I am planning to get back and finish this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants