Hello, just found out this plugin and I am thinking whether I can move over from Random Pools and completely use this plugin alone. I currently have some SQL queries which run after a track finishes. It's basically two pools which consist of Least Recently Played (LRP) and Lowest Play Count (LPC). Both of these random pools have a 1/2 chance of being elected.
Least Recently Played:
-- Create temporary table tmpMediaLibraryFLRP
DROP TABLE IF EXISTS tmpMediaLibraryFLRP;
CREATE TEMPORARY TABLE tmpMediaLibraryFLRP AS
SELECT
path,
subsong,
codec,
[album artist],
[%jsp3_loved%],
COALESCE(DATETIME(NULLIF([%jsp3_last_played%], '')), '1970-01-01 00:00:00') AS [%jsp3_last_played%]
FROM MediaLibrary
WHERE (codec <> 'TAGS' AND [%jsp3_loved%]) AND [%jsp3_last_played%] < datetime('now', '-300 minutes', 'localtime')
ORDER BY [%jsp3_last_played%];;
WITH CTE AS (
SELECT
path,
subsong
FROM tmpMediaLibraryFLRP
)
SELECT path,
subsong
FROM CTE
Lowest Play Count:
-- Create temporary table tmpMediaLibraryFLPC
DROP TABLE IF EXISTS tmpMediaLibraryFLPC;
CREATE TEMPORARY TABLE tmpMediaLibraryFLPC AS
SELECT
path,
subsong,
codec,
[album artist],
[%jsp3_loved%],
CAST(COALESCE(NULLIF([%jsp3_playcount%], ''), 0) AS INTEGER) AS [%jsp3_playcount%],
COALESCE(DATETIME(NULLIF([%jsp3_last_played%], '')), '1970-01-01 00:00:00') AS [%jsp3_last_played%]
FROM MediaLibrary
WHERE (codec <> 'TAGS' AND [%jsp3_loved%]) AND [%jsp3_last_played%] < datetime('now', '-300 minutes', 'localtime')
ORDER BY [%jsp3_playcount%];;
WITH CTE AS (
SELECT
path,
subsong
FROM tmpMediaLibraryFLPC
)
SELECT path,
subsong
FROM CTE
I am using JScript 3 Panels in tandem to automate the process of randomly choosing between those two pools. [PS: currentPlaylist can be ignored since I am running the above two pools if I want to shuffle my favourite tracks or my entire library.]
// Code below is related to Random Pool's Autoadd.
function on_playback_time(time) {
//console.log("Time: ", time);
var finished = Math.floor(fb.PlaybackLength) - 1;
//console.log("Finished: ", finished);
if (time != finished) return;
random_pool_autoadd();
}
function on_playback_starting(cmd) {
console.log("Error Checking: ", cmd);
if (cmd !== 2 && cmd !== 3) return;
random_pool_autoadd();
}
function random_pool_autoadd() {
var currentPlaylist = plman.PlayingPlaylist;
var command = "";
if (currentPlaylist === 1 || currentPlaylist === 2) {
fb.Stop()
if (currentPlaylist === 1) {
command = "File/Random pools/Assign keyboard shortcuts/GensokyoRadio Algorithm [Favourites]: All pools";
} else {
command = "File/Random pools/Assign keyboard shortcuts/GensokyoRadio Algorithm [All]: All pools";
}
fb.RunMainMenuCommand(command);
}
}
// Code above is related to Random Pool's Autoadd.
This implementation sort of works but tracks which are totally new (the date is set as the earliest UNIX timestamp and the play count is 0) all the tracks end up from the same album grouped. I want to effectively break this grouping by spacing out how often the same album gets played. There's a small limitation to this however as I am using two different random pools, consider this:
Pool A -> Album A gets picked
Pool A -> Now since it's the same pool the shuffle algorithm can space out Album A from being repeated again
However, if Pool B gets selected -> It's impossible to know what the album was in the previous pool (Pool A).
I'm not sure if this plugin would aid in this minor issue but if I can just get the spacing off albums within the same pool it'd be a-lot more better as I've been figuring out how to configure this without Playlist-Tools-SMP (didn't know about this plugin) before and it was a total flop.