getmusicbee.com

Support => Portable Devices => Topic started by: Steven on January 13, 2019, 10:38:02 AM

Title: Enhancements to device synching
Post by: Steven on January 13, 2019, 10:38:02 AM
On getting a new android phone, I am having a few of the weird issues reported in a number of posts. I have put in handling for the issues I found and also taken the opportunity to optimise a number of aspects of the synching. Synching overall should be a bit faster and robust for all types of devices and significantly noticeable for MTP devices (although MTP is still a very slow protocol).
There is still one issue which I dont think I can completely solve, and thats when any files are deleted from a MTP device (including replacing an existing file), at some point the device will block activity for up to a couple of minutes (I assume because the device needs to  scan the entire contents). Its often noticeable when MB gets to the playlist synch part. I have made some improvements so I think it should happen less often than before.

Ensure you replace all files in this zip (especially Interop.PortableDeviceApiLib.dll and Interop.PortableDeviceTypesLib.dll otherwise you may get crashes)
https://getmusicbee.com/patches/MusicBee33_Patched.zip
Title: Re: Enhancements to device synching
Post by: phred on January 13, 2019, 02:33:09 PM
That's good to hear and great timing. Today is 're-sync' day. I'll be testing and will let you know if I see any issues. Thanks.
Title: Re: Enhancements to device synching
Post by: frankz on January 13, 2019, 06:50:38 PM
Just started us MB to sync to my Galaxy S8 this week, so this is my second sync.  Using the new patch as of today.  I've verified that the 2 dlls referenced above are dated today, not older versions.

Getting a lot of "Delete Failed - Exception from HRESULT: 0x80042009" and "Copy Failed - Exception from HRESULT: 0x80042009"

Not sure what information you'd need to trouble shoot, as I don't know what that means.

Here's one full delete failure from the error log:
Code
1/13/2019 1:45:57 PM - Exception from HRESULT: 0x80042009
1/13/2019 1:45:57 PM - 10.0.17134.0 - 3.3.6952.24850S - System.Exception: delete SM-G950U\Card\Music\Lucy Dacus\Historian\06 - Body to Flame.mp3 ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80042009
   at PortableDeviceApiLib.IPortableDeviceContent.EnumObjects(UInt32 dwFlags, String pszParentObjectID, IPortableDeviceValues pFilter, IEnumPortableDeviceObjectIDs& ppenum)
   at #=zPeQASBZ_L72EJcgr9UGxHZLqioVF.#=z3kSOeIIdMvFe(String #=zgLsxXQaHAGRr)
   at #=zPeQASBZ_L72EJcgr9UGxHZLqioVF.#=z5JVkugoxxZo6(String #=z4$RSwU8M2L_d, String #=zwGYqcek=)
   at #=zPeQASBZ_L72EJcgr9UGxHZLqioVF.#=zCZRHR5m0DJPz(IList`1 #=z5jFYUUM=, Boolean #=z3JPcya5eOsbx3EIQPA==)
   at #=zHGLAitcTmrBiJv5aEv7fTk4=.#=zGhCX2sHZ9I7aDKkV1B_cUEK5vk4z(List`1 #=zyKefCR$Uxe3e, Object #=zBcedkP$4afSD)
   --- End of inner exception stack trace ---

Here's one full copy failure from the error log:
Code
1/13/2019 1:54:16 PM - Exception from HRESULT: 0x80042009
1/13/2019 1:54:19 PM - Copy \\DESKTOP\Music\Organized\The Kills\(2008) Midnight Boom\09 - Sour Cherry.mp3 to SM-G950U\Card\Music\The Kills\Midnight Boom\09 - Sour Cherry.mp3

