Exemple #1
0
        public PluginInfo Initialise(IntPtr apiInterfacePtr)
        {
            MBApiInterface = new MusicBeeApiInterface();
            MBApiInterface.Initialise(apiInterfacePtr);
            About.PluginInfoVersion = PluginInfoVersion;
            About.Name                     = "Music Hue";
            About.Description              = "Match your Philips Hue lights to the current song color.";
            About.Author                   = "Sean Sopata";
            About.TargetApplication        = "";
            About.Type                     = PluginType.General;
            About.VersionMajor             = 1;
            About.VersionMinor             = 1;
            About.Revision                 = 1;
            About.MinInterfaceVersion      = MinInterfaceVersion;
            About.MinApiRevision           = MinApiRevision;
            About.ReceiveNotifications     = (ReceiveNotificationFlags.PlayerEvents | ReceiveNotificationFlags.TagEvents);
            About.ConfigurationPanelHeight = 0;
            ToolStripMenuItem mainMenuItem = (ToolStripMenuItem)MBApiInterface.MB_AddMenuItem("mnuTools/Music Hue", null, null);

            mainMenuItem.DropDown.Items.Add("Settings", null, OnOpen);
            mainMenuItem.DropDown.Items.Add("Stop", null, StopPlugin);
            mainMenuItem.DropDown.Items.Add("Resume", null, ResumePlugin);
            Settings.Instance.StoragePath = MBApiInterface.Setting_GetPersistentStoragePath();
            Settings.Instance.Initialize();
            Settings.Instance.LoadSettings(MBApiInterface.Setting_GetPersistentStoragePath());
            SettingsFORM.StartUp();
            if (Settings.Instance.IsEnabled)
            {
                SHue.SHueConfig.TurnOnOffLights(Settings.Instance.HueLights, true);
            }
            return(About);
        }
        public PluginInfo Initialise(IntPtr apiInterfacePtr)
        {
            mbApiInterface = new MusicBeeApiInterface();
            mbApiInterface.Initialise(apiInterfacePtr);
            EventHandler IncrementPlayCount_Event = new EventHandler(IncrementPlayCount);

            mbApiInterface.MB_RegisterCommand("Tools: Increment PlayCount", IncrementPlayCount_Event);
            mbApiInterface.MB_AddMenuItem("mnuTools/Increment PlayCount", null, IncrementPlayCount_Event);
            //ToolStripMenuItem contextMenu = (ToolStripMenuItem)mbApiInterface.MB_AddMenuItem("context.Main/Increment PlayCount", null, IncrementPlayCount_Event);
            //contextMenu.DropDown.Items.Add("Increment PlayCount", null, IncrementPlayCount_Event);
            about.PluginInfoVersion = PluginInfoVersion;
            about.Name                     = "Increment PlayCount";
            about.Description              = "This plugin increments the PlayCount for the selected tracks.";
            about.Author                   = "maziara";
            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.General;
            about.VersionMajor             = 1;  // your plugin version
            about.VersionMinor             = 0;
            about.Revision                 = 0;
            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);
        }
Exemple #3
0
        public PluginInfo Initialise(IntPtr apiInterfacePtr)
        {
            _mbApiInterface = new MusicBeeApiInterface();
            _mbApiInterface.Initialise(apiInterfacePtr);

            _mbApiInterface.MB_AddMenuItem("mnuTools/Update AutoRating", "Tools: Update AutoRating", MenuItemUpdateAutoRating);

            _about.PluginInfoVersion = PluginInfoVersion;
            _about.Name              = "AutoRating";
            _about.Description       = "Automatically updates the rating of tracks based on your listening behaviour.";
            _about.Author            = "NekuSoul";
            _about.TargetApplication = string.Empty;
            _about.Type              = PluginType.General;

            _about.VersionMajor = 1;
            _about.VersionMinor = 0;
            _about.Revision     = 1;

            _about.MinInterfaceVersion = MinInterfaceVersion;
            _about.MinApiRevision      = MinApiRevision;

            _about.ReceiveNotifications     = (ReceiveNotificationFlags.PlayerEvents | ReceiveNotificationFlags.TagEvents);
            _about.ConfigurationPanelHeight = 0;

            return(_about);
        }
Exemple #4
0
        private void Init()
        {
            mbApiInterface.MB_AddMenuItem("mnuTools/Webserver", "MusicBee Webserver", OpenServerWindow);

            //Create server instances!
            httpServer = new Server();
            wsServer   = new WSServer();
        }
