Subsetted Playlist Syncing Addon

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

Posts: 11
Joined: Sun Jun 02, 2013 5:47 pm

Subsetted Playlist Syncing Addon

Post by yourpalisal » Tue Jun 04, 2013 5:27 am

Hi guys.

I'm new here. I hope you guys can help me shed some light on the approach I can take for this...

I posted a wishlist to the wishlist forum at ... =4&t=71847 (request #3) for syncing playlists that aren't in the to-be-sync'ed selection for a device. My motivations are there if anybody is interested, but anyway I decided to take the opportunity to see if I could build a quick addon to achieve the goal.

The idea is that for each device that's syncing a particular set of "sync playlists", for that device to also get all other playlists, but with only the songs that are going to the device. I quickly learned that I can take advantage of AutoPlaylists for this and do the following:

Before sync...
Let PLSync be the set of playlists being sync'ed for that device
For each playlist PLNonSync that's not in the sync list...
create device-specific sub-autoplaylist PLAnd making the "match criteria" = ( (playlist in PLSync) AND (playlist is PLNonSync) )
add that new playlist to the sync-list
Let sync continue...

After sync...
Remove those playlists from the sync list
Delete all those playlists

I took a quick read through some of the API, and came to the following conclusions that look like they limit me from being able to do this...
1. OnDeviceSyncStarted gives me a device, but I can't manipulate or even read the to-be-sync'ed playlists from there. Same question with OnDeviceSyncCompleted
2. Creating a sub-playlist is possible. Making it an autoplaylist isn't (nor is adding/removing criteria)

My questions are the following:
A: Are my assumptions 1 and 2 correct? If so, that means direct DB manipulation is my only option.
B: Is direct DB manipulation dangerous or frowned-upon, given potential race conditions, etc?
C: I'll need to keep track of the playlists I created somehow so I can clean them up afterwards - any ideas? Maybe a criteria added like "DELETEME" = "DELETEME"?
D: Would OnDeviceSyncStarted be soon enough to add playlists anyway? Or has the list of playlists already been saved somewhere at that point?
E: Is this otherwise a bad idea in any way? ;)

Thanks in advance! :D


Re: Subsetted Playlist Syncing Addon

Post by 3May » Mon Jan 13, 2014 8:05 pm

This isn't even remotely clear. You set up a good scenario, but then your explanation of what should happen makes no sense. I want to help clear up the analysis.

Givens: a library with playlists A, B, C containing songs a1, a2, a3; b1, b2, b3; c1, c2, c3 in each respective playlist. A device with playlist D, containing songs b2, c1, c2. The device is set to sync those songs to the device using playlist D to group the sync selections.

In your scheme, there is this new option. On sync, if selected, what would the device contain after sync?

Post Reply