Author Topic: How can I get the FileTag/FilePropertity for the tracks from an cue file?  (Read 424 times)

tracemouse

  • Newbie
  • *
  • Posts: 6
Hi Steven,

Firstly, I love MB, and thanks for providing such an amazing software.

I am trying to write a plugin with remote control by Web UI, and I got some problems, can you help check?

The main problem is I cannot get the real FileTag/FilePropertity from the cue file because the library interface APIs are based on the fileUrl, but all tracks in an cue file have the same fileUrl.

for example,

 
D:\Music\APE\Liu Fang\CDImage.ape
D:\Music\APE\Liu Fang\CDImage.cue

With the following codes, I can get all the tracks in the cue file, but I cannot get each FileTag/FileProperty because the fileUrls are same. And I also cannot add one of them into now_playingList.

Code

         // MessageBox.Show(query);
            List<Track> trackList = new List<Track>();

            string comparison = "Contains";
            string[] fields = { "ArtistPeople", "Title", "Album" };
            string[] filenames = null;
            if (!mbApi.Library_QueryFilesEx(GenQuery(fields, comparison, query), ref filenames))
            {
                return "{ }";
            }

            int itemCount = filenames.Length;

            Track track = null;
            for (int i = 0; i < itemCount; i++)
            {
                track = new Track();
                
                //File property
                track.bitRate = mbApi.Library_GetFileProperty(filenames[i], Plugin.FilePropertyType.Bitrate);
                track.channels = mbApi.Library_GetFileProperty(filenames[i], Plugin.FilePropertyType.Channels);
                track.duration = mbApi.Library_GetFileProperty(filenames[i], Plugin.FilePropertyType.Duration);
                track.format = mbApi.Library_GetFileProperty(filenames[i], Plugin.FilePropertyType.Format);
                track.nowPlayingListIndex = mbApi.Library_GetFileProperty(filenames[i], Plugin.FilePropertyType.NowPlayingListIndex);
                track.playCount = mbApi.Library_GetFileProperty(filenames[i], Plugin.FilePropertyType.PlayCount);
                track.sampleRate = mbApi.Library_GetFileProperty(filenames[i], Plugin.FilePropertyType.SampleRate);
                track.size = mbApi.Library_GetFileProperty(filenames[i], Plugin.FilePropertyType.Size);
                track.fileUrl = mbApi.Library_GetFileProperty(filenames[i], Plugin.FilePropertyType.Url);
                track.folder = FileUtil.getFolder(track.fileUrl);
                //Meta data
                track.album = mbApi.Library_GetFileTag(filenames[i], Plugin.MetaDataType.Album);
                track.albumArtist = mbApi.Library_GetFileTag(filenames[i], Plugin.MetaDataType.AlbumArtist);
                track.artist = mbApi.Library_GetFileTag(filenames[i], Plugin.MetaDataType.Artist);
                track.encoder = mbApi.Library_GetFileTag(filenames[i], Plugin.MetaDataType.Encoder);
                track.hasLyrics = mbApi.Library_GetFileTag(filenames[i], Plugin.MetaDataType.HasLyrics);
                track.lyricist = mbApi.Library_GetFileTag(filenames[i], Plugin.MetaDataType.Lyricist);
                track.lyrics = mbApi.Library_GetFileTag(filenames[i], Plugin.MetaDataType.Lyrics);
                track.trackTitle = mbApi.Library_GetFileTag(filenames[i], Plugin.MetaDataType.TrackTitle);
                
                trackList.Add(track);

            }

            return JsonConvert.SerializeObject(trackList);
 


boroda

  • Hero Member
  • *****
  • Posts: 3520
you can't (at the moment). but you can get cue-text-file and parse it yourself. don't remember id of this tag though.

there is no way to add 1 track of cue-sheet to now playing list.

you could add +1 to this request on whishlist forum:

https://getmusicbee.com/forum/index.php?topic=27815.msg154675#msg154675
Last Edit: August 06, 2019, 05:27:29 AM by boroda