Re: idleStreams
AF1 <AF1.atj4nb-NUepA2SMhDQqspMVqqL2D+4xXEVPTSb/[email protected]> Mon, 7 Nov 2022 17:06:10 +0000
| Newsgroups | gmane.music.equipment.slimdevices.devel |
|---|---|
| Organization | Logitech Squeezebox Forums |
| Message-ID | <[email protected]> |
I think you're right. Using an SQLite browser and omitting -order by
random()- from the Songs - random dynamic playlist, I got 4000 tracks in
< 0.1 secs, fast enough on my ancient 2,5 GHz Dual-Core Intel Core i5.
This matters for creating huge static playlists. Though, when you start
a dynamic playlist (to play tracks on a client, max. 50 tracks), the
difference seems to be negligible. Starts almost instantly, even on my
ancient 2,5 GHz Dual-Core Intel Core i5. Still, I'll look into
alternative ways to randomize track results.
But there was something else: once the SQlite query returns the track
urls, the plugin retrieves the tracks (track objects). And it used
Slim::Schema->resultset('Track')->objectForUrl($url). I've changed that
to Slim::Schema->resultset('Track')->single({ 'url' => $url }) and this
really speeds things up (3-4 secs for getting 4000 tracks/track objects
now).
$playlist->setTracks(\@tracks) and
Slim::Player::Playlist::scheduleWriteOfPlaylist take about 3secs and
3-4secs respectively. Total task exec time without sorting about 11 secs
now, leeping the size of the result set and my specs in mind.
BTW if I want to sort an array of track objects by e.g.
artist->album->disc no->track no., would I use this or is there a faster
way?
Code:
--------------------
@sortedTracks = sort {lc($a->artist->namesort) cmp lc($b->artist->namesort) || lc($a->album->namesort) cmp lc($b->album->namesort) || ($a->{'_column_data'}->{'disc'} || 0) <=> ($b->{'_column_data'}->{'disc'} || 0) || ($a->{'_column_data'}->{'tracknum'} || 0) <=> ($b->{'_column_data'}->{'tracknum'} || 0)} @totalItems;
--------------------
About the slider: that was a misunderstanding, I think. I know and use
sliderInput_min_max_incrementval - *in* the LMS *settings* context. I
was just looking for a way to use it *outside* of the LMS settings, so I
don't have to recreate it when it (css, js) already exists, if only in
the settings.
Anyway, thank you very much for your help so far.
For '*bug reports*' (https://github.com/AF-1/), *FAQ* (if available) and
more detailed information about my plugins, please see the
'*GitHub*' (https://github.com/AF-1/) page or
the *first post* in the support thread for a plugin. Please post *bug
reports* for my plugins *only* on '*GitHub*' (https://github.com/AF-1/).
Thank you.
------------------------------------------------------------------------
AF1's Profile: http://forums.slimdevices.com/member.php?userid=39306
View this thread: http://forums.slimdevices.com/showthread.php?t=117004