Author Topic: Need Help with Strange Difference Syncing 2 Libraries  (Read 972 times)

Astro Gaze

  • Jr. Member
  • **
  • Posts: 38
Hey guys,

I'm having a mysterious issue trying to sync 2 different libraries. I'd appreciate some help.

As I stated above, I use 2 libraries which live in my Default Music Folder
- C:\Users\[name]\Music\Main Library\Songs\...
- C:\Users\[name]\Music\Spotify Library\Songs\...

Currently I'm trying to sync them to the same device. But in Sync Settings, the "Media storage path" for "Music Files" treats the path in one of my libraries different from the other. Even though they're in the same \Music\ parent folder on my computer. Also, it's set to "Preserve folders and filenames". To my understanding, this should prevent the deviation I'm experiencing.

Issue:
- In my Main Library's Sync Window, when I hit Sync Preview the Target Filename is "Music\Main Library\..." This is what I want.

- But when I Switch to my Spotify Library's Sync Window and I hit Sync Preview, the Target Filename is "Spotify Library\...". The \Music\ parent folder is disregarded.

- In both Sync's, Music files is set to "*".


I Sync'ed both libraries in the current setup and checked the device to confirm. Yes, one library is in the Music folder, and the other is outside it.

1. Why is there a discrepancy for the same setting?  
2. I feel like this could be caused by an internal temporary cache error. Is there a way to clear App Cache on Windows 10, like in an Android's App Settings?
- I found C:\Users\aryan\AppData\Local\MusicBee\InternalCache. But that doesn't affect settings.

MusicBee: Installer
MusicBee Version: 3.5 Patched 2
OS: Windows 10
Syncing to: Android 10

Thanks for reading.

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 33483
The existing 'preserve folders and filenames' implementation is not great and something i would remove if it wasnt that some people are using it and works for them.
I expect you have one or more files in one of the libraries that are not in the library folder structure or perhaps one library is auto-organised.
I might enhance the functionality so a user can explicitly specify the root folders

Astro Gaze

  • Jr. Member
  • **
  • Posts: 38
Hey Steven,

Thanks for replying so quickly!
It's too bad about Preserve folders. But thanks for clarifying.
I try to keep my files within the folder tree. Unless something's under review in the Inbox folder. Here's a shot of my folder tree.


I just looked up Auto Organize and in the preferences it's unchecked. I don't remember having used it before. But to be sure, I set Path as a Displayed Field and they point to within the screenshot folder tree. Not sure if I should be happy about that or not. Haha

Within my Spotify Library I was experimenting with using more child-folders under the \Songs\ parent-folder. So, where my Main Library looks like C:\Users\[name]\Music\Main Library\Songs\[music files]. My Spotify Library is broken up into seperate folders holding the music files. Like C:\Users\[name]\Music\Spotify Library\Songs\Luquicity Label\[music files]. Could this extra complication or folder-set be causing Sync to misbehave?

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 33483
the playlists might be referring to files outside the relevant library structure

Astro Gaze

  • Jr. Member
  • **
  • Posts: 38
Just finished checking the Paths Displayed Field. I have a lot of Playlists 😅
Unfortunately, they don't.

I also plugged in today's patch from here (https://getmusicbee.com/patches/), just to see if it'll knock those settings straight. No change.

Would you be able to split the Sync Settings so that they're dependant on which library you're syncing from? Or even just Media Storage and Playlist Storage (if that's less work).
That way I'd be able to force-in the extra \Music\ folder where needed.

Mayibongwe

  • Hero Member
  • *****
  • Posts: 513
Would you be able to split the Sync Settings so that they're dependant on which library you're syncing from? Or even just Media Storage and Playlist Storage (if that's less work).
That way I'd be able to force-in the extra \Music\ folder where needed.
For what you're trying to achieve, I think that wouldn't be necessary.
If you change the storage path setting to use naming template, you will get more control over the situation than with "preserve folders and filenames".
So try switching to that setting and then use the following template for the "music files" section:

Code
$RxReplace(<URL>,".*?(Music.*)","$1")

Edit:
Sorry, forget about that. It's not going to work. While the path does display fine in the template editor's preview list, the same cannot be said of the target filename in the sync preview window - MusicBee seems to replace the path's backslashes with a space.
Last Edit: September 02, 2022, 06:46:05 PM by Mayibongwe

Mayibongwe

  • Hero Member
  • *****
  • Posts: 513
MusicBee seems to replace the path's backslashes with a space.
I just remembered that in MusicBee, we can set the desired replacement values for illegal filename characters in Tools > Organise Files > Filename Char Mapping.
By default, the backslash is set to be replaced with an empty space.
But for the purpose of what you're trying to achieve here, you'll need the backslash (\) replaced with something like an equal sign (=) instead.

You only have to do this once. Then going forward, the below template will now produce a target filename beginning with the "Music" parent folder.
If you don't mind the workaround, I think this should work just like "preserve folders and filenames" would have worked.
Code
$Replace($RxReplace(<Path>,".*?(Music.*)","$1"),=,\)<Filename>

Astro Gaze

  • Jr. Member
  • **
  • Posts: 38
MusicBee seems to replace the path's backslashes with a space.
I just remembered that in MusicBee, we can set the desired replacement values for illegal filename characters in Tools > Organise Files > Filename Char Mapping.
By default, the backslash is set to be replaced with an empty space.
But for the purpose of what you're trying to achieve here, you'll need the backslash (\) replaced with something like an equal sign (=) instead.

You only have to do this once. Then going forward, the below template will now produce a target filename beginning with the "Music" parent folder.
If you don't mind the workaround, I think this should work just like "preserve folders and filenames" would have worked.
Code
$Replace($RxReplace(<Path>,".*?(Music.*)","$1"),=,\)<Filename>

My man! To the rescue  again.

I just tried this and it worked perfectly.
Thank you, Mayibongwe.

I didn't know you could input script here. I've been thinking of diving into learning code. Which language is this?

Also, is this possible for the playlist file path?
I keep the libraries' playlists separate too, but when I plugged your code into the playlist file path, the copy failed.

Mayibongwe

  • Hero Member
  • *****
  • Posts: 513
Nice. Glad it works.

I believe those two are universal functions not exclusive to any programming language.
They both do a search & replace and their syntax is almost always the same in any program that offers them.
For MusicBee purposes, you will find this helpful: https://getmusicbee.com/forum/index.php?topic=35868.0

Also, is this possible for the playlist file path?
I keep the libraries' playlists separate too, but when I plugged your code into the playlist file path, the copy failed.
No, it isn't. I think you're just going to have to manually modify the playlist file path every time you perform a sync from the other library.

Astro Gaze

  • Jr. Member
  • **
  • Posts: 38