Besides "delete if not in sync" and "confirm deletion" which are out of frame, here are my settings:
(https://i.imgur.com/S1mDn3Y.png)
Title: Re: Enhancements to device synching
Post by: Steven on January 13, 2019, 07:00:41 PM
do you think it might be the case that all files in the folder:
SM-G950U\Card\Music\Lucy Dacus\Historian
were deleted
Title: Re: Enhancements to device synching
Post by: frankz on January 13, 2019, 07:07:09 PM
do you think it might be the case that all files in the folder:
SM-G950U\Card\Music\Lucy Dacus\Historian
were deleted
No, they're all still there listed as last modified as of my last sync
(https://i.imgur.com/HzZBVBW.png)
Title: Re: Enhancements to device synching
Post by: frankz on January 13, 2019, 07:14:53 PM
That said, looking at the full list of delete failures, it is the case where the files were in fact deleted from the device and the directory removed although it's reading as a failure result.

OK - I see what's happening now. Every single delete threw an error even though some did get deleted and some did not.

The copy failures are all legit copy failures.  The files aren't on the card.
Title: Re: Enhancements to device synching
Post by: Steven on January 13, 2019, 07:18:22 PM
That said, looking at the full list of delete failures, it is the case where the files were in fact deleted from the device and the directory removed although it's reading as a failure result.
in all cases, or just some?
Title: Re: Enhancements to device synching
Post by: frankz on January 13, 2019, 07:22:42 PM
That said, looking at the full list of delete failures, it is the case where the files were in fact deleted from the device and the directory removed although it's reading as a failure result.
in all cases, or just some?
Sorry, I was modifying my last message while you were asking this.

Some files got deleted and some did not but every single attempted delete threw that error regardless of if it was actually successful or not.
Title: Re: Enhancements to device synching
Post by: Steven on January 13, 2019, 07:29:55 PM
Thanks. I should be able to put in handling but it will take a day or so.
Is this the first time the sync process has needed to delete files? (I ask because i dont see anything about the new version that would cause this issue - i believe its a device specific issue)
Title: Re: Enhancements to device synching
Post by: frankz on January 13, 2019, 07:31:43 PM
It's my second sync, so yes no deletions last time.  The first time there were no files on the card.
Title: Re: Enhancements to device synching
Post by: Steven on January 13, 2019, 09:06:19 PM
could you try with this version:
https://getmusicbee.com/patches/MusicBee33_Patched.zip
Title: Re: Enhancements to device synching
Post by: phred on January 13, 2019, 10:13:02 PM
Using the version you posted earlier today, I have synced a couple of times to two different (Android-based) devices, one of which is a Galaxy S8. I experienced the same issue as frankz with files needing to be deleted - "Delete Failed - Exception from HRESULT: 0x80042009"

Using the patch you posted most recently seems to have solved the issue. Lots of deleted and copied tracks with no errors.
Title: Re: Enhancements to device synching
Post by: frankz on January 13, 2019, 11:04:39 PM
could you try with this version:
https://getmusicbee.com/patches/MusicBee33_Patched.zip
Perfect sync. 1295 deletions 1466 copies all successful and files move much faster than before the improvements.  Thanks!
Title: Re: Enhancements to device synching
Post by: frankz on January 14, 2019, 12:26:41 AM
Ah, I lied.  My playlists didn't make it over.  They're still the same versions from January 10.
Title: Re: Enhancements to device synching
Post by: phred on January 14, 2019, 02:40:27 AM
Ah, I lied.  My playlists didn't make it over.  They're still the same versions from January 10.
I only have two playlists on my S8. Via MB's device music settings I removed those two and selected two others and then performed a sync. No problem. Two were deleted and two were added. Then I tried again, removing the two new ones and re-adding the two old ones. No problem.

@frankz- are you using the Samsung default player, or a third-party app? If the latter, which one? I'm using GoneMAD Music Player and use M3U playlists. You should also make sure you're using a dedicated Playlists directory and not trying to dump the playlists in the Music directory.
Title: Re: Enhancements to device synching
Post by: frankz on January 14, 2019, 02:59:47 AM
I'm using Neutron. It shouldn't matter to MB on synch what player you're using on your phone, though. I'm seeing in ES File Explorer and Windows Explorer that these are the old versions which have survived two subsequent synch attempts untouched, nothing to do with the player at all.


As shown in my settings screenshot above, I have a dedicated folder for playlists and am using M3U.
Title: Re: Enhancements to device synching
Post by: phred on January 14, 2019, 03:38:57 AM
I'm using Neutron. It shouldn't matter to MB on synch what player you're using on your phone, though. I'm seeing in ES File Explorer and Windows Explorer that these are the old versions which have survived two subsequent synch attempts untouched, nothing to do with the player at all.
I only ask because if we were both using the same player app and had different results, it would be odd. But yes, the player shouldn't matter.

How about deleting all the playlists off the phone via a file manager and then syncing? Then as an experiment, change one playlist by adding, deleting, or tag editing a track or two. Then resync and see if the playlist updates properly.
Title: Re: Enhancements to device synching
Post by: frankz on January 14, 2019, 04:06:51 AM
How about deleting all the playlists off the phone via a file manager and then syncing? Then as an experiment, change one playlist by adding, deleting, or tag editing a track or two. Then resync and see if the playlist updates properly.
On it.  I'll report back.
Title: Re: Enhancements to device synching
Post by: frankz on January 14, 2019, 04:45:18 AM
OK.  All is apparently well.  I deleted the playlists and did a sync, and all the playlists got sent to the card along with the files and no errors in sight. Then I added a song to one of the playlists.  Because one of the (other) playlists is an auto playlist with high turnover, doing another sync at this point would result in another 2000 deleted and/or copied files which I didn't have time for, so I just did a preview, and MB indicated it would have resent the changed playlist, which is good enough evidence for me that it's working fine.  Must have been some glitch with the previous playlists.  Who knows.

Worst case I delete the existing playlists from the card before syncing, which isn't optimal but wouldn't be the end of the world. But it seems fine.

Nice update right at the right time for me having just started using MB to sync (one more nail in the MediaMonkey coffin - now I need to get myself off of my iPod so I can uninstall MM for good).  Thanks.
Title: Re: Enhancements to device synching
Post by: phred on January 15, 2019, 01:28:31 AM
Using 3.3.6952

This is really odd, and quite frankly I can't understand how it is happening. I'm syncing to two Android-based devices - a Samsung Galaxy S8 and a FiiO X5-iii. I'm using the same player on both (GoneMad Music Player although this should matter.)

The playlists sync to the FiiO just fine, but not to the Samsung. Both use M3U playlists. After the sync, looking at the Playlists directory with a file manager, the FiiO has all the M3U playlists. The Samsung not only has the M3U playlists, but also PLA playlists, which contain zero bytes. The M3U playlists are missing the first letter of each line, making them unplayable. I'm trying to sync two playlists to the Samsung and I'm only getting one of the M3Us (containing data minus the first letter.) And I get both of the PLAs, which are a)empty, and b)not set up to sync.

