View Issue Details

IDProjectCategoryView StatusLast Update
0009352MMASynchronizationpublic2012-10-20 00:46
Reporterjiri Assigned To 
PriorityurgentSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Summary0009352: USB DB Synchronization
DescriptionAs discussed over e-mail and Skype, we need modify the Android USB DB synchronization as follows:

Steps done by MM for Windows:

1. Download mmstore.db from the phone. In case mmstoresynced.db exists, it's downloaded instead (see below).
2. Add triggers to log all the activity of sync operations and a table to store info about these operations:
Table: SyncOperations
Fields:
ID
IDItem - ID of item modified
OperationType - integer specifying whether a track was Added, Deleted or Modified. Other logged operations would also include Playlists modifications
IDField - ID of field modified (or inserted), e.g. 1=Title, 2=Album, etc.
NewValue - New value of the field
Timestamp - time in UTC (can be used later to resolved conflicts)
3. Do all the sync operations
4. Upload the updated DB as mmstoresynced.db.

Steps done by MM for Android:

1. Monitor existence of mmstoresynced.db on startup of application and during application run.
2. When mmstoresynced.db is created, application will reflect all its operations to the mmstore.db and delete mmstoresynced.db.
TagsNo tags attached.
Fixed in build

Activities

Ludek

2012-05-17 01:19

developer   ~0031158

Last edited: 2012-05-17 01:21

Added in build 4.1.0.1601

The OperationType values are:

MEDIA_ADDED = 1;
MEDIA_UPDATED = 2;
MEDIA_DELETED = 3;
PLAYLIST_ADDED = 4;
PLAYLIST_UPDATED = 5;
PLAYLIST_DELETED = 6;

Filename of the synced/modified DB is 'mmstore.db.synced'

jiri

2012-06-10 21:39

administrator   ~0031339

Part of this issue would be to optimize DB access in general - including during the initial scan.

jiri

2012-06-21 11:17

administrator   ~0031428

Per Skype conf.call, the exact workflow of USB sync (particularly re. sync over MTP) was decided to be:

1. On device connection over USB, MM for Win (MMW) tries to read mmstore.db from the phone, in order to know device content.
2. In case the DB doesn't exist, our MM for Android (MMA) probably isn't installed and so the device scan proceeds as for any other device.
3. In case the DB isn't readable, it's probably locked by MMA and so MMW writes a file to database folder, which notifies MMA to close the DB, copy it to another file and continue normal operations. This alternative DB should be perfectly readable for MMW, since no DB connection will exist.

4. During sync and track upload to device, MMW will continually update its local copy of the device DB. It will periodically (every 30 sec or so) upload the updated DB to the device, so that MMA can update its internal DB during the sync. MMW will make this upload to a specific filename, but in case the upload fails (probably because the file is locked by MMA), MMW will upload it to an alternative filename, so that MMA can use this second file when it finishes with the first one.

marek

2012-08-08 09:57

developer   ~0031618

Implemented

peke

2012-10-20 00:46

developer   ~0032678

Verified 47 and MMW 1602