Пример #1
0
 public async Task GetCoverArt()
 {
     if (this.CoverArtLink == Release.CoverArtLinkDefault) //don't need to do it twice
     {
         this.CoverArtLink = await MBServer.GetCoverArtDataFront(this.MBID);
     }
 }
Пример #2
0
        public async Task PopulateReleaseGroups()
        {
            //search the database for this artist specifically
            var doc = await MBServer.Lookup(MBEntityType.artist, this.MBID, new string[] { "release-groups" });

            //create a new artist object - the new function will grab the release list this time
            var artistNode = new XMLNodeG(XMLFns.GetChildren(doc.DocumentElement, "artist").First());
            var tmpArtist  = new Artist(artistNode);

            //copy the release groups from the temporary arist to this one
            this.ReleaseGroups = tmpArtist.ReleaseGroups;
        } //requires a server search
Пример #3
0
        public async Task PopulateReleases()
        {
            //search the database for this artist specifically
            var doc = await MBServer.Lookup(MBEntityType.releaseGroup, this.MBID, new string[] { "releases" });

            //create a new releaseGroupobject - the new function will grab the release list this time
            var releaseGroupNode = new XMLNodeG(XMLFns.GetChildren(doc.DocumentElement, "release-group").First());
            var tmpGroup         = new ReleaseGroup(releaseGroupNode);

            //copy the releases from the temporary group to this one
            this.Releases = tmpGroup.Releases;
        }
Пример #4
0
        public async Task TagMP3File(string filePath, int releaseIndex)
        {
            var tfile = TagLib.File.Create(filePath);

            // change title in the file
            tfile.Tag.Title = this.Name;
            tfile.Tag.MusicBrainzTrackId = this.MBID;

            //change artists
            if (Artists.Count > 0)
            {
                tfile.Tag.Performers = new String[1] {
                    this.ArtistsNameString
                };
                tfile.Tag.MusicBrainzReleaseArtistId = this.Artists[0].MBID;
            }

            //change release info
            if (releaseIndex < Releases.Count && releaseIndex >= 0)
            {
                var release = Releases[releaseIndex];

                tfile.Tag.Album = release.Name;
                tfile.Tag.MusicBrainzReleaseId      = release.MBID;
                tfile.Tag.MusicBrainzReleaseCountry = release.Country;

                //-------------- Safely parse track num and count---------------------

                uint tmpVal = 0;

                if (uint.TryParse(release.SongTrackNum, out tmpVal))
                {
                    tfile.Tag.Track = uint.Parse(release.SongTrackNum);
                }

                if (uint.TryParse(release.TrackCount, out tmpVal))
                {
                    tfile.Tag.TrackCount = uint.Parse(release.TrackCount);
                }

                //-------------------- get the album art -------------------
                await release.GetCoverArt(); //query the server for the link

                if (release.CoverArtLink != Release.CoverArtLinkNotFound)
                {
                    MusicTagging.addPictureNoSave(tfile, await MBServer.GetImage(release.CoverArtLink));
                }
            }

            tfile.Save();
        }
Пример #5
0
        public async Task TagMP3File(string filePath)
        {
            var    tfile = TagLib.File.Create(filePath);
            string title = tfile.Tag.Title;

            // change title only if one doesn't exist
            if (tfile.Tag.Title == "" || tfile.Tag.Title == null)
            {
                tfile.Tag.Title = this.Video.Title;
            }

            // add video thumbnail
            var thumbUrl = this.Video.Thumbnails.HighResUrl;

            if (thumbUrl != "" && thumbUrl != null)
            {
                MusicTagging.addPictureNoSave(tfile, await MBServer.GetImage(thumbUrl));
            }

            tfile.Save();
        }