-
Notifications
You must be signed in to change notification settings - Fork 0
/
Plugin.cs
90 lines (79 loc) · 3.65 KB
/
Plugin.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using System;
namespace MusicBeePlugin
{
public partial class Plugin
{
private const string Provider = "歌詞ナビ";
private static readonly string[] Providers = { Provider };
private MusicBeeApiInterface mbApiInterface;
private PluginInfo about = new PluginInfo();
public PluginInfo Initialise(IntPtr apiInterfacePtr)
{
mbApiInterface = new MusicBeeApiInterface();
mbApiInterface.Initialise(apiInterfacePtr);
about.PluginInfoVersion = PluginInfoVersion;
about.Name = $"{Provider}歌詞取得 (2023/12/17)";
about.Description = $"{Provider}から歌詞を取得します。";
about.Author = "htsign(noriokun4649 Edit)";
about.TargetApplication = ""; // current only applies to artwork, lyrics or instant messenger name that appears in the provider drop down selector or target Instant Messenger
about.Type = PluginType.LyricsRetrieval;
about.VersionMajor = 4; // your plugin version
about.VersionMinor = 0;
about.Revision = 1;
about.MinInterfaceVersion = MinInterfaceVersion;
about.MinApiRevision = MinApiRevision;
about.ReceiveNotifications = (ReceiveNotificationFlags.PlayerEvents | ReceiveNotificationFlags.TagEvents);
about.ConfigurationPanelHeight = 0; // height in pixels that musicbee should reserve in a panel for config settings. When set, a handle to an empty panel will be passed to the Configure function
return about;
}
public bool Configure(IntPtr panelHandle)
{
return false;
}
public void SaveSettings()
{
}
public void Close(PluginCloseReason reason)
{
}
public void Uninstall()
{
}
// receive event notifications from MusicBee
// you need to set about.ReceiveNotificationFlags = PlayerEvents to receive all notifications, and not just the startup event
public void ReceiveNotification(string sourceFileUrl, NotificationType type)
{
}
// return an array of lyric or artwork provider names this plugin supports
// the providers will be iterated through one by one and passed to the RetrieveLyrics/ RetrieveArtwork function in order set by the user in the MusicBee Tags(2) preferences screen until a match is found
public string[] GetProviders()
{
return Providers;
}
// return lyrics for the requested artist/title from the requested provider
// only required if PluginType = LyricsRetrieval
// return null if no lyrics are found
public string RetrieveLyrics(string sourceFileUrl, string artist, string trackTitle, string album, bool synchronisedPreferred, string provider)
{
switch (provider)
{
case Provider:
string albumArtist = null;
try
{
albumArtist = mbApiInterface.Library_GetFileTag(sourceFileUrl, MetaDataType.AlbumArtist);
}
catch { }
return PetitLyrics.FetchLyrics(trackTitle, artist, album);
}
return null;
}
// return Base64 string representation of the artwork binary data from the requested provider
// only required if PluginType = ArtworkRetrieval
// return null if no artwork is found
public string RetrieveArtwork(string sourceFileUrl, string albumArtist, string album, string provider)
{
return null;
}
}
}