View Issue Details

IDProjectCategoryView StatusLast Update
0013115MMASynchronizationpublic2016-02-10 20:28
Reporterrusty Assigned To 
PriorityimmediateSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Fixed in Version1.1.3 
Summary0013115: First-time USB sync to various devices fails (xml file not seen over MTP)
DescriptionAttempts to sync via USB to a Huawei Y6 SD card consistently fail.

0 Clean install of MMA to Huawei y6. Run MMA (to generate xml file) and grant access via SAF as required. Close MMA.

1 Connect USB device and sync 'Test hierarchy' playlist
--> sync fails partway through (for some reason device appears disconnected in MMW)

2 2nd attempt to sync 'Test hierarchy' playlist
--> sync fails partway through (for some reason device appears disconnected in MMW)

3 Run MMA
--> Tracks appear in MMA, but not playlists (because playlists never made it across due to the interruption in the sync process). Debug log N49V5EZ6LU

4 Initiate Wi-Fi sync
--> Tracks sync successfully. Debug log: J74BV4YSG7.

5 Connect the device to the PC --> recognized as 'HUAWEI SCL-L04-SD card' but it is a brand new profile (even though an apparently identical profile already exists in MMW)!

6 Attempt to sync via the new profile (I did 2 playlist sync operations first of '1 Background - instrumental', and the second of 'Sara's Party')
--> Tracks all appear to sync successfully
--> BUT, strangely, when I look at the playlists via MMW, hierarchy is missing (as if this new profile was created without knowledge of the xml file on the device).

7 Run MMA
--> Tracks that were synced at step 6 appear on the device but are missing ratings, and playlists are all at 1 level (hierarcy is missing). Moreover, the sync profile on the device is the same as that from Step 4.

dbview log of the entire sequence is posted.
Additional InformationNote: I experienced failed USB sync with an Asus Zenphone 2 laser and Fire 7 device running CM 12.1 as well.
Marek confirmed that it also occurs on an Alcatel Idol 3 5.5 / Android 5.1.

0 Clean install of MMA to Huawei y6. Run MMA (to generate xml file) and grant access via SAF as required. Close MMA.

1 Connect USB device and sync 'Test hierarchy' playlist
-->Tracks sync but ratings and playlist hierarchy don't sync (i.e. the xml file was not read)

Logs to be collected.
TagsNo tags attached.
Attached Files
Hauwei Y6.zip (482,350 bytes)
Fixed in build544

Relationships

related to 0013119 closedLudek MMW v4 Duplicate profiles can occur due to deletion of storageInfo.xml 
related to 0013121 closedmarek MMA USB sync is sometimes not started immediately 
child of 0013030 closedmarek MMA MediaMonkey can't access its application folder 

Activities

Ludek

2016-02-08 19:49

developer   ~0044085

Last edited: 2016-02-08 20:01

In 1 & 2 there is MTP error 802A0006 when uploading tracks

The reason for duplicate profile creation (and issues 5,6,7) is that storageInfo.xml wasn't found in any location on the SD card.

MMW thinks that MMA was not installed on the device and sync the SD card like normal memory storage

Ludek

2016-02-08 20:12

developer   ~0044086

As confirmed by Rusty via IM:

When look in Windows explorer,
Internal storage: all subdirectories appear
SD card: only /Music and /Playlists directories appear.

Ludek

2016-02-08 20:26

developer   ~0044087

Last edited: 2016-02-08 20:27

Could it be somehow related to SAF ?

e.g. that only /Playlists/ and /Music/ directories appear via MTP because they were approved in MMA ? And the 1&2 failed, because any folder wasn't approved thus SD card wasn't writeable over MTP at all? And appeared as clean ?

I haven't seen that yet, but based on the info it looks it might be something like this (Just guessing)

rusty

2016-02-08 21:10

administrator   ~0044088

Last edited: 2016-02-08 21:55

So it turns out that the problem is that even though MMA writes storeInfo.xml to the MediaMonkey app-specific folder on the SD card, the directory isn't shared over MTP with the PC due to a refresh problem. If I restart the device, an MTP refresh is triggered, and then subsequent sync operations work correctly (since MMW knows where/how to sync content).

The problem in this situation is usually related to the device's MTP implementation. The only possible solution to this would be that in such cases (where an Android device is connecting but the associated xml file cannot be read by MMW), MMW should recommend to users that they should sync via Wi-Fi sync instead of via USB OR disconnect/reboot/reconnect.

e.g. if a user initiates a first-time usb sync and MMW detects detects certain folders that indicate that an android device is connected then show:

"MediaMonkey didn't detect a copy of MediaMonkey for Android on this Android device. It is recommended that you:
- Install and run 'MediaMonkey for Android' before syncing
- Reboot your device

If that doesn't solve the problem, then it's recommended that you initiate synchronization via the Android device instead using Wi-Fi sync. "

[ ] Don't show this warning again

Ludek

2016-02-09 10:23

developer   ~0044089

Last edited: 2016-02-09 10:27

Note that for MMW is hard to detect what is wrong once it cannot see the actual content. Based on your logs even 'Android' folder wasn't visible over MTP, so not only that MMW couldn't detect that MMA wrote something to the storage, but it even couldn't detect that it is actually an Android device storage.

Note also that the same situation also could be expected in the scenario that MMA was installed, but kept closed (or uninstalled) and SD card would be replaced in the meantime.

I think that only MMA can detect the situation once it will see that MMW uploaded StorageInfo.xml.mmw while StorageInfo.xml was already there.
In this case MMA should use the GUID pairing key from the MMW version of StorageInfo to prevent from the duplicate profile creation.

And thus on next USB sync there would be only one profile (as expected) and metadata like rating and playlist hierarchy would be reconstructed.

Ludek

2016-02-09 13:51

developer   ~0044091

As discussed offline, this might be a regression in MMA related to 0013030

Marek is also going to implement the suggested duplicate profile prevention as suggested in my last note.

rusty

2016-02-09 14:11

administrator   ~0044092

Last edited: 2016-02-09 15:43

I've verified the fix in test build 542 on both the Zenphone 2 / Android 5.1, and Fire 7 / CM 12.1 devices.

EDIT: tested with the Huawei Y6 and it seems to work correctly as well with build 542.

marek

2016-02-09 20:25

developer   ~0044097

Last edited: 2016-02-09 20:28

Fixed in build 544

Added new way of parsing storage info xml files. The process is described by following pseudocode:

get GUID from storageInfo.xml in application specific folder
if(GUID not found)
{
  get GUID from storageInfo.xml in /MediaMonkey/ folder
}

if(GUID not found)
{
  get GUID from storageInfo.xml.mmw in /MediaMonkey/ folder
  if(GUID not found)
  {
    generate GUID
  }
}
else
{
  if(storageInfo.xml.mmw contains different GUID)
  {
    use GUID from storageInfo.xml.mmw
  }
}


Now MMA also writes storageInfo.xml to both app specific folder and /MediaMonkey/ folder (only if access is granted) so the settings is not lost when MMA is uninstalled.

rusty

2016-02-10 03:52

administrator   ~0044104

Last edited: 2016-02-10 04:05

Build 544 seemed to work correctly for the Amazon Fire 7/CM 12.1, and the Huawei Y6/Android 5.1 (50% of the time--haven't yet figured out why it sometimes works but not othertimes--probably flaky MTP),

BUT it completely broke USB synchronization for the Samsung S5 Mini (Android 4.x). Although multiple playlists were synced, none appeared on the device and only two tracks out of ~10 appeared in MMA (even though ES explorer showed that others had synced). Note that the tracks that did appear had ratings.
Debug log: FZLWFTS6SA

marek

2016-02-10 10:48

developer   ~0044108

I see that MMW copied mmstore.db.synced.0001 and mmstore.db.synced.0002 to MMA. Each DB contains one track. But I do not see any other DBs. There are two options. MMA hasn't recognized other DB or MMW haven't uploaded it.

Could you please check whether they exist in /MediaMonkey/files folder on main storage?

Are you able to create MMW log as well?

rusty

2016-02-10 18:22

administrator   ~0044113

Re-resolving. It seems that it was a problem with MTP on the PC. Rebooting solved the problem.

rusty

2016-02-10 18:46

administrator   ~0044114

Reverified build 545 on Huawei Y6 and Fire 7(cm12.1).