Beispiel #1
0
        public IEnumerable <Track> GetTracks(string[] paths)
        {
            string[] files;
            if (paths == null)
            {
                _api.Library_QueryFilesEx(null, out files);
            }
            else
            {
                files = paths;
            }

            return(files.Select(currentTrack => new Track
            {
                Artist = GetArtistForTrack(currentTrack),
                Title = GetTitleForTrack(currentTrack),
                Album = GetAlbumForTrack(currentTrack),
                AlbumArtist = GetAlbumArtistForTrack(currentTrack),
                Year = GetAlbumYear(currentTrack),
                Genre = GetGenreForTrack(currentTrack),
                Disc = GetDiskNumber(currentTrack),
                Trackno = GetTrackNumber(currentTrack),
                Src = currentTrack
            }).ToList());
        }
Beispiel #2
0
        private List <MusicBeeSong> GetMusicBeeSongs()
        {
            string[]            files      = null;
            List <MusicBeeSong> allMbSongs = new List <MusicBeeSong>();

            if (MbApiInterface.Library_QueryFiles("domain=library"))
            {
                // Old (deprecated)
                //public char[] filesSeparators = { '\0' };
                //files = _mbApiInterface.Library_QueryGetAllFiles().Split(filesSeparators, StringSplitOptions.RemoveEmptyEntries);
                MbApiInterface.Library_QueryFilesEx("domain=library", ref files);
            }
            else
            {
                files = new string[0];
            }

            foreach (string path in files)
            {
                MusicBeeSong thisSong = new MusicBeeSong();
                thisSong.Filename = path;
                thisSong.Artist   = MbApiInterface.Library_GetFileTag(path, Plugin.MetaDataType.Artist);
                thisSong.Title    = MbApiInterface.Library_GetFileTag(path, Plugin.MetaDataType.TrackTitle);
                thisSong.Album    = MbApiInterface.Library_GetFileTag(path, Plugin.MetaDataType.Album);
                allMbSongs.Add(thisSong);
            }
            return(allMbSongs);
        }