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

Cover art support 4 #3

Closed
wants to merge 49 commits into from
Closed

Cover art support 4 #3

wants to merge 49 commits into from

Conversation

cardinot
Copy link
Owner

  • basic UI to download and show covers (dlgcoverartfetcher)
  • download covers from Last.fm

zr3 and others added 30 commits July 3, 2014 03:29
…ces of the same track next to each other. It checks the IDs of the tracks before and after the positions of the tracks that will be swapped, and if there's a match, it tries again with a new position.

It tries a maximum of 10 times, which should be far more than enough for normal situations. It uses the PlaylistTracks table in the database to get its track ID numbers. I didn't notice any significant performance decreases, even with hundreds of the same 10-15 tracks in the AutoDJ playlist.
Here's a brief description of how the algorithm now works:
Loop through the set of tracks to be shuffled:
    1) Set Track A as the current point in the shuffle set
    2) Repeat a maximum of 10 times or until a good place (1/4 of the
       playlist away from a conflict) is reached:
        a) Pick a random track within the shuffle set (Track B)
        b) Check 1/4 of the playlist up and down (clamped at the
           beginning and end) from Track B's position for Track A
        c) Check 1/4 of the playlist up and down (clamped at the
           beginning and end) from Track A's position for Track B
        d) If there was a conflict, store the position if it was better
           than the already stored best position. The position is deemed
           "better" if the distance (square of the difference) of
           the closest conflict (Track B near Track A's position and vv)
           is larger than previous iterations.
3) If no good place was found, use the stored best position
4) Swap Track A and Track B

The "tempTrackDistance" variable in the following might be confusing:
...
            for (int count=startPosition; count < endPosition; count++) {
                if (trackPositionIds.value(count) == trackBId && count != trackBPosition) {
                    conflictFound = true;
                    int tempTrackDistance =
                        (trackAPosition - count) * (trackAPosition - count);
                    if (tempTrackDistance < trackDistance || trackDistance == -1)
                        trackDistance = tempTrackDistance;
                }
            }
...
The reason it is there is to prevent a longer distance from being saved in
the case that there are multiple conflicts within the range.

The section of code that checks around Track A's and Track B's position is
repetitive; I chose to leave it that way for clarity for now but perhaps
it would be better to extract it into a private function?

I have also renamed a few variables and fixed some comment typos for clarity.
Made a few changes to match the coding guidelines for Mixxx.
- the last logic to handle the results was too complex...
cardinot and others added 19 commits July 29, 2014 17:25
…r hit PREV or NEXT buttons

It avoids the bug #1349017
The algorithm now "wraps" around the playlist, so that if the tracks are re-queued they will still be 1/4 of the playlist apart.
The most extreme case that this algorithm can now handle is a 4-track playlist with two copies of one of the tracks.
I realized that firstly I need to improve the tableview and then make the slot work properly...
Anyway, let's leave it done...
…xxxdj/. Compile QM files out of TS files that are used by the localized app.
Add links to Mixxx translation services
Search Functionality to Developer's Log
Fix for Bug #1023804: Stop AutoDJ shuffle from putting two of the same song together
@cardinot
Copy link
Owner Author

cardinot commented Aug 4, 2014

Moved:
#4
now it based on the main branch (coverArtSupport)

@cardinot cardinot closed this Aug 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants