Bug 293616

Summary: APG returning shorter playlists than requested
Product: [Applications] amarok Reporter: robert marshall <robert>
Component: Playlists/Automated Playlist GeneratorAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: wishlist CC: stharward, wyatt.epp
Priority: LO    
Version: 2.5.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 2.7
Attachments: XML of test-case

Description robert marshall 2012-02-08 09:52:25 UTC
Version:           2.5.0 (using KDE 4.8.0) 
OS:                Linux

I have an APG playlist with the following constraints:
playcount < 2
no duplicates
length = 30 tracks
not played within last 30 days
Optimization set around 70%
Quite frequently I'll get a very short playlist - of around 10 items but the possible match population for this shouldn't IMHO cause any constraint problems.
If in the collection browser I enter playcount:=0 (so all of these tracks satify the APG criteria) I get around 1000 tracks.

I'd expect the APG generated list to contain 30 tracks (or at least far closer to that than 10!)

Reproducible: Always

Steps to Reproduce:
as above - you'll need a collection with lots of unplayed tracks


Expected Results:  
I'd expect the playlist generated to be closer to my specified lenght than the lengths I'm seeing at the moment!
Comment 1 Wyatt Epp 2012-04-08 10:06:27 UTC
I can confirm this issue with Amarok git 8b0b4012
In general, there seems to be only a slim chance the length you specify will actually be generated.  A simpler test case:
"Match All" group
- Prevent Duplicate Tracks
- Playlist Length: equals 50 tracks

Slider:
"Speed" playlist length:
42, 44, 45, 50, 47, 44, 42, 48, 39, 47
"Accuracy" playlist length:
43, 48, 39, 42, 49, 46, 50, 43, 48, 40

Looking at that distribution I think it's probably a bug and not just us misunderstanding the tool.  Would it be possible to just do a quick port of the old "Smart Playlists" code or is there too much divergence at this point?
Comment 2 Myriam Schweingruber 2012-04-08 12:11:34 UTC
Changing status to confirmed.
Comment 3 Soren Harward 2012-04-08 16:35:23 UTC
I need to know what the "strictness" setting of your PlaylistDuration constraint is.  Please export the preset you used for testing to an XML file and post it here.

If anything, this behavior just means that the internal parameters of the PlaylistDuration constraint should be tweaked a little, so I'm downgrading this from "bug" to "wishlist".
Comment 4 Wyatt Epp 2012-04-08 23:34:56 UTC
Created attachment 70246 [details]
XML of test-case
Comment 5 Soren Harward 2012-11-08 22:25:50 UTC
Git commit e725f3364f56d2d3db7258217a132c03cccc6038 by Soren Harward.
Committed on 08/11/2012 at 22:35.
Pushed by stharward into branch 'master'.

Whole bunch of APG improvements and bugfixes

See ChangeLog for details
Related: bug 283618, bug 294743, bug 301829

M  +7    -0    ChangeLog
M  +2    -0    src/CMakeLists.txt
M  +2    -1    src/browsers/playlistbrowser/APGCategory.cpp
M  +7    -1    src/playlistgenerator/ConstraintFactory.cpp
M  +3    -13   src/playlistgenerator/ConstraintGroup.cpp
M  +2    -6    src/playlistgenerator/ConstraintGroup.h
M  +2    -2    src/playlistgenerator/ConstraintNode.cpp
M  +2    -6    src/playlistgenerator/ConstraintNode.h
M  +3    -17   src/playlistgenerator/ConstraintSolver.cpp
M  +1    -3    src/playlistgenerator/ConstraintSolver.h
M  +7    -1    src/playlistgenerator/PresetModel.cpp
M  +2    -1    src/playlistgenerator/PresetModel.h
M  +4    -3    src/playlistgenerator/TODO
M  +2    -26   src/playlistgenerator/constraints/Checkpoint.cpp
M  +2    -4    src/playlistgenerator/constraints/Checkpoint.h
M  +1    -1    src/playlistgenerator/constraints/Matching.h
M  +5    -13   src/playlistgenerator/constraints/PlaylistDuration.cpp
M  +2    -2    src/playlistgenerator/constraints/PlaylistDuration.h
A  +281  -0    src/playlistgenerator/constraints/PlaylistFileSize.cpp     [License: GPL (v2+)]
C  +22   -19   src/playlistgenerator/constraints/PlaylistFileSize.h [from: src/playlistgenerator/constraints/PlaylistLength.h - 071% similarity]
A  +193  -0    src/playlistgenerator/constraints/PlaylistFileSizeEditWidget.ui
M  +11   -11   src/playlistgenerator/constraints/PlaylistLength.cpp
M  +2    -2    src/playlistgenerator/constraints/PlaylistLength.h
M  +1    -55   src/playlistgenerator/constraints/PreventDuplicates.cpp
M  +1    -5    src/playlistgenerator/constraints/PreventDuplicates.h
M  +1    -21   src/playlistgenerator/constraints/TagMatch.cpp
M  +1    -5    src/playlistgenerator/constraints/TagMatch.h
M  +1    -12   src/playlistgenerator/constraints/TagMatchComparer.cpp
M  +1    -2    src/playlistgenerator/constraints/TagMatchSupport.cpp
M  +1    -25   src/playlistgenerator/constraints/TrackSpreader.cpp
M  +1    -5    src/playlistgenerator/constraints/TrackSpreader.h

http://commits.kde.org/amarok/e725f3364f56d2d3db7258217a132c03cccc6038