The MB's device settings for playlist are both the same with one exception: The FiiO has a field for "path prefix for tracks" while the Samsung doesn't offer that field. Both devices have a Playlists directory and both have a Music directory. Neither use relative file paths.

@frankz- did you actually play any playlists on your Samsung since you did the sync yesterday? If not, please do so. And look to see if the first letter is missing from each line in the M3U.
Title: Re: Enhancements to device synching
Post by: frankz on January 15, 2019, 01:54:46 AM
@frankz- did you actually play any playlists on your Samsung since you did the sync yesterday? If not, please do so. And look to see if the first letter is missing from each line in the M3U.
Hi,

I have been playing from the playlists that I sent to the Galaxy S8 yesterday and they appear to be working correctly as far as being able to be played.  However, the phone is not reading all of the songs that are on the actual playlist.  My main playlist had over 7100 tracks when synched to the phone and when I open it from the phone in Notepad++ they're all there, but every single player (I've tried them all in the last couple days trying to get them to work flawlessly with my new Android Auto car) sees ~6900.  I haven't gotten down to comparing what's missing, but I'm wondering if M3U8 wouldn't be a better option.  Just spitballing because I'm thinking it's a character conversion issue. Bands love to put non ASCII characters in their names and song titles.

I don't see the issue with the PLA playlists that you're seeing.  Not to say it won't show up tomorrow.
Title: Re: Enhancements to device synching
Post by: phred on January 15, 2019, 01:58:45 AM
@frankz-

I'm working with a much smaller sample size on the S8 - only 205 tracks. But they're all being transferred.

As for the playlist issue, let's just call it lack of attention by the user.

Somewhere along the line the "use relative paths" option became unticked. Once I enabled it no PLA playlists were transferred. And the M3U playlists transferred and were not missing the first letter of each line. And they were/are playable.

Good night World.
Title: Re: Enhancements to device synching
Post by: frankz on January 15, 2019, 06:00:13 AM
I'm working with a much smaller sample size on the S8 - only 205 tracks. But they're all being transferred.
Glad to hear it worked out for you.

For sure MB did what it was supposed to for me - the playlist is there fine and I don't doubt that the files are there where they're supposed to be, too.  I just have to figure out why the S8 isn't registering all of its tracks.

I see the latest patch addresses the issue of auto-playlists not making it over, which was my problem a few posts back I guess. I'll give that a go on my next sync.

Using my phone for music is a new world for me.  I was locked into my iPod by my old car's interface.  No more.
Title: Re: Enhancements to device synching
Post by: Steven on January 15, 2019, 05:46:52 PM
Just regarding the couple of minutes blocking that occurs on the device after files have been deleted, just to make sure it really wasnt something MB is doing wrong, I tried with another player and had exactly the same behaviour.
What i will look to do is add a message if the condition is detected so at least users will know whats going on
Title: Re: Enhancements to device synching
Post by: Steven on January 15, 2019, 08:33:21 PM
https://getmusicbee.com/patches/MusicBee33_Patched.zip