Exemple #5
0
        private void AddPartyMode()
        {
            const string description = "Control panel of the party mode functionality";
            const string key         = "mnuTools/MusicBee Remote: Party Mode";

            _api.MB_AddMenuItem(key, description, (sender, args) =>
            {
                _musicBeeRemotePlugin.DisplayPartyModeWindow();
            });
        }
Exemple #6
0
        // 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)
        {
            switch (type)
            {
            case NotificationType.PluginStartup:

                ToolStripMenuItem mainMenuItem = (ToolStripMenuItem)mbApiInterface.MB_AddMenuItem("context.main/EBU R128", null, null);
                mainMenuItem.DropDown.Items.Add("Tag", null, menu_Click);
                mainMenuItem.DropDown.Items.Add("Average Selected Files", null, menu2_Click);
                mainMenuItem.DropDown.Items.Add("Current Loudness of Selected Files", null, menu4_Click);
                mainMenuItem.DropDown.Items.Add("Settings", null, menu3_Click);


                break;
            }
        }
Exemple #7
0
        public PluginInfo Initialise(IntPtr apiInterfacePtr)
        {
            _mbApiInterface = new MusicBeeApiInterface();
            _mbApiInterface.Initialise(apiInterfacePtr);
            _about.PluginInfoVersion = PluginInfoVersion;
            _about.Name                     = "DiscordBee";
            _about.Description              = "Update your Discord Profile with the currently playing track";
            _about.Author                   = "Stefan Lengauer";
            _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.General;
            _about.VersionMajor             = 3;  // your plugin version
            _about.VersionMinor             = 0;
            _about.Revision                 = 3;
            _about.MinInterfaceVersion      = MinInterfaceVersion;
            _about.MinApiRevision           = MinApiRevision;
            _about.ReceiveNotifications     = ReceiveNotificationFlags.PlayerEvents;
            _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

            var workingDir       = _mbApiInterface.Setting_GetPersistentStoragePath() + _about.Name;
            var settingsFilePath = $"{workingDir}\\{_about.Name}.settings";

            _imgurAssetCachePath = $"{workingDir}\\{_about.Name}-Imgur.cache";
            _imgurAlbum          = $"{workingDir}\\{_about.Name}-Imgur.album";

            _settings = Settings.GetInstance(settingsFilePath);
            _settings.SettingChanged += SettingChangedCallback;
            _settingsWindow           = new SettingsWindow(this, _settings);

            _discordClient.ArtworkUploadEnabled = _settings.UploadArtwork;
            _discordClient.DiscordId            = _settings.DiscordAppId;
            UpdateAssetManager(_imgurAssetCachePath, new ImgurUploader(_imgurAlbum, _settings.ImgurClientId));
            ToolStripMenuItem mainMenuItem = (ToolStripMenuItem)_mbApiInterface.MB_AddMenuItem($"mnuTools/{_about.Name}", null, null);

            mainMenuItem.DropDown.Items.Add("Uploader Health", null, ShowUploaderHealth);

            // Match least number of chars possible but min 1
            _layoutHandler = new LayoutHandler(new Regex("\\[([^[]+?)\\]"));

            _updateTimer.Elapsed  += UpdateTimerElapsedCallback;
            _updateTimer.AutoReset = false;
            _updateTimer.Stop();

            Debug.WriteLine(_about.Name + " loaded");

            return(_about);
        }
