Hi Steven,
Regarding double use sql dll, after much searching I found this solution:
In build file,reference MB dll:
<references>
<include name='C:\Program Files (x86)\MusicBee\System.Data.SQLite.dll'/>
</references>
In source, just SQlite away:
using System.Data.SQLite; //http://system.data.sqlite.org
pluginDBFileName = mbApi.Setting_GetPersistentStoragePath()+sep+about.Name+".db";
DB = new SQLiteConnection(@"Data Source="+pluginDBFileName);
DB.Open();
That simple!
But now, my main block is that I can't ghost-delete the current selected file (in library or player or wherever).
I think the current API doesn't cover the following things or does it?:
- a "delete" method (so that MB deletes the file and all derivative actions are taken (library, ..))
- Get current selected file (to know which file to delete if working via shortcut key) OR..
- a way to add a context menu item "Delete (keep ghost file)" (in a tab panel(=library, I guess?) or anywhere a track can be deleted)
- OR replacing all of the above points, would be to allow a certain delete notification on which my plugin would popup a question dialog "Keep as ghost file?"
OR just an extra option in MB's own delete confirmation which (if checked) triggers a plugin method / notification.
[/list]
Think you can implement any of those, Steven? I do allow a lot of options, don't I? ;D ;D
(I think the last one is the best for as well you as users, don't you think?)
Later on, I would need even more I am afraid, like:
- a way to search in my db (preferably via the MB search field)
What would be even cooler is that one can search into library and ghost files at same time (so checkbox option "also search ghost file")
- previous discussed way of visualising ghost files (into library itself OR in a seperate panel)
Anything much appreciated! :-*
Another woraround! Grea! Keeps me going! :D
And now I know what all those functions were for in the "TestCSharpDll.cs"! :D
Unfortunatly, I am stuck. I managed to get the computer menu show my ghost tracks, but it stops there. As if MB is never asking for folders nor files. I tried Message.Show boxes on all these get functions, but none EVER show up. Maybe the only way to make MB do it anymore, is via notification?
Here is my relevant code: public void ReceiveNotification(string sourceFileUrl, NotificationType type) // receive event notifications from MusicBee
{ //MessageBox.Show(about.Name+" notification:"+type);//debug
switch (type)
{ //perform startup initialisation
case NotificationType.PluginStartup:
mbAPI.MB_SendNotification(CallbackType.StorageReady); //Must be done here
//MessageBox.Show("storage ready");
break;
}
}
public string[] GetFolders(string path) // return the full path of folders in a folder
{ //MessageBox.Show("GetFolders:"+path);
return new string[]{"test","Test2"};
}
public Bitmap GetIcon() // return a 16x16 bitmap for the storage icon
{ //MessageBox.Show("GetIcon:"+Application.StartupPath+sep+"Plugins"+sep+about.Name+sep+about.Name+".png");
return new Bitmap(Application.StartupPath+sep+"Plugins"+sep+about.Name+sep+about.Name+".png");//
}
public byte[] GetFileArtwork(string url ) // return an array of bytes for the raw picture data
{
return null;
}
public bool FileExists(string url)
{
return true;
}
// each file is represented as a array of tags - each tag being a KeyValuePair(Of Byte, String), where Byte is a FilePropertyType or MetaDataType enum value and String is the value
// a tag for FilePropertyType.Url must be included
public KeyValuePair<byte, string>[] GetFile(string url)
{ //MessageBox.Show("GetFile:"+url);
return null;
}
// return an array of playlist identifiers
// where each playlist identifier is a KeyValuePair(id, name)
public KeyValuePair<string, string>[] GetPlaylists()
{ //MessageBox.Show("GetPlaylists");
return null;
}
// return an array of files in a playlist - a playlist being identified by the id parameter returned by GetPlaylists()
// each file is represented as a array of tags - each tag being a KeyValuePair(Of Byte, String), where Byte is a FilePropertyType or MetaDataType enum value and String is the value
// a tag for FilePropertyType.Url must be included
public KeyValuePair<byte, string>[][] GetPlaylistFiles(string id)
{ //MessageBox.Show("GetPlaylistFiles");
return null;
}
// return a stream that can read through the raw (undecoded) bytes of a music file
public System.IO.Stream GetStream(string url)
{
return null;
}
public bool FolderExists(string path)
{ //MessageBox.Show("FolderExists");
return true;
}
public Exception GetError() // return the last error that occurred
{ //MessageBox.Show("GetError");
return null;
}
// you can initially return false and then use MB_SendNotification when the storage is ready (or failed)
public bool IsReady() // is the server ready
{
return false;
}
// user initiated refresh (eg. pressing F5) - reconnect/ clear cache as appropriate
public void Refresh()
{ //MessageBox.Show("Refresh");
}
#endregion
NEVER MIND! Got it! IsReady never returns true!
For the record:..in Initialise...
storageReady=true;
....
case NotificationType.PluginStartup:
mbAPI.MB_SendNotification(storageReady?CallbackType.StorageReady:CallbackType.StorageFailed); //Must be done here //MessageBox.Show("storage ready");
....
public bool IsReady() // is the server ready
{ MessageBox.Show("IsReady");
return storageReady?true:false;
}
I don't know which notification can substitute that, so I used a variable