- tweaked handling for detecting when playlists and files need to be synched
- informational message for when stalled synchronisation is detected
- optimised folder cleanup after synch
Title: Re: Enhancements to device synching
Post by: klint on January 16, 2019, 05:17:38 PM
Excellent change, thank you. I can't wait to translate it ;)
Title: Re: Enhancements to device synching
Post by: frankz on January 20, 2019, 05:19:04 PM
I'm still having the problem where some file are not making it to the phone although the sync status says everything was copied and reports no errors and there are no errors in the log.  I've got a 267 song playlist with only 222 songs on the phone, for example.  I thought I had it licked, but no dice.

There's no rhyme or reason about which songs aren't making it as far as file name, and they seem to all be playable in and accessible to MB.  They're no different than the files that do make it - all VBR MP3.

My settings are as posted earlier in the thread, except I changed the file naming to <Disc-Track#>-$Left(<Title>,5) wondering if long file names were the problem.  Didn't seem to make a difference, and some of the ones not making it are shorter than the ones that do.

Any ideas or troubleshooting steps I can undergo?
Title: Re: Enhancements to device synching
Post by: Steven on January 20, 2019, 05:47:40 PM
There is a flaw with the device folder cleanup that removes non-empty device folders in some cases when it shouldnt. Its fixed but i need to do more testing before making it available
Title: Re: Enhancements to device synching
Post by: frankz on January 20, 2019, 06:01:34 PM
There is a flaw with the device folder cleanup that removes non-empty device folders in some cases when it shouldnt. Its fixed but i need to do more testing before making it available
Ah, OK.  I'll sit tight then.
Title: Re: Enhancements to device synching
Post by: Steven on January 20, 2019, 06:08:37 PM
https://getmusicbee.com/patches/MusicBee33_Patched.zip

anyone following this topic should update to this new patch version for the reason stated in the prior post
Title: Re: Enhancements to device synching
Post by: psychoadept on January 22, 2019, 03:15:19 AM
I was resyncing my whole library, and for a minute I thought there was a big problem because I'm using "preserve folders and filenames" and in the preview some tracks appeared to be missing a level of the folder tree. Then I realized that it's just showing the last two levels of the folder tree, so files which were a level deeper only appeared to be missing a folder. I think either it needs to say somewhere that it's not showing the entire path, or it should just show the entire path.
Title: Re: Enhancements to device synching
Post by: frankz on January 22, 2019, 05:31:25 AM
Almost scared to write it, but it appears that whatever magic you wove into 3.3.6959 did the trick.  All files in my latest sync made it to the phone and stayed there.  Very nice.
Title: Re: Enhancements to device synching
Post by: Steven on January 22, 2019, 06:18:32 PM
I think either it needs to say somewhere that it's not showing the entire path, or it should just show the entire path.
I have updated it to show the path relative to the synch root folder

https://getmusicbee.com/patches/MusicBee33_Patched.zip

Also regarding the device stalling synchronisation after any files have been deleted, I thought I was on to something by placing the Playlists folder in the Music folder ie. Music\Playlists
That did seem to help but in my most recent test i had stalling again while copying a file (usually for me its when the playlists are copied). But i do think it helped, so if its an option for you try that.
Title: Re: Enhancements to device synching
Post by: getgadgets on January 23, 2019, 02:47:25 PM
Just a quick note: .6961 worked great on a fresh sync. Last week I synced my entire library to a new microsd (7,900 tracks) and after updating to .6961 I was able to add some new tracks over quickly without a problem. Yay!
Title: Re: Enhancements to device synching
Post by: railfan-eric28 on March 07, 2019, 02:24:47 AM
Did several posts and pages get deleted?  I thought there was stuff all the way up till now. But the browser is showing Jan 23 as the last day of a post.
I see the thread branched off to the WIFI thread.   Was this a recent move or did I forget about it?   
Title: Re: Enhancements to device synching
Post by: psychoadept on March 08, 2019, 03:46:37 AM
It was split a few days ago, maybe a week? Steven did it, I'm sure. Moderators can split threads any time.
Title: Re: Enhancements to device synching
Post by: railfan-eric28 on March 08, 2019, 03:51:22 PM
It was split a few days ago, maybe a week? Steven did it, I'm sure. Moderators can split threads any time.
Ok thanks.