Exemple #8
0
        public PluginInfo Initialise(IntPtr apiInterfacePtr)
        {
            mbApiInterface = new MusicBeeApiInterface();
            mbApiInterface.Initialise(apiInterfacePtr);
            about.PluginInfoVersion = PluginInfoVersion;
            about.Name                     = "Philips Hue";
            about.Description              = "Match your Philips Hue lights to the current song album art\n More Help: github.com/TroyFernandes/MusicBee-Philips-Hue";
            about.Author                   = "Troy Fernandes (github.com/TroyFernandes)";
            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.General;
            about.VersionMajor             = 1;  // your plugin version
            about.VersionMinor             = 1;
            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
            ToolStripMenuItem mainMenuItem = (ToolStripMenuItem)mbApiInterface.MB_AddMenuItem("mnuTools/Hue Artwork", null, null);

            mainMenuItem.DropDown.Items.Add("Settings", null, OnOpen);
            mainMenuItem.DropDown.Items.Add("Stop", null, stopPlugin);
            mainMenuItem.DropDown.Items.Add("Resume", null, resumePlugin);
            Settings.Instance.storagePath = mbApiInterface.Setting_GetPersistentStoragePath();
            Settings.Instance.Initialize();
            Settings.Instance.loadSettings(mbApiInterface.Setting_GetPersistentStoragePath());
            Configuration.Initialize(Settings.Instance.APIKey);
            settingsSelector.startup();
            lights = new LightCollection();
            try
            {
                foreach (string lightNames in Settings.Instance.HueLights)
                {
                    new LightStateBuilder().For(lights[lightNames]).TurnOn().Apply();
                }
            }
            catch (NullReferenceException e)
            {
                Console.WriteLine(e.ToString());
            }

            return(about);
        }
        public PluginInfo Initialise(IntPtr apiInterfacePtr)
        {
            mbApiInterface = new MusicBeeApiInterface();
            mbApiInterface.Initialise(apiInterfacePtr);
            about.PluginInfoVersion = PluginInfoVersion;
            about.Name                     = "MusicBee Chromecast";
            about.Description              = "Adds casting functionality to MusicBee";
            about.Author                   = "Troy Fernandes";
            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.General;
            about.VersionMajor             = 2;  // your plugin version
            about.VersionMinor             = 0;
            about.Revision                 = 1;
            about.MinInterfaceVersion      = MinInterfaceVersion;
            about.MinApiRevision           = MinApiRevision;
            about.ReceiveNotifications     = (ReceiveNotificationFlags.PlayerEvents | ReceiveNotificationFlags.TagEvents);
            about.ConfigurationPanelHeight = 25;   // 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

            mbApiInterface.MB_RegisterCommand("Chromecast", OnChromecastSelection);


            ToolStripMenuItem mainMenuItem = (ToolStripMenuItem)mbApiInterface.MB_AddMenuItem("mnuTools/MB Chromecast", null, null);

            mainMenuItem.DropDown.Items.Add("Check Status", null, ShowStatusInMessagebox);
            mainMenuItem.DropDown.Items.Add("Disconnect from Chromecast", null, (sender, e) => DisconnectFromChromecast(sender, e, false));
            ReadSettings();

            _ = EmptyDirectory();

            fileDeletionTimer          = new System.Timers.Timer();
            fileDeletionTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
            fileDeletionTimer.Interval = 10000;

            filenameStack = new IterableStack <string>();

            songHash = new SongHash();

            progressTimer          = new System.Timers.Timer();
            progressTimer.Elapsed += new ElapsedEventHandler(DoSomething);

            return(about);
        }
        /// <summary>
        /// Called by MusicBee whenever it is loading the plugin whether at startup or when enabling the plugin.
        /// The pointer parameter should be copied to a <c>MusicBeeApiInterface</c> structure.
        /// </summary>
        /// <param name="apiInterfacePtr">Pointer to a <c>MusicBeeApiInterface</c> object</param>
        /// <returns></returns>
        public PluginInfo Initialise(IntPtr apiInterfacePtr)
        {
            MbApiInterface = new MusicBeeApiInterface();
            MbApiInterface.Initialise(apiInterfacePtr);

            ReencodedFilesStorage = MbApiInterface.Setting_GetPersistentStoragePath() + "iTunesSync";
            if (!Directory.Exists(ReencodedFilesStorage))
            {
                Directory.CreateDirectory(ReencodedFilesStorage);
            }

            MbForm = (Form)Form.FromHandle(MbApiInterface.MB_GetWindowHandle());

            OpenMenu = MbApiInterface.MB_AddMenuItem(
                "mnuTools/" + Text.L("Open iTunes Sync"),
                Text.L("Opens iTunes to begin sync"),
                ToggleItunesOpenedAndClosed);

            return(Info);
        }
