Пример #1
0
        public PlayListControl(IAimpPlaylist playList, IAimpPlayer player)
        {
            InitializeComponent();

            listView1.Columns.Add("trackId", "#");
            listView1.Columns.Add("trackName", "Name");
            listView1.Columns.Add("Duration", "Duration");
            listView1.MultiSelect = false;
            listView1.HeaderStyle = ColumnHeaderStyle.Nonclickable;
            listView1.View        = View.Details;

            listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);

            _playList = playList;
            _player   = player;

            LoadTracks();

            playList.Changed += (sender, type) =>
            {
                if (type.HasFlag(PlaylistNotifyType.AIMP_PLAYLIST_NOTIFY_STATISTICS))
                {
                    RefreshTracks();
                }
            };
        }
Пример #2
0
 /// <summary>
 /// Initializes the specified plugin.
 /// </summary>
 /// <param name="player">The player.</param>
 public void Initialize(IAimpPlayer player)
 {
     if (IsLoaded)
     {
         LoadedPlugin.OnInitialize(player, LoadedPlugin.PluginId);
     }
 }
Пример #3
0
        public OptionsFrame(IAimpPlayer player, YouTubeDL ytb, Options options)
        {
            _player  = player;
            _ytb     = ytb;
            _options = options;

            _player.Core.RegisterExtension(this);
        }
 public SettingsForm(IntPtr parentWindow, IAimpPlayer player, IAimpOptionsDialogFrame parentFrame)
     : this()
 {
     SetParent(new WindowInteropHelper(this).Handle, parentWindow);
     _parentFrame = parentFrame;
     _player      = player;
     Show();
     WindowState = WindowState.Maximized;
 }
Пример #5
0
 internal void OnInitialize(IAimpPlayer player, int unId)
 {
     #if DEBUG
     if (player == null)
         System.Diagnostics.Debugger.Break();
     #endif
     PluginId = unId;
     AimpPlayer = player;
     Initialize();
 }
Пример #6
0
 internal void OnDispose()
 {
     Dispose();
     #if DEBUG
     if (AimpPlayer == null)
         System.Diagnostics.Debugger.Break();
     #endif
     if (AimpPlayer != null)
     {
         AimpPlayer.Dispose();
         AimpPlayer = null;
     }
 }
Пример #7
0
 public static VisualStyle GetVisualStyle(IAimpPlayer player)
 {
     try
     {
         var mode = player.ServiceConfig.GetValueAsInt32("System\\NightMode");
         if (mode == 2 || (mode == 0 && Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", "1")?.ToString() == "0"))
         {
             return(VisualStyle.Dark);
         }
     }
     catch { }
     return(VisualStyle.Light);
 }
Пример #8
0
        public Form1(IAimpPlayer player)
        {
            _aimpPlayer = player;
            InitializeComponent();
            _aimpPlayer.TrackChanged += (sender, args) =>
                {
                    pictureBox1.Image = _aimpPlayer.CurrentFileInfo.AlbumArt;
                };

            Load += OnActivated;

            _aimpPlayer.PlayListManager.PlaylistActivated += (name, id) =>
            {

            };

            _aimpPlayer.PlayListManager.PlaylistAdded += (name, id) =>
            {
                var pl = _aimpPlayer.PlayListManager.GetLoadedPlaylistById(id);
                AddPlayListTab(id, name, pl);
            };

            _aimpPlayer.PlayListManager.PlaylistRemoved += (name, id) =>
            {
                foreach (var tabPage in tabPlayLists.TabPages)
                {
                    var tp = tabPage as TabPage;
                    if (tp != null && tp.Tag.Equals(id))
                    {
                        tabPlayLists.TabPages.Remove(tp);
                        break;
                    }
                }
            };

            _aimpPlayer.StateChanged += state =>
            {
                switch (state)
                {
                    case AimpPlayerState.Stopped:
                        toolStripStatusLabel1.Text = "State: stopped";
                        break;
                    case AimpPlayerState.Pause:
                        toolStripStatusLabel1.Text = "State: pause";
                        break;
                    case AimpPlayerState.Playing:
                        toolStripStatusLabel1.Text = "State: playing";
                        break;
                }
            };
        }
Пример #9
0
        public Playback(IAimpPlayer player, YouTubeDL ytb)
        {
            _ytb = ytb;

            _player = player;
            _player.PlaybackQueueManager.OnCheckURL += PlaybackQueueManager_OnCheckURL;

            _player.MenuManager.GetBuiltIn(ParentMenuType.AIMP_MENUID_PLAYER_PLAYLIST_ADDING, out var menuParent);
            _player.MenuManager.CreateMenuItem(out var menuItem);
            menuItem.Name       = "YouTube-DL";
            menuItem.Parent     = menuParent;
            menuItem.OnExecute += MenuItem_OnExecute;
            _player.MenuManager.Add(menuItem);
        }
Пример #10
0
        public TagEditorForm(IAimpPlaylistItem item, IAimpPlayer player)
        {
            InitializeComponent();

            var fileName = item.FileName;

            fileName = fileName.EndsWith(":0") ? fileName.Replace(":0", string.Empty) : fileName;
            var result = player.ServiceFileTagEditor.EditFile(fileName);

            if (result.ResultType == ActionResultType.OK)
            {
                var editor      = result.Result;
                var mixedResult = editor.GetMixedInfo();

                if (mixedResult.ResultType == ActionResultType.OK)
                {
                    lTitle.Text  = mixedResult.Result.Title;
                    lAlbum.Text  = mixedResult.Result.Album;
                    lArtist.Text = mixedResult.Result.Artist;
                    lGenre.Text  = mixedResult.Result.Genre;

                    if (mixedResult.Result.AlbumArt != null)
                    {
                        cover.Image = mixedResult.Result.AlbumArt;
                    }
                }

                var count = editor.GetTagCount();
                for (var i = 0; i < count; i++)
                {
                    var r = editor.GetTag(i);
                    if (r.ResultType == ActionResultType.OK)
                    {
                        var tab = new TabPage(r.Result.TagId.ToString())
                        {
                            Text = r.Result.TagId.ToString(),
                            Tag  = r.Result
                        };

                        var editorControl = new TagEditControl(r.Result);
                        tab.Controls.Add(editorControl);
                        tabControl1.TabPages.Add(tab);
                    }
                }
            }
        }
Пример #11
0
        /// <summary>
        /// Creates an instance of <see cref="TrackInfo"/> class.
        /// </summary>
        /// <param name="player">An instance of AIMP player to load data from.</param>
        public TrackInfo(IAimpPlayer player)
        {
            Contract.Requires(player != null);
            _player = player;

            var trackInfo = player.CurrentFileInfo;
            //StreamType = player.CurrentPlayingInfo.StreamType;

            IsStream = trackInfo.FileName.StartsWith("http") || trackInfo.FileName.StartsWith("https") || trackInfo.FileName.StartsWith("ftp") || trackInfo.FileName.Contains("://");

            if (trackInfo != null)
            {
                Artist = trackInfo.Artist;
                Album = trackInfo.Album;
                Title = trackInfo.Title;
                FileName = trackInfo.FileName;
            }
        }
Пример #12
0
        /// <summary>
        /// Creates an instance of <see cref="CoverFinderManager"/> class.
        /// </summary>
        /// <param name="aimpPlayer">AIMP player object.</param>
        public CoverFinderManager(IAimpPlayer aimpPlayer, ILogger logger)
        {
            Contract.Requires(aimpPlayer != null);

            var aggregateCatalog = new AggregateCatalog();
            var assemblyCatalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
            aggregateCatalog.Catalogs.Add(assemblyCatalog);

            var container = new CompositionContainer(aggregateCatalog);
            container.ComposeParts();

            // Load all available cover finders.
            CoverModules = container
                .GetExportedValues<ICoverFinder>()
                .ToList();

            _aimpPlayer = aimpPlayer;
            _logger = logger;
        }
Пример #13
0
 public CustomFileSystem(IAimpPlayer aimpPlayer)
 {
     _aimpPlayer = aimpPlayer;
 }
Пример #14
0
 /// <summary>
 /// Called when [initialize].
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="unId">The un identifier.</param>
 internal void OnInitialize(IAimpPlayer player, int unId)
 {
     PluginId   = unId;
     AimpPlayer = player;
     Initialize();
 }
Пример #15
0
 public AimpHook(IAimpPlayer player)
 {
     _player = player;
 }
Пример #16
0
        public Bitmap GetBitmap(IAimpPlayer player, FindRule concreteRule)
        {
            player.AlbumArtManager.Completed += (sender, args) =>
                {
                    Result = args.CoverImage;
                    _resetEvent.Set();
                };

            player.AlbumArtManager.GetImage(player.CurrentFileInfo, AimpFingCovertArtType.None, null);
            _resetEvent.WaitOne(new TimeSpan(0, 0, 0, 20));

            return Result;
        }
Пример #17
0
 public MyExtensionFileInfoProvider(IAimpPlayer player)
 {
     _player = player;
 }
 public OptionsFrame(IAimpPlayer player)
 {
     _player = player;
 }
Пример #19
0
        public PlayerForm(IAimpPlayer player, MessageHook coreMessage)
        {
            _playLists  = new List <IAimpPlaylist>();
            _aimpPlayer = player;
            InitializeComponent();

            _loggerForm = new LoggerForm();

            coreMessage.OnCoreMessage += (message, param1, param2) =>
            {
                if (message == AimpCoreMessageType.EventPlayableFileInfo)
                {
                    var cover = _aimpPlayer.CurrentFileInfo.AlbumArt;
                    if (cover != null)
                    {
                        pictureBox1.Image = cover;
                    }
                }
                else if (message == AimpCoreMessageType.EventPlayerState)
                {
                    Logger.Instance.AddInfoMessage($"[Event] AimpPlayer.StateChanged: {param1}");

                    switch ((AimpPlayerState)param1)
                    {
                    case AimpPlayerState.Stopped:
                        Text = "State: stopped";
                        break;

                    case AimpPlayerState.Pause:
                        Text = "State: pause";
                        break;

                    case AimpPlayerState.Playing:
                        Text = "State: playing";
                        break;
                    }
                }

                return(ActionResultType.OK);
            };

            Load += OnActivated;

            //_aimpPlayer.PlaylistManager.PlaylistActivated += (name, id) =>
            //{
            //    Logger.Instance.AddInfoMessage($"[Event] PlayListManager.PlaylistActivated: {name} {id}");

            //    foreach (var tabPage in tabPlayLists.TabPages)
            //    {
            //        var tp = tabPage as TabPage;
            //        if (tp != null && tp.Tag.Equals(id))
            //        {
            //            tabPlayLists.SelectTab(tp);
            //            break;
            //        }
            //    }
            //};

            //_aimpPlayer.PlaylistManager.PlaylistAdded += (name, id) =>
            //{
            //    Logger.Instance.AddInfoMessage($"[Event] PlayListManager.PlaylistAdded: {name} {id}");

            //    IAimpPlaylist pl;
            //    if (_aimpPlayer.PlaylistManager.GetLoadedPlaylistById(id, out pl) == ActionResultType.OK)
            //    {
            //        AddPlayListTab(id, name, pl);
            //    }
            //};

            //_aimpPlayer.PlaylistManager.PlaylistRemoved += (name, id) =>
            //{
            //    Logger.Instance.AddInfoMessage($"[Event] PlayListManager.PlaylistRemoved: {name} {id}");

            //    foreach (var tabPage in tabPlayLists.TabPages)
            //    {
            //        var tp = tabPage as TabPage;
            //        if (tp != null && tp.Tag.Equals(id))
            //        {
            //            tabPlayLists.TabPages.Remove(tp);
            //            break;
            //        }
            //    }
            //};

            _aimpPlayer.ServicePlaylistManager.PlaylistQueue.ContentChanged += (sender) =>
            {
                Logger.Instance.AddInfoMessage($"[Event] PlaylistQueue.ContentChanged");
            };

            _aimpPlayer.ServicePlaylistManager.PlaylistQueue.StateChanged += (sender) =>
            {
                Logger.Instance.AddInfoMessage($"[Event] PlaylistQueue.StateChanged");
            };
        }
Пример #20
0
 public Bitmap GetBitmap(IAimpPlayer player, FindRule concreteRule)
 {
     return GetBitmap(new TrackInfo(player), concreteRule);
 }
Пример #21
0
 public DemoMusicLibrary(IAimpPlayer aimpPlayer)
 {
     _aimpPlayer = aimpPlayer;
 }
Пример #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public OptionsFrame(IAimpPlayer player)
 {
     _player = player;
 }
Пример #23
0
 /// <summary>
 /// Initializes the specified plugin.
 /// </summary>
 /// <param name="player">The player.</param>
 public void Initialize(IAimpPlayer player)
 {
     if (IsLoaded)
     {
         LoadedPlugin.OnInitialize(player, LoadedPlugin.PluginId);
     }
 }
Пример #24
0
 public TestHook(IAimpPlayer player)
 {
     _player = player;
 }