hi to all interested in a real randomized album order.
as
i promised: here comes a small sh-script which randomizes the b2db file
directly on the B2 using the power of it's raspberry pi inside. i
provide it on your own risk - of course. be aware! it's just a hack.
it was first written as a bash/zsh-script and tested on my macBook. but than i had to realize, that there is just a small ash (almquist)
unix-shell implementation on the pi which lacks of all the neat
functions of modern shells. i literally had to go back to the late
1980s! any idea how to script without arrays? i had to learn and to
re-write most parts of the script. but now it's up and running on my
B2. feel free to download and use it. ... and if you are familiar to
shell-scripting please do not complain about the syntax. there are much
more elegant ways for sure. feel free to improve my script.
it takes a little more than 30 seconds to randomize the 4238 tracks in 330 albums on my B2 which runs the software version B2B from jul 21 2020 08:11:29!
some instructions:
(1) download, unzip and put the "scripts" folder directly on a FAT-formated USB device
(2) edit the randomizeB2DB.displace file to provide your own list of artists or albums which should be shifted to the end of the new b2db file - one artist or artist/album per line, no quotation marks
(3) insert USB-stick in USB-port C of your B2
(4) log in to your B2 remotely using putty or a terminal - my B2 listens to the inventive network name "brennan" but the IP would be sufficient too
% ssh root@brennan
root@brennan's password:
(5) create a new directory
# mkdir ./scripts
(6) move the randomizeB2DB.displace and randomizeB2DB.sh files to the new directory and check the content
# mv /media/usbc/scripts/randomizeB2DB.* ./scripts
# ls -al ./scripts
-rw-r--r-- 1 root root 26 Aug 16 14:45 randomizeB2DB.displace
-rwxr-xr-x 1 root root 3586 Aug 18 13:34 randomizeB2DB.sh
(7) if the permission sequences of both lines - -rw-r--r-- for randomizeB2DB.displace and -rwxr-xr-x for randomizeB2DB.sh - do not match please type
# chmod 644 ./scripts/randomizeB2DB.displace; chmod 755 ./scripts/randomizeB2DB.sh
(8) that's it! you are ready to randomize the b2db file of your B2:
# ./scripts/randomizeB2DB.sh
now you have to wait until the next empty line starting with an # appears - it depends on the total amount of albums on your B2. i would roughly estimate 10 seconds per 100 albums on my B2.
(9) check the first lines of your new b2db file with
# head -9 /media/hdd1/b2db*
==> /media/hdd1/b2db <==
Version 3
330 Albums 0 mirror
The Brecker Brothers/Return Of The Brecker Brothers
11 tracks
01 Song For Barry.m4a
02 King Of The Lobby.m4a
03 Big Idea.m4a
04 Above & Below.m4a
05 That's All There Is To It.m4a
==> /media/hdd1/b2db.backup <==
Version 3
330 Albums 0 mirror
Peter Gabriel/Birdy
12 tracks
01 At Night.m4a
02 Floating Dogs.m4a
03 Quiet And Alone.m4a
04 Close Up (from Family Snapshot).m4a
05 Slow Water.m4a
==> /media/hdd1/b2db.orig <==
Version 3
330 Albums 0 mirror
340ml/Moving
17 tracks
01 Shotgun.m4a
02 Hang On To Yourself (Rachel).m4a
03 Midnight.m4a
04 What Happens In Between.m4a
05 Early Morning.m4a
if you are not familiar with terminal/putty and command line shells ask a friend to show you, what to do. he might understand the script be reading it. there are lots of comments describing the script step by step. next time you want to re-randomize the b2db file you just need to log in again and type
# ./scripts/randomizeB2DB.sh
the original b2db file is saved as b2db.orig file before overwriting it with the new b2db file. the last re-randomization is saved as b2db.backup file. if you have added some new albums re-scan your B2 via UI. if the b2db differs in size or amount of albums, the b2db file is saved as b2db.orig file after the next re-randomization.
feedback would be appreciated.
ober!schöne grüße,
marcus.