Exemple #11
0
        private void StartupMenuItem()
        {
            var menuItem = (ToolStripMenuItem)_mbApiInterface.MB_AddMenuItem("mnuView/Desktop Lyrics", "Toggle Desktop Lyrics visibility.",
                                                                             (sender, args) =>
                                                                             { });

            menuItem.CheckOnClick    = true;
            menuItem.Checked         = true;
            menuItem.CheckedChanged += (sender, args) =>
            {
                if (!menuItem.Checked)
                {
                    _frmLyrics?.Dispose();
                }
                else
                {
                    StartupForm();
                }
            };
        }
        public PluginInfo Initialise(IntPtr apiInterfacePtr)
        {
            mbApiInterface = new MusicBeeApiInterface();
            mbApiInterface.Initialise(apiInterfacePtr);
            about.PluginInfoVersion = PluginInfoVersion;
            about.Name                     = "MusicBee Chromecast";
            about.Description              = "Adds cast functionality to MusicBee";
            about.Author                   = "Troy Fernandes";
            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.General;
            about.VersionMajor             = 1;  // your plugin version
            about.VersionMinor             = 0;
            about.Revision                 = 1;
            about.MinInterfaceVersion      = MinInterfaceVersion;
            about.MinApiRevision           = MinApiRevision;
            about.ReceiveNotifications     = (ReceiveNotificationFlags.PlayerEvents | ReceiveNotificationFlags.TagEvents);
            about.ConfigurationPanelHeight = 25;   // 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

            mbApiInterface.MB_RegisterCommand("Chromecast", OnChromecastSelection);

            ToolStripMenuItem mainMenuItem = (ToolStripMenuItem)mbApiInterface.MB_AddMenuItem("mnuTools/MB Chromecast", null, null);

            //TODO
            mainMenuItem.DropDown.Items.Add("Check Status", null, StatusShowInMessagebox);
            mainMenuItem.DropDown.Items.Add("Disconnect from Chromecast", null, (sender, e) => DisconnectFromChromecast(sender, e, false));
            mainMenuItem.DropDown.Items.Add("Stop Server", null, StopWebserver);
            mainMenuItem.DropDown.Items.Add("Stop Plugin", null, UserClosingPlugin);

            //Save the crossfade settings
            crossfade = mbApiInterface.Player_GetCrossfade();

            ReadSettings();


            return(about);
        }
 private void CreateMenuItem()
 {
     _mbApiInterface.MB_AddMenuItem("mnuTools/Generate Custom Track Info", "HotKey to generate customized outputs for MusicBee Exporter", MenuClicked);
 }
Exemple #14
0
 // TODO: find a way to make text centered on windows forms
 // - Convert listenRate.py into C#
 // - Incorporate the scrobble.log file at C:\MusicBee\AppData
 // - Make it look nice
 private void createMenuItem()
 {
     mbApiInterface.MB_AddMenuItem("context.Main/Obsessed?", "HotKey For Start My Plugin", menuClicked);
 }
Exemple #15
0
        /// <summary>
        /// This function initialized the Plugin.
        /// </summary>
        /// <param name="apiInterfacePtr"></param>
        /// <returns></returns>
        public PluginInfo Initialise(IntPtr apiInterfacePtr)
        {
            selfInstance = this;
            JsConfig.ExcludeTypeInfo = true;
            Configuration.Register(Controller.Instance);

            mbApiInterface = new MusicBeeApiInterface();
            mbApiInterface.Initialise(apiInterfacePtr);

            UserSettings.Instance.SetStoragePath(mbApiInterface.Setting_GetPersistentStoragePath());
            UserSettings.Instance.LoadSettings();

            about.PluginInfoVersion = PluginInfoVersion;
            about.Name = "MusicBee Remote: Plugin";
            about.Description = "Remote Control for server to be used with android application.";
            about.Author = "Konstantinos Paparas (aka Kelsos)";
            about.TargetApplication = "MusicBee Remote";

            Version v = Assembly.GetExecutingAssembly().GetName().Version;
            UserSettings.Instance.CurrentVersion = v.ToString();

            // 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.General;
            about.VersionMajor = Convert.ToInt16(v.Major);
            about.VersionMinor = Convert.ToInt16(v.Minor);
            about.Revision = Convert.ToInt16(v.Revision);
            about.MinInterfaceVersion = MinInterfaceVersion;
            about.MinApiRevision = MinApiRevision;
            about.ReceiveNotifications = ReceiveNotificationFlags.PlayerEvents;

            if (mbApiInterface.ApiRevision < MinApiRevision)
            {
                return about;
            }

            ErrorHandler.SetLogFilePath(mbApiInterface.Setting_GetPersistentStoragePath());

            StartPlayerStatusMonitoring();

            mbApiInterface.MB_AddMenuItem("mnuTools/MusicBee Remote", "Information Panel of the MusicBee Remote",
                                          MenuItemClicked);

            EventBus.FireEvent(new MessageEvent(EventType.ActionSocketStart));
            EventBus.FireEvent(new MessageEvent(EventType.InitializeModel));
            EventBus.FireEvent(new MessageEvent(EventType.StartServiceBroadcast));
            EventBus.FireEvent(new MessageEvent(EventType.ShowFirstRunDialog));

            positionUpdateTimer = new Timer(20000);
            positionUpdateTimer.Elapsed += PositionUpdateTimerOnElapsed;
            positionUpdateTimer.Enabled = true;

            return about;
        }
 private void createMenu()
 {
     Logger.Instance.DebugLog("Adding menu");
     mbApiInterface.MB_AddMenuItem("mnuTools/Google Music Playlist Sync", "", onMenuItemClick);
 }
 private void createMenu()
 {
     mbApiInterface.MB_AddMenuItem("mnuTools/Music Bee Sync To Service", "", onMenuItemClick);
 }
 private void CreateMenuItem()
 {
     mbApiInterface.MB_AddMenuItem("mnuTools/" + @"Chapter List | MB", "Hotkey for CLMB", OnMenuClicked);
 }
 private void InitMenu()
 {
     mbApiInterface.MB_AddMenuItem("mnuTools/Addon Updater", "Addon Updater", OpenUpdater);
 }
Exemple #20
0
 private void createMenuItem()
 {
     mbApiInterface.MB_AddMenuItem("mnuTools/QuickPlay Overlay", "QuickPlay Overlay", openSearchWindow);
 }
Exemple #21
0
        /// <summary>
        /// Initializes the MusicBee Remote plugin.
        /// </summary>
        /// <param name="apiInterfacePtr">The API interface of MusicBee.</param>
        /// <returns>The plugin info.</returns>
        public PluginInfo Initialise(IntPtr apiInterfacePtr)
        {
            _api = default;
            _api.Initialise(apiInterfacePtr);

            _about.PluginInfoVersion = PluginInfoVersion;
            _about.Name              = "MusicBee Remote: Plugin";
            _about.Description       = "Remote Control for server to be used with android application.";
            _about.Author            = "Konstantinos Paparas (aka Kelsos)";
            _about.TargetApplication = "MusicBee Remote";

            var version        = Assembly.GetExecutingAssembly().GetName().Version;
            var currentVersion = version.ToString();

            // 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.General;
            _about.VersionMajor         = Convert.ToInt16(version.Major);
            _about.VersionMinor         = Convert.ToInt16(version.Minor);
            _about.Revision             = Convert.ToInt16(version.Build);
            _about.MinInterfaceVersion  = MinInterfaceVersion;
            _about.MinApiRevision       = MinApiRevision;
            _about.ReceiveNotifications = ReceiveNotificationFlags.PlayerEvents;

            if (_api.ApiRevision < MinApiRevision)
            {
                return(_about);
            }

            // Initialize the required adapters for the plugin to operate.
            var libraryApiAdapter    = new LibraryApiAdapter(_api);
            var nowPlayingApiAdapter = new NowPlayingApiAdapter(_api);
            var outputApiAdapter     = new OutputApiAdapter(_api);
            var playerApiAdapter     = new PlayerApiAdapter(_api);
            var queueAdapter         = new QueueAdapter(_api);
            var trackApiAdapter      = new TrackApiAdapter(_api);
            var invokeHandler        = new InvokeHandler(_api);
            var baseStoragePath      = _api.Setting_GetPersistentStoragePath();

            var dependencies = new MusicBeeDependencies(
                libraryApiAdapter,
                nowPlayingApiAdapter,
                outputApiAdapter,
                playerApiAdapter,
                queueAdapter,
                trackApiAdapter,
                invokeHandler,
                baseStoragePath,
                currentVersion);

            _bootstrap            = new RemoteBootstrap();
            _musicBeeRemotePlugin = _bootstrap.BootStrap(dependencies);

            const string menuItemDescription = "Information Panel of the MusicBee Remote";

            _api.MB_AddMenuItem("mnuTools/MusicBee Remote: Settings", menuItemDescription, MenuItemClicked);

#if DEBUG
            // Experimental feature only supported on debug
            AddPartyMode();
#endif

            _musicBeeRemotePlugin.Start();

            return(_about);
        }
Exemple #22
0
 private void AddToMenuOptions()
 {
     mbApiInterface.MB_AddMenuItem("mnuTools/Groove Playlist Sync", "", OnMenuOptionSelected);
 }
 private void createMenu()
 {
     mbApiInterface.MB_AddMenuItem("mnuTools/Test MB API Plugin", "", onMenuItemClick);
 }