示例#1
0
        private bool LyricFoundInMusicTag(string artist, string title)
        {
            var song = new Song();

            _mMDb.GetSongByMusicTagInfo(artist, string.Empty, title, true, ref song);

            var tag = TagReader.ReadTag(song.FileName);

            if (tag != null && tag.Lyrics != string.Empty)
            {
                LyricFound = new Object[] { tag.Lyrics, artist, title, "music tag" };
                return(true);
            }
            return(false);
        }
示例#2
0
        /// <summary>
        /// Grab the track data and process
        /// </summary>
        /// <param name="mv"></param>
        /// <param name="artist"></param>
        /// <param name="track"></param>
        /// <param name="mbid"></param>
        private void setMusicVideoTrack(ref DBTrackInfo mv, string artist, string track, string mbid)
        {
            if (track == null && mbid == null)
            {
                return;
            }
            logger.Debug("In Method: setMusicVideoTrack(ref DBTrackInfo mv, Artist: " + artist + ", Track: " + track + ", MBID: " + mbid + ")");

            MusicDatabase m_db = null;

            try
            {
                m_db = MusicDatabase.Instance;
            }
            catch (Exception e)
            {
                logger.Error("setMusicVideoTrack: Music database init failed " + e.ToString());
                return;
            }

            var trackInfo = new MediaPortal.Music.Database.Song();

            if (!m_db.GetSongByMusicTagInfo(artist, string.Empty, track, false, ref trackInfo))
            {
                return;
            }

            mv.Track = trackInfo.Title;
            //mv.MdID = value;
            // Tag
            char[]   delimiters = new char[] { ',' };
            string[] tags       = trackInfo.Genre.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
            foreach (string tag in tags)
            {
                mv.Tag.Add(tag.Trim());
            }
            // mv.ArtUrls.Add(trackInfo.Image);
            // mv.bioSummary = mvCentralUtils.StripHTML(cdataSection.Value);
            // mv.bioContent = mvCentralUtils.StripHTML(cdataSection.Value);
            return;
        }
示例#3
0
        private DBTrackInfo getMusicVideoTrack(string artist, string track)
        {
            if (track == null)
            {
                return(null);
            }

            logger.Debug("In Method: getMusicVideoTrack(Artist: " + artist + " Track: " + track + ")");

            MusicDatabase m_db = null;

            try
            {
                m_db = MusicDatabase.Instance;
            }
            catch (Exception e)
            {
                logger.Error("getMusicVideoTrack: Music database init failed " + e.ToString());
                return(null);
            }

            var trackInfo = new MediaPortal.Music.Database.Song();

            if (!m_db.GetSongByMusicTagInfo(artist, string.Empty, track, false, ref trackInfo))
            {
                return(null);
            }

            DBTrackInfo mv = new DBTrackInfo();

            mv.Track = trackInfo.Title;
            // mv.MdID = value;
            // Artist
            var _artist = string.Empty;

            if (!string.IsNullOrEmpty(trackInfo.AlbumArtist))
            {
                _artist = trackInfo.AlbumArtist;
            }
            else if (!string.IsNullOrEmpty(trackInfo.Artist))
            {
                _artist = trackInfo.Artist;
            }
            if (!string.IsNullOrEmpty(_artist))
            {
                DBArtistInfo d4 = new DBArtistInfo();
                setMusicVideoArtist(ref d4, _artist, null);
                mv.ArtistInfo.Add(d4);
            }
            // Album
            if (!string.IsNullOrEmpty(trackInfo.Album))
            {
                DBAlbumInfo d4 = new DBAlbumInfo();
                setMusicVideoAlbum(ref d4, _artist, trackInfo.Album, null);
                // Have we actually got a valid album?
                if (d4.Album.Trim() != string.Empty)
                {
                    mv.AlbumInfo.Add(d4);
                }
            }
            // Tag
            char[]   delimiters = new char[] { ',' };
            string[] tags       = trackInfo.Genre.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
            foreach (string tag in tags)
            {
                mv.Tag.Add(tag.Trim());
            }
            // mv.bioSummary = mvCentralUtils.StripHTML(cdataSection.Value);
            // mv.bioContent = mvCentralUtils.StripHTML(cdataSection.Value);

            if (mv.ArtistInfo.Count == 0)
            {
                return(null);
            }

            return(mv);
        }