Hi, I&#39;m trying to dump my brain about Meta::Playlist and why I thing Dynamic Playlists should extend from them.<br><br><u><b>A sketch of the Meta::Playlist system</b></u><br>(if you already know that, jump to the next <b>bold title</b>)<br>
<br>facts: Playlists should be saved to SQL and abstraction if good.<br><br>Meta::Playlist is the abstract base class. An inheriting class has a TrackList &nbsp;+ meta data about the playlist itselfs (name, creator, tags, etc.).<br>
<br>An example:<br>Meta::Playlist &lt;- PodcastChannel<br>Meta::Track &lt;- PodcastEpisode<br><br>Then there are the regular Playlists<br>Meta::XSPFPlaylist, Meta::PLSPlaylist, Meta::M3UPlaylist and also SQLPlaylist.<br><br>
All these are managed by PlaylistManager. PlaylistManager has Categories: an integer that describes what kind of playlist it is, the include Categories are in an enum (PlaylistManager::PlaylistCategory):<br><ul><li><i>UserPlaylist</i>: user created playlist &quot;My Playlists&quot;</li>
<li><i>PodcastChannel</i> (&quot;Podcasts&quot;)</li><li><i>Dynamic</i></li><li><i>SmartPlaylist</i></li><li><i>Custom</i> (this is used as an offset for scripts and plugins that want to create a new PlaylistCategory using PlaylistManager::registerCustomCategory())</li>
</ul>You&#39;ll also see <i>CurrentPlaylist</i> in that enum, that is a special type for the Playlists used in PlaylistModel at any given time (since you can load a Playlist, in fact more then one). I&#39;m not sure I want to keep that one, it is kind of specific to something I wanted to do in PlaylistBrowser.<br>
<br>So you see, PlaylistManager gathers Playlists from all over Amarok - core, plugins and scripts alike - and presents them in a generic way to PlaylistBrowser, PlaylistModel or any other system then uses Playlists.<br><br>
<u><b>Dynamic Playlists</b></u><br>Now that you know the Meta::Playlist system, let me tell you how I would implement dynamic mode.<br><br>A DynamicPlaylist would act like a proxy for other Meta::Playlists, selecting Tracks from them to populate it&#39;s own trackList(). DynamicPlaylist would be the abstract base, possible implementations:<br>
<ul><li>LastfmSimilarPlaylist</li><li>LasftmNeigborsPlaylist (!= neighbors radio)</li><li>RandomDynamicPlaylist (!= shuffle mode)</li><li>ScriptableDynamicPlaylist</li><li>MoodDynamicPlaylist, etc.</li></ul>each of which responsible for populating them selfs, using various selection algorithms.<br>
<br>A use case from the <a href="http://last.fm">last.fm</a> plugin creators view:<br><ul><li>Populate the similar artist database</li><li>Add a PlaylistProvider to the PlaylistManager for PlaylistManager::Dynamic (PlaylistCategory)</li>
</ul>A use case from the users point of view:<br><ul><li>The user opens the &quot;Dynamic Playlists&quot; tab in the PlaylistBrowser.</li><li>He clickes the add button to create a new DynamicPlaylist. There are several different types, presented in a dialog (created by PlaylistManager). He decides to create a &quot;Similar Artists from the <a href="http://Last.fm">Last.fm</a> database&quot; Dynamic Playlist.</li>
<li>The Dynamic Playlist appears in the PlaylistBrowser and gets loaded in the TrackQueue (behind the scenes, the <a href="http://last.fm">last.fm</a> service plugin created a new LastfmSimilarPlaylist and added it to it&#39;s PlaylistProvider, it didn&#39;t show a GUI since it doesn&#39;t require any settings to be made by the user).</li>
<li>Some text in the TrackQueue tells the user that the new Dynamic Playlist is empty and that at least one seed track needs to be added.</li><li>The user realizes that, since the TrackQueue (The Playlist) was empty, there were no seed songs to populate the Dynamic Playlist with.</li>
<li>The user drags a few songs from a Metal band from the collection to the TrackQueue to seed the dynamic playlist. Right after that 5 more tracks appear in the TrackList, and they are indeed from other Metal bands.</li>
</ul><br><ul><li>After a few hours of surfing the net while listening to Metal band he almost forgot about, he decides to find the oldest songs in his collection. <br></li><li>He creates a SmartPlaylist for albums from before 1990.</li>
<li>It&#39;s mostly of poppy 80&#39;s music, but he only wants the dark stuff, so he drags it over to the Dynamic tab and drops it there.</li><li>A new dialog asks him what kind of Dynamic Playlist it should be, he choices &quot;Dynamic Playlist based on Mood&quot;.</li>
<li>He drops &quot;Girlfriend in a Coma&quot; from The Smiths onto the &quot;Mood based Dynamic Playlist&quot;, seeding it to exclude the likes of ABBA.</li><li>The TrackQueue gets seeded with Tracks from Joy Devision, The Cure, Depeche Mode and others.</li>
</ul>After our melancholic user restarts his computer the DynamicPlaylist that was active the night before gets loaded again and is ready to be continued. He liked last nights queue very much and decides to save it to an XSPF file to sync with his media player later. Who needs a DJ when you got Amarok&#39;s Dynamic Playlists.<br>
<br>Bart<br>P.S. sorry about the HTML mail, but I needed some markup to get my point across.<br>