Load b2db doesn't ...

176 views
Skip to first unread message

keithG

unread,
Aug 10, 2020, 11:08:55 AM8/10/20
to Brennan Forum

I have 'randomised the album sequence' from the saved copy of b2db, but when I load the modified b2db to the b2, it reports OK but the album play sequence remains unchanged. b2db File length is the same, and tracks remain associated with the album.

I've tried restarting the B2. B2Albumlist remains unchanged, and a subsequent save of b2db just confirms that the original album sequence has not changed. HDD mode is selected. Albums were randomised using visual basic. The only grey area is that this used to be an SD only unit and it may remember...

Software tried: 13 Nov 2018 and 20 Jul 2020 give the same result.

Have I missed something, any ideas ?

Regards Keith G

keithG

unread,
Aug 10, 2020, 12:12:33 PM8/10/20
to Brennan Forum
Just adding a note that I'm using the b2db from version Nov 2018 ie version 2, as I've noted that it's now version 3 in Jul 2020 software.

Regards
Keith G 

AndyC

unread,
Aug 11, 2020, 4:07:43 AM8/11/20
to Brennan Forum
Hi Keith,

I reorder my b2db frequently using QBasic similarly to you. I assume you've analysed the structure of b2db and have reassembled it 100% according to the rules. IF the display says it's using HDD then any previous SSD usage is irrelevant.

What I do is:
1. Make sure 'A-Z Sorting' is OFF (it's the 5th button above the music list in the central window of the UI)
2. Run 'Settings>Maintenance>Clean Up' followed by 'Settings>Scan Disk'
3. Export b2db and reconfigure it in your PC
4. Load b2db
5. Reboot (- best done by pulling the plug out rather than a software command)
VERY IMPORTANT - Before the reboot, you must NOT 'Save' (either by 'Standby' or by holding in the Play/Stop botton until the display reads 'Saving').

Hope this helps.

keithG

unread,
Aug 11, 2020, 8:08:15 AM8/11/20
to Brennan Forum
Thanks Andy

Working OK now, it was all down to the reboot, I was pressing the play/stop button  to save before powering off.
Regards
Keith G

marcus

unread,
Aug 12, 2020, 4:34:37 AM8/12/20
to Brennan Forum
dear andyC.

thank you for your short instruction.  i just checked if the 1st bullet point of your list really changes the behaviour of my B2 and - voila! - it does.  i had the 'A-Z sorting' activated which led to the somehow fixed but not really random order i described in another thread.  my B2 now plays in the order represented by the original b2db-file.  i cross-checked by just shifting the last and the first album "by hand" using vi.  ... and yes, it works!!!

next step should be a small sh-script located on the B2 which could be integrated in the boot-routine.  i will research a bit for the randomizer routine and try to provide a suitable script in the next days (or a few weeks).

ober!schöne grüße,
marcus.

marcus

unread,
Aug 18, 2020, 11:23:37 AM8/18/20
to Brennan Forum
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.
scripts.zip

marcus

unread,
Aug 18, 2020, 11:29:38 AM8/18/20
to Brennan Forum
... and VERY IMPORTANT: exit the shell by typing

# exit

or closing the putty or terminal window.  you are log in as root on your B2.  you are able to move or delete everything on the device by accident.  just exit the shell after re-randomizing the b2db file.

ober!schöne grüße,
marcus.

Conor Buescher

unread,
Aug 18, 2020, 11:56:32 AM8/18/20
to Brennan Forum
Very cool. 

Thanks for sharing.

Is there a general Brennan git repo for this kind of stuff?  I see there are several user-written utilities floating around.

I also see that Python is installed on the Raspberry Pi OS.

So, that could be fun.

Conor
Reply all
Reply to author
Forward
0 new messages