mStream
mStream copied to clipboard
3rd world problem: shuffle play should be working on first song not after first song
If we add songs from a folder into a playlist and press shuffle and than play, the first song is always the first song from the list and not a random song from that playlist. I would love to see that behaviour changed.
Now I have to remind myself to press next song to get a random other song.
So the trick would be if shuffle is on and play is pressed to just do a "track skip next" internally? I don't know about other players.. is this a common behavior? or maybe add another button for shuffle on first track?
The first track on the playlist is played immediately after its added. So after adding tracks to the playlist, pause the first one, enable shuffle and then it should not continue the same track and instead shuffle to another? This is quite simple and just require some small code changes which I just did.
The bigger problem is if you enable shuffle before anything is in the playlist, and then add a whole folder to the playlist... to shuffle without playing the first track I don't know at the moment how to do this and have no time to figure it out. I maybe come back later to this.
So.. if you are interested in the 1. solution and have installed mStream from the CLI (via npm install) I cloud send you the changed file and you could try and test it yourself. And if it works like expected I'll do a pull request.
Indeed in the settings there must be this: enable auto play when loading playlist yes / no when no you can say: when shuffle is pushed the first random track is being played
Now it is indeed loading first item, what is automatically played so random track will be always first track after initial track
When you insert a CD all tracks are normally loaded but being played only when pressing play pressing play or pressing shuffle is doing the same: playing a song, where play is starting the first song or the selected song being loaded and shuffle is doing a random track of the loaded playlist
Option one is a good alternative
I am able to change the code on the place it is needed ;)
Ok.. so I spend some more minutes thinking about it and i've found a way to realize option 2. So now if you turn shuffle on BEFORE adding a track list it will directly random play without playing the first one (except it is chosen by the shuffle :) ). I just tested it 5min and it seems to work.. Please test it further since I don't use shuffle that often (Auto DJ ftw).
The downside or Bug (let's call it feature) is, that if you turn shuffle off and on while a playlist is played it's shuffles two times on the next track change, but it's not noticeable.
For option 2. edit /public/js/mstream.player.js Search for "mstreamModule.toggleShuffle" and edit:
if (mstreamModule.playerStats.shuffle === true) {
newShuffle();
} else {
turnShuffleOff();
}
to:
if (mstreamModule.playerStats.shuffle === true) {
newShuffle();
mstreamModule.playerStats.shuffleOnce = true;
} else {
turnShuffleOff();
}
so just add mstreamModule.playerStats.shuffleOnce = true;
below newShuffle();
Optional: do the same on "mstreamModule.setShuffle"
Now search for "function setMedia(song, player, play)" and edit:
onplay: function () {},
to:
onplay: function () {
if (mstreamModule.playerStats.shuffle && mstreamModule.playerStats.shuffleOnce) {
mstreamModule.playerStats.shuffleOnce = false;
goToNextSong();
}
},
I think option 1 is now useless or what do you think? Because Pause a track, set shuffle on, click Play are unnecessary extra steps then just click next.
At the moment I'm working on a new Interface for mStream were i could include some User settings like Auto Play on/off.
let me try that.. yeah option 2 is the best
note: with this solution you have to turn shuffle off and on again if you clear the playlist and add a new track list, because in this code (as you may can see) it only sets "shuffleOnce = true" on the press of the shuffle button which then gets set to "false" on the first play, and i keeps "false" until you press shuffle again.
mhhmmm.. as you can see theire are multiple things that needs to be handled. If it works for you I would come back later to this and see if I can build a better solution
Seems to work fine.. I load 1000 songs press shuffle, see 1st song loaded than randomly a new song is picked and played. Working as expected
NB: I use also auto DJ but my database has +145000 songs now. So in this situation I have a Top 1000 devided over 10 folders with this kind of shuffle I do not have to think about the first song .. purrfect !!
no problem about different playlist. My playlists are that long that they take +8 hours for every folder I like to play .. the changes seems to work fine ..
this is what I changed https://github.com/aroundmyroom/mStream/compare/master...aroundmyroom-patch-1?expand=1
Nice to see that I could helped you. Leave this issue open because it's not solved completely.
Your changes are like I described it to you. (I could just have done a compare like you too -.-)
OT: I also have a huge database.. and then i have folders which have symlinks to different folders in the main collection like /Rock/ with links to /maincollection/ACDC and /maincollection/Billy Talent etc. So i have folders like 80s, 90s, House, Party, ... It basically acts like a playlist..
These folders with links to the maincollection are registered in the config as folders.
And then in Auto DJ I can select if i want all of them or just rock combined with house or 80s and 90s or just 90s and so on.. Downside: mStream scans this links like new tracks and so the database gets even bigger. To prevent a mix of the main music collection with the linked folders a created 2 users.. one with the main collection and one with the linked folders.
But I think that's another topic
How can you select auto DJ with only parts of your music collection? ah through the setup you first have t select those specific folders get it now I only have 1 folder with many subfolders..
Do you know what symbolic links are?
(if not google it and i don't know how this works on windows/mac)
I also just have 1 big folder with many subfolders..
let me try something:
Main folder with all my music
/main/rock/ |->rockartist1 |->rockartist2 |->rockartist3 /main/House/ |->compilation1 |->DJ1 |->bestOf1 /main/EDM/ |->compilation5 |->DJ23 |->bestOf8
and so on..
Now the folders with links to the main folder
/rock/ |-> link to /main/rock/rockartist1 |-> link to /main/rock/rockartist2 |-> link to /main/rock/rockartist3 /Elektronic/ |-> link to /main/House/compilation1 |-> link to /main/House/bestOf1 |-> link to /main/House/DJ1 |-> link to /main/EDM/compilation5 |-> link to /main/EDM/DJ23 |-> link to /main/EDM/bestOf8
And by adding / removing these links i can always add or remove specific content without touching the main folder.
So mStream User #1 have only the main folder and mStream User #2 have /rock/, /Elektronik/, etc. So mStream User #2 can select in auto DJ different folders which relate to parts of the main folder. It sounds complicated but it isn't :)
So in these Folders there are actually no files physically present, they are only in the main folder. It's like a desktop link to a Program.. the Program itself is not on the desktop
Hope this is a bit more understandable :)
clear. my music is on Linux so I could do that ;)