Пример #1
0
        /// <summary>
        /// Returns a list of DBTrackInfo objects that match the artist
        /// </summary>
        /// <param name="mbid"></param>
        /// <returns></returns>
        public static List <DBTrackInfo> GetEntriesByArtist(DBArtistInfo mv)
        {
            if (mv == null)
            {
                return(null);
            }

            lock (lockList)
            {
                List <DBTrackInfo> results = new List <DBTrackInfo>();
                List <DBTrackInfo> db1     = DBTrackInfo.GetAll();

                foreach (DBTrackInfo db2 in db1)
                {
                    if (db2.ArtistInfo.Count > 0)
                    {
                        if (mv == db2.ArtistInfo[0])
                        {
                            results.Add(db2);
                        }
                    }
                }
                return(results);
            }
        }
Пример #2
0
        public static DBArtistInfo GetOrCreate(DBTrackInfo mv)
        {
            DBArtistInfo rtn = mv.ArtistInfo[0];

            if (rtn != null)
            {
                return(rtn);
            }

            rtn = new DBArtistInfo();
            mv.ArtistInfo.Add(rtn);
            return(rtn);
        }
Пример #3
0
        public override void Delete()
        {
            if (this.ID == null)
            {
                base.Delete();
                return;
            }

            DBAlbumInfo a1 = null;

            if (this.AlbumInfo.Count > 0)
            {
                a1 = this.AlbumInfo[0];
            }
            DBArtistInfo a3 = null;

            if (this.ArtistInfo.Count > 0)
            {
                a3 = this.ArtistInfo[0];
            }

            base.Delete();

            if (a1 != null)
            {
                List <DBTrackInfo> a7 = GetEntriesByAlbum(a1);
                if (a7 == null || a7.Count == 0)
                {
                    logger.Info("Removing Album '{0}' .", a1.Album);
                    a1.Delete();
                }
            }

            if (a3 != null)
            {
                List <DBTrackInfo> a7 = GetEntriesByArtist(a3);
                if (a7 == null || a7.Count == 0)
                {
                    logger.Info("Removing Artist '{0}' .", a3.Artist);
                    a3.Delete();
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Based on the calculated signature retrive data from providers
        /// </summary>
        /// <param name="mvSignature"></param>
        /// <returns></returns>
        public List<DBTrackInfo> GetTrackDetail(MusicVideoSignature mvSignature)
        {
            List<DBSourceInfo> trackSources;
              lock (trackDetailSources) trackSources = new List<DBSourceInfo>(trackDetailSources);

              List<DBSourceInfo> artistSources;
              lock (artistDetailSources) artistSources = new List<DBSourceInfo>(artistDetailSources);

              // Try each datasource (ordered by their priority) to get results
              List<DBTrackInfo> results = new List<DBTrackInfo>();
              foreach (DBSourceInfo currSource in trackSources)
              {
            if (currSource.IsDisabled(DataType.TRACKDETAIL))
              continue;

            // if we have reached the minimum number of possible matches required, we are done
            if (results.Count >= mvCentralCore.Settings.MinimumMatches && mvCentralCore.Settings.MinimumMatches != 0)
            {
              logger.Debug("We have reached the minimum number of possible matches required, we are done.");
              break;
            }

            // search with the current provider
            List<DBTrackInfo> newResults = currSource.Provider.GetTrackDetail(mvSignature);

            // tag the results with the current source
            foreach (DBTrackInfo currMusicVideo in newResults)
            {
              currMusicVideo.PrimarySource = currSource;

              // ****************** Additional Artist Info Processing ******************
              // Check and update Artist details from additional providers
              DBArtistInfo artInfo = new DBArtistInfo();
              artInfo = currMusicVideo.ArtistInfo[0];

              foreach (DBSourceInfo artistExtraInfo in artistDetailSources)
              {
            if (artistExtraInfo != currSource)
            {
              logger.Debug("Searching for additional Artist infomation from Provider: " + artistExtraInfo.Provider.Name);
              artInfo = artistExtraInfo.Provider.GetArtistDetail(currMusicVideo).ArtistInfo[0];
            }
              }
              artInfo.DisallowBackgroundUpdate = true;
              currMusicVideo.ArtistInfo[0] = artInfo;

              // If album support disabled or no associated album then skip album processing
              if (mvCentralCore.Settings.DisableAlbumSupport || currMusicVideo.AlbumInfo.Count == 0)
            continue;

              // ****************** Additional Album Info Processing ******************
              // Check and update Album details from additional providers
              DBAlbumInfo albumInfo = new DBAlbumInfo();
              albumInfo = currMusicVideo.AlbumInfo[0];

              foreach (DBSourceInfo albumExtraInfo in albumDetailSources)
              {
            if (albumExtraInfo != currSource)
            {
              logger.Debug("Searching for additional Album infomation from Provider: " + albumExtraInfo.Provider.Name);
              albumInfo = albumExtraInfo.Provider.GetAlbumDetail(currMusicVideo).AlbumInfo[0];
            }
              }
              albumInfo.DisallowBackgroundUpdate = true;
              currMusicVideo.AlbumInfo[0] = albumInfo;
            }

            // add results to our total result list and log what we found
            results.AddRange(newResults);
              }
              return results;
        }
Пример #5
0
        public List<DBTrackInfo> GetTrackDetail(MusicVideoSignature mvSignature)
        {
            // Switch off album support
              if (mvCentralCore.Settings.DisableAlbumSupport)
            mvSignature.Album = null;

              List<DBTrackInfo> results = new List<DBTrackInfo>();
              if (mvSignature == null)
            return results;

              logger.Debug("In Method: GetTrackDetail(MusicVideoSignature mvSignature)");
              logger.Debug("*** Artist: " + mvSignature.Artist + " - " + mvSignature.ArtistMdId);
              logger.Debug("*** Album: " + mvSignature.Album + " - " + mvSignature.AlbumMdId);
              logger.Debug("*** Other: " + mvSignature.Title + " - " + mvSignature.MdId);
              lock (lockObj)
              {
            DBTrackInfo mvTrackData = null;
            // Artist/Album handling, if the track and artist dont match and the track contains the artist name this would indicate the that track is in the format /<artist>/<album>/<atrist - track>.<ext>
            // This will throw out the parseing so remove the artist name from the track.
            // This is not the best fix, need to add code so I know whch expression produced the result or better still have a ignore folder structure when pasring option.
            if (mvSignature.Track != null && mvSignature.Artist != null)
            {
              if ((mvSignature.Track.ToLower().Trim() != mvSignature.Artist.ToLower().Trim()) && mvSignature.Track.ToLower().Contains(mvSignature.Artist.ToLower().Trim()))
            mvTrackData = getMusicVideoTrack(mvSignature.Artist, Regex.Replace(mvSignature.Track, mvSignature.Artist, string.Empty, RegexOptions.IgnoreCase));
              else
            mvTrackData = getMusicVideoTrack(mvSignature.Artist, mvSignature.Track);
            }
            else
              mvTrackData = getMusicVideoTrack(mvSignature.Artist, mvSignature.Track);

            if (mvTrackData != null)
            {
              if (mvTrackData.ArtistInfo.Count == 0)
              {
            DBArtistInfo artistInfo = new DBArtistInfo();
            artistInfo.Artist = mvSignature.Artist;
            mvTrackData.ArtistInfo.Add(artistInfo);
              }

              if (mvSignature.Album != null && mvSignature.Artist != null)
              {
            if (!mvCentralCore.Settings.UseMDAlbum)
            {
              DBAlbumInfo albumInfo = new DBAlbumInfo();
              albumInfo.Album = mvSignature.Album;
              setMusicVideoAlbum(ref albumInfo, mvSignature.Artist, mvSignature.Album, null);
              mvTrackData.AlbumInfo.Clear();
              mvTrackData.AlbumInfo.Add(albumInfo);
            }
              }
              else if (mvTrackData.AlbumInfo.Count > 0 && mvCentralCore.Settings.SetAlbumFromTrackData)
              {
            logger.Debug("There are {0} Albums found for Artist: {1} / {2}", mvTrackData.AlbumInfo.Count.ToString(), mvSignature.Artist, mvSignature.Title);
            DBAlbumInfo albumInfo = new DBAlbumInfo();
            albumInfo.Album = mvTrackData.AlbumInfo[0].Album;
            setMusicVideoAlbum(ref albumInfo, mvSignature.Artist, mvTrackData.AlbumInfo[0].Album, null);
            mvTrackData.AlbumInfo.Clear();
            mvTrackData.ArtistInfo[0].Artist = mvSignature.Artist;
            mvTrackData.AlbumInfo.Add(albumInfo);
              }
              else
            mvTrackData.AlbumInfo.Clear();

              results.Add(mvTrackData);
            }
              }
              return results;
        }
Пример #6
0
 public bool GetArtistArt(DBArtistInfo mv)
 {
     return false;
 }
        // Loops through all local files in the system and removes anything that's invalid.
        public static void RemoveInvalidFiles()
        {
            logger.Info("Checking for invalid file entries in the database.");

            float count = 0;
            List <DBLocalMedia> files = DBLocalMedia.GetAll();
            float total = files.Count;

            int cleaned = 0;

            foreach (DBLocalMedia currFile in files)
            {
                if (MaintenanceProgress != null)
                {
                    MaintenanceProgress("", (int)(count * 100 / total));
                }
                count++;

                // Skip previously deleted files
                if (currFile.ID == null)
                {
                    continue;
                }

                // Remove Orphan Files
                if (currFile.AttachedmvCentral.Count == 0 && !currFile.Ignored)
                {
                    logger.Info("Removing: {0} (orphan)", currFile.FullPath);
                    currFile.Delete();
                    cleaned++;
                    continue;
                }

                // remove files without an import path
                if (currFile.ImportPath == null || currFile.ImportPath.ID == null)
                {
                    logger.Info("Removing: {0} (no import path)", currFile.FullPath);
                    currFile.Delete();
                    cleaned++;
                    continue;
                }

                // Remove entries from the database that have their file removed
                if (currFile.IsRemoved)
                {
                    logger.Info("Removing: {0} (file is removed)", currFile.FullPath);
                    currFile.Delete();
                    cleaned++;
                }
            }

            logger.Info("Removed {0} file entries.", cleaned.ToString());
            if (MaintenanceProgress != null)
            {
                MaintenanceProgress("", 100);
            }

            // Remove Orphan albums
            cleaned = 0;
            List <DBAlbumInfo> albumObjectList = DBAlbumInfo.GetAll();

            foreach (DBAlbumInfo albumObject in albumObjectList)
            {
                if (albumObject.Album.Trim() == string.Empty)
                {
                    albumObject.Album = "Unknow Album";
                    albumObject.Commit();
                }
                List <DBTrackInfo> mvs = DBTrackInfo.GetEntriesByAlbum(albumObject);
                if (mvs.Count == 0)
                {
                    logger.Info("Removing: {0} (albuminfo orphan)", albumObject.Album);
                    albumObject.Delete();
                    cleaned++;
                }
            }
            logger.Info("Removed {0} Album orphan entries.", cleaned.ToString());
            if (MaintenanceProgress != null)
            {
                MaintenanceProgress("", 100);
            }

            // Remove Orphan artist
            cleaned = 0;
            List <DBArtistInfo> allArtistList = DBArtistInfo.GetAll();

            foreach (DBArtistInfo artist in allArtistList)
            {
                List <DBTrackInfo> mvs = DBTrackInfo.GetEntriesByArtist(artist);
                if (mvs.Count == 0)
                {
                    logger.Info("Removing: {0} (artistinfo orphan)", artist.Artist);
                    artist.Delete();
                    cleaned++;
                }
            }
            logger.Info("Removed {0} Artist orphan entries.", cleaned.ToString());
            if (MaintenanceProgress != null)
            {
                MaintenanceProgress("", 100);
            }
        }
Пример #8
0
 /// <summary>
 /// Set the Artist information, override existing information
 /// </summary>
 /// <param name="mv"></param>
 /// <param name="artistInfo"></param>
 private void SetMusicVideoArtist(ref DBArtistInfo mv, ArtistInfo artistInfo, string strArtistHTML)
 {
     // Now fill in the data
       mv.Formed = mvCentralUtils.StripHTML(artistInfo.Formed);
       mv.Disbanded = mvCentralUtils.StripHTML(artistInfo.Disbanded);
       mv.Born = mvCentralUtils.StripHTML(artistInfo.Born);
       mv.Death = mvCentralUtils.StripHTML(artistInfo.Death);
       mv.bioSummary = getBioSummary(artistInfo.AMGBio, 50);
       mv.bioContent = artistInfo.AMGBio;
       mv.Genre = artistInfo.Genres;
       mv.Tones = artistInfo.Tones;
       mv.Styles = artistInfo.Styles;
       mv.YearsActive = artistInfo.YearsActive;
 }
Пример #9
0
 /// <summary>
 /// Return artwork for the first track to have it, used in event of Artist having no art.
 /// </summary>
 /// <param name="artist"></param>
 /// <returns></returns>
 string artistTrackArt(DBArtistInfo artist)
 {
     List<DBTrackInfo> artistTracks = DBTrackInfo.GetEntriesByArtist(artist);
       foreach (DBTrackInfo artistTrack in artistTracks)
       {
     if (!string.IsNullOrEmpty(artistTrack.ArtFullPath.Trim()))
       return artistTrack.ArtFullPath;
       }
       return "defaultArtistBig.png";
 }
Пример #10
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;
        }
Пример #11
0
        /// <summary>
        /// DVD item selected - set a load of properities
        /// </summary>
        /// <param name="item"></param>
        /// <param name="parent"></param>
        void onDVDSelected(GUIListItem item, GUIControl parent)
        {
            DBTrackInfo trackInfo = null;

              // This is an Video
              trackInfo = (DBTrackInfo)item.MusicTag;
              GUIPropertyManager.SetProperty("#mvCentral.VideoImg", item.ThumbnailImage);
              // Track information
              if (string.IsNullOrEmpty(item.TVTag.ToString().Trim()))
            GUIPropertyManager.SetProperty("#mvCentral.TrackInfo", Localization.NoTrackInfo);
              else
            GUIPropertyManager.SetProperty("#mvCentral.TrackInfo", item.TVTag.ToString());
              // Track Rating
              GUIPropertyManager.SetProperty("#mvCentral.Track.Rating", trackInfo.Rating.ToString());

              // #iswatched
              DBUserMusicVideoSettings userSettings = trackInfo.ActiveUserSettings;
              if (userSettings.WatchedCount > 0)
              {
            GUIPropertyManager.SetProperty("#iswatched", "yes");
            GUIPropertyManager.SetProperty("#mvCentral.Watched.Count", userSettings.WatchedCount.ToString());
              }
              else
              {
            GUIPropertyManager.SetProperty("#iswatched", "no");
            GUIPropertyManager.SetProperty("#mvCentral.Watched.Count", "0");
              }

              // Get the artist
              DBArtistInfo artistInfo = trackInfo.ArtistInfo[0];
              _currArtist = artistInfo;
              CurrentArtistId = item.ItemId;
              // And set some artist properites
              GUIPropertyManager.SetProperty("#mvCentral.ArtistName", artistInfo.Artist);
              GUIPropertyManager.SetProperty("#mvCentral.Genre", artistInfo.Genre);

              // Set BornOrFormed property
              if (_currArtist.Formed.Trim().Length == 0 && _currArtist.Born.Trim().Length == 0)
            GUIPropertyManager.SetProperty("#mvCentral.BornOrFormed", "No Born/Formed Details");
              else if (_currArtist.Formed.Trim().Length == 0)
            GUIPropertyManager.SetProperty("#mvCentral.BornOrFormed", String.Format("{0}: {1}", Localization.Born, _currArtist.Born));
              else
            GUIPropertyManager.SetProperty("#mvCentral.BornOrFormed", String.Format("{0}: {1}", Localization.Formed, _currArtist.Formed));

              // Misc Proprities
              GUIPropertyManager.SetProperty("#mvCentral.Duration", trackDuration(trackInfo.PlayTime));
              GUIPropertyManager.SetProperty("#mvCentral.Track.Rating", "0");
              GUIPropertyManager.SetProperty("#mvCentral.AlbumTracksRuntime", trackDuration(trackInfo.PlayTime));
              // Set the view
              GUIPropertyManager.SetProperty("#mvCentral.DVDView", "true");
              GUIPropertyManager.SetProperty("#mvCentral.TrackView", "false");
              GUIPropertyManager.SetProperty("#mvCentral.ArtistView", "false");
              GUIPropertyManager.SetProperty("#mvCentral.AlbumView", "false");
              clearVideoAudioProps();

              if (item.Label != "..")
              {
            //logger.Debug("Setting lastItemVid (1) to {0}", facadeLayout.SelectedListItemIndex);
            lastItemVid = facadeLayout.SelectedListItemIndex;
              }

              GUIPropertyManager.SetProperty("#mvCentral.Hierachy", artistInfo.Artist);

              GUIPropertyManager.Changed = true;
        }
Пример #12
0
 /// <summary>
 /// Set the Artist information
 /// </summary>
 /// <param name="mv"></param>
 /// <param name="artistInfo"></param>
 private void setMusicVideoArtist(ref DBArtistInfo mv, MusicArtistInfo artistInfo)
 {
 }
Пример #13
0
    /// <summary>
    /// Get Artist Artwork
    /// </summary>
    /// <param name="mvArtistObject"></param>
    /// <returns></returns>
    public bool GetArtistArt(DBArtistInfo mvArtistObject)
    {
      if (string.IsNullOrEmpty(mvArtistObject.MdID.Trim()))
        return false;
      logger.Debug("In Method: GetArtistArt(DBArtistInfo mvArtistObject)");

      // Get the images
      // If we have a MBID for this Artist use this to retrive the image otherwise fall back to keyword search
      var html = getJSON(SearchArtistImage, APIKey, mvArtistObject.MdID.Trim());

      // If we reveived nothing back, bail out
      if (string.IsNullOrEmpty(html))
        return false;

      int artistartAdded = 0;
      var URLList = new List<string>();
      URLList = ExtractURL("artistthumb", html);
      if (URLList != null)
      {
        foreach (string _url in URLList)
        {
          var _fileURL = _url.Substring(checked(_url.IndexOf("|") + 1));
          if (mvArtistObject.AddArtFromURL(_fileURL) == ImageLoadResults.SUCCESS)
            artistartAdded++;
        }
      }

      return (artistartAdded > 0);
    }
Пример #14
0
    /// <summary>
    /// Get the track details
    /// </summary>
    /// <param name="mvSignature"></param>
    /// <returns></returns>
    public List<DBTrackInfo> GetTrackDetail(MusicVideoSignature mvSignature)
    {
      logger.Debug("In Method: GetTrackDetail(MusicVideoSignature mvSignature)");
      List<DBTrackInfo> results = new List<DBTrackInfo>();
      if (mvSignature == null)
        return results;  

      lock (lockList)
      {
        DBTrackInfo mv = getMusicVideoTrack(mvSignature.Artist, mvSignature.Album, mvSignature.Track);
        if (mv != null)
        {
          if (mv.ArtistInfo.Count == 0)
          {
            DBArtistInfo d4 = new DBArtistInfo();
            d4.Artist = mvSignature.Artist;
            mv.ArtistInfo.Add(d4);
          }
          results.Add(mv);
        }
      }
      return results;
    }
Пример #15
0
        private void setMusicVideoArtist(ref DBArtistInfo mv, string artistName, string artistmbid)
        {
            if (string.IsNullOrEmpty(artistName))
            return;
              logger.Debug("In Method: setMusicVideoArtist(ref DBArtistInfo mv, Artist: " + artistName + " MBID: " + artistmbid + ")");

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

              var artistInfo = new MediaPortal.Music.Database.ArtistInfo();
              if (!m_db.GetArtistInfo(artistName, ref artistInfo))
            return;

              // Name
              mv.Artist = artistName;
              // MBID
              // mv.MdID =
              // Tags
              char[] delimiters = new char[] { ',' };
              string[] tags = artistInfo.Genres.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
              foreach (string tag in tags)
              {
            mv.Tag.Add(tag.Trim());
              }
              tags = artistInfo.Styles.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
              foreach (string tag in tags)
              {
            mv.Tag.Add(tag.Trim());
              }
              // Bio
              mv.bioSummary = artistInfo.AMGBio;
              mv.bioContent = artistInfo.AMGBio;
              // Additional
              mv.Born = artistInfo.Born;
              mv.Genre = artistInfo.Genres;
              mv.Styles = artistInfo.Styles;
              mv.YearsActive = artistInfo.YearsActive;
              // Image URL
              if (!string.IsNullOrEmpty(artistInfo.Image) && !mv.ArtUrls.Contains(artistInfo.Image))
            mv.ArtUrls.Add(artistInfo.Image);
        }
Пример #16
0
        private void manualAssignButton_Click(object sender, EventArgs e)
        {
            unapprovedGrid.EndEdit();

              foreach (DataGridViewRow currRow in unapprovedGrid.SelectedRows)
              {
            MusicVideoMatch selectedMatch = (MusicVideoMatch)currRow.DataBoundItem;

            DBLocalMedia mediaToPlay = selectedMatch.LocalMedia[0];

            if (mediaToPlay.State != MediaState.Online) mediaToPlay.Mount();
            while (mediaToPlay.State != MediaState.Online) { Thread.Sleep(1000); };

            ManualAssignPopup popup = new ManualAssignPopup(selectedMatch);

            popup.ShowDialog(this);

            if (popup.DialogResult == DialogResult.OK)
            {

              // create a musicvideo with the user supplied information
              DBTrackInfo mv = new DBTrackInfo();
              mv.Track = popup.Track;
              if (popup.Album.Trim().Length > 0)
              {
            DBAlbumInfo db1 = DBAlbumInfo.Get(popup.Album);
            if (db1 == null) db1 = new DBAlbumInfo();
            db1.Album = popup.Album;
            mv.AlbumInfo.Add(db1);
              }
              DBArtistInfo db2 = DBArtistInfo.Get(popup.Artist);
              if (db2 == null)
              {
            db2 = new DBArtistInfo();
            db2.Artist = popup.Artist;
              }
              mv.ArtistInfo.Add(db2);

              foreach (DBSourceInfo r1 in mvCentralCore.DataProviderManager.AllSources)
              {
            if (r1.Provider is ManualProvider)
            {
              mv.PrimarySource = r1;
              mv.ArtistInfo[0].PrimarySource = r1;
              if (mv.AlbumInfo != null && mv.AlbumInfo.Count > 0) mv.AlbumInfo[0].PrimarySource = r1;
            }
              }

              // We have DVD and set to split DVD into chapters
              // This is a great idea that falls flat for two reasons..
              //  1. There is not decent source of DVD/Track info
              //  2. Even if the tracks were split out and named I have yet to find a method of playing a single track from a DVD
              // For now will skip this
              bool dothisCodeBlock = false;
              // Split the DVD into chapters
              if (selectedMatch.LocalMedia[0].IsDVD && cbSplitDVD.Checked && dothisCodeBlock)
              {

            string videoPath = mediaToPlay.GetVideoPath();
            if (videoPath == null) videoPath = selectedMatch.LongLocalMediaString;
            string pathlower = Path.GetDirectoryName(videoPath).ToLower();
            pathlower = pathlower.Replace("\\video_ts", "");
            pathlower = pathlower.Replace("\\adv_obj", "");
            pathlower = pathlower.Replace("\\bdmv", "");
            if (pathlower.Length < 3) pathlower = pathlower + "\\";
            ChapterExtractor ex =
            Directory.Exists(Path.Combine(pathlower, "VIDEO_TS")) ?
            new DvdExtractor() as ChapterExtractor :
            Directory.Exists(Path.Combine(pathlower, "ADV_OBJ")) ?
            new HddvdExtractor() as ChapterExtractor :
            Directory.Exists(Path.Combine(Path.Combine(pathlower, "BDMV"), "PLAYLIST")) ?
            new BlurayExtractor() as ChapterExtractor :
            null;

            if (ex != null)
            {
              List<ChapterInfo> rp = ex.GetStreams(pathlower, 1);

              if (mediaToPlay.IsMounted)
              {
                mediaToPlay.UnMount();
                while (mediaToPlay.IsMounted) { Thread.Sleep(1000); };
              }
              foreach (ChapterInfo ci in rp)
              {
                foreach (ChapterEntry c1 in ci.Chapters)
                {
                  //skip menus/small crap
                  //                                    if (c1.Time.TotalSeconds < 20) continue;
                  DBTrackInfo db1 = new DBTrackInfo();
                  db1.Copy(mv);
                  db1.TitleID = ci.TitleID;
                  db1.Track = "Chapter " + ci.TitleID.ToString("##") + " - " + c1.chId.ToString("##");
                  db1.Chapter = "Chapter " + c1.chId.ToString("##");
                  db1.ChapterID = c1.chId;
                  db1.PlayTime = c1.Time.ToString();
                  db1.OffsetTime = c1.OffsetTime.ToString();
                  db1.ArtistInfo.Add(mv.ArtistInfo[0]);
                  if (mv.AlbumInfo != null && mv.AlbumInfo.Count > 0) db1.AlbumInfo.Add(mv.AlbumInfo[0]);
                  db1.LocalMedia.Add(selectedMatch.LocalMedia[0]);
                  db1.Commit();
                }
              }
              selectedMatch.LocalMedia[0].UpdateMediaInfo();
              selectedMatch.LocalMedia[0].Commit();
              mvStatusChangedListener(selectedMatch, MusicVideoImporterAction.COMMITED);
              //                        ReloadList();
              return;
            }
              }

              // update the match
              PossibleMatch selectedMV = new PossibleMatch();
              selectedMV.MusicVideo = mv;

              MatchResult result = new MatchResult();
              result.TitleScore = 0;
              result.YearScore = 0;
              result.MdMatch = true;

              selectedMV.Result = result;

              selectedMatch.PossibleMatches.Add(selectedMV);
              selectedMatch.Selected = selectedMV;

              ThreadStart actions = delegate
              {
            // Manually Assign Movie
            mvCentralCore.Importer.ManualAssign(selectedMatch);
              };

              Thread thread = new Thread(actions);
              thread.Name = "ManualUpdateThread";
              thread.Start();
            }
              }
        }
Пример #17
0
        /// <summary>
        /// Handle keyboard/remote action
        /// </summary>
        /// <param name="action"></param>
        public override void OnAction(MediaPortal.GUI.Library.Action action)
        {
            MediaPortal.GUI.Library.Action.ActionType wID = action.wID;
              // Queue video to playlist
              if (wID == MediaPortal.GUI.Library.Action.ActionType.ACTION_QUEUE_ITEM)
              {
            facadeLayout.SelectedListItemIndex = Player.playlistPlayer.CurrentItem;
            return;
              }
              // If on Track screen go back to artists screen
              if (wID == MediaPortal.GUI.Library.Action.ActionType.ACTION_PREVIOUS_MENU)
              {
            artistID = CurrentArtistId;
            // Go Back to last view
            _currentView = getPreviousView();
            // Have we backed out to the last screen, if so exit otherwise load the previous screen
            if (_currentView == MvView.None)
              base.OnAction(action);
            else
              loadCurrent();
              }
              else if (wID == MediaPortal.GUI.Library.Action.ActionType.ACTION_CONTEXT_MENU)
              {
            string contextChoice = ShowContextMenu();
            if (contextChoice == Localization.AddToPlaylist)
            {
              //Add to playlist

              // If on a folder add all Videos for Artist
              if (facadeLayout.ListLayout.SelectedListItem.IsFolder)
              {
            _currArtist = DBArtistInfo.Get(facadeLayout.ListLayout.SelectedListItem.Label);
            var allTracksByArtist = DBTrackInfo.GetEntriesByArtist(_currArtist);
            AddToPlaylist(allTracksByArtist, false, mvCentralCore.Settings.ClearPlaylistOnAdd, mvCentralCore.Settings.GeneratedPlaylistAutoShuffle);
              }
              else
              {
            // Add video to playlist
            var playlist = Player.playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MVCENTRAL);
            var filename = facadeLayout.ListLayout.SelectedListItem.Label;
            var path = facadeLayout.ListLayout.SelectedListItem.Path;
            var video = (DBTrackInfo)facadeLayout.ListLayout.SelectedListItem.MusicTag;
            var p1 = new PlayListItem(video);
            p1.Track = video;
            playlist.Add(p1);
              }
            }
            else if (contextChoice == Localization.AddAllToPlaylist)
            {
              // Add all videos to the playlist

              var allTracks = DBTrackInfo.GetAll();
              AddToPlaylist(allTracks, false, mvCentralCore.Settings.ClearPlaylistOnAdd, mvCentralCore.Settings.GeneratedPlaylistAutoShuffle);
            }
            else if (contextChoice == Localization.AddToPlaylistNext)
            {
              // Add video as next playlist item

              addToPlaylistNext(facadeLayout.SelectedListItem);
            }
            else if (contextChoice == Localization.RefreshArtwork)
            {
              // Refresh the artwork

              if (facadeLayout.ListLayout.SelectedListItem.IsFolder)
              {
            _currArtist = DBArtistInfo.Get(facadeLayout.SelectedListItem.Label);
            GUIWaitCursor.Show();
            mvCentralCore.DataProviderManager.GetArt(_currArtist, false);
            GUIWaitCursor.Hide();
            facadeLayout.SelectedListItem.ThumbnailImage = _currArtist.ArtThumbFullPath;
            facadeLayout.SelectedListItem.RefreshCoverArt();
            facadeLayout.SelectedListItemIndex = facadeLayout.SelectedListItemIndex - 1;
            facadeLayout.SelectedListItemIndex = facadeLayout.SelectedListItemIndex + 1;
              }
              else
              {
            var video = (DBTrackInfo)facadeLayout.ListLayout.SelectedListItem.MusicTag;
            GUIWaitCursor.Show();
            mvCentralCore.DataProviderManager.GetArt(video, false);
            GUIWaitCursor.Hide();
            facadeLayout.SelectedListItem.ThumbnailImage = video.ArtFullPath;
            facadeLayout.SelectedListItem.RefreshCoverArt();
            facadeLayout.SelectedListItemIndex = facadeLayout.SelectedListItemIndex - 1;
            facadeLayout.SelectedListItemIndex = facadeLayout.SelectedListItemIndex + 1;
              }
            }
            else if (contextChoice == Localization.RateVid)
            {
              // Allow user rating of video

              OnSetRating(facadeLayout.SelectedListItemIndex);
            }
              }

              else
            base.OnAction(action);
        }
Пример #18
0
        /// <summary>
        /// Actions to perform when artist selected
        /// </summary>
        /// <param name="item"></param>
        /// <param name="parent"></param>
        void onArtistSelected(GUIListItem item, GUIControl parent)
        {
            if (item == null)
              {
            logger.Error("onArtistSelected - No Item!!!");
            return;
              }

              _currArtist = (DBArtistInfo)item.MusicTag;

              if (_currArtist == null)
              {
            logger.Error("Unable to get artist {0} !!", item.Label);
            return;
              }

              // Set the Bio Content
              if (string.IsNullOrEmpty(_currArtist.bioContent))
            GUIPropertyManager.SetProperty("#mvCentral.ArtistBio", string.Format(Localization.NoArtistBio, item.Label));
              else
            GUIPropertyManager.SetProperty("#mvCentral.ArtistBio", mvCentralUtils.bioNoiseFilter(_currArtist.bioContent));
              //mvCentralUtils.StripHTML(track.bioContent);

              // Set artist name and image
              GUIPropertyManager.SetProperty("#mvCentral.ArtistName", _currArtist.Artist);
              GUIPropertyManager.SetProperty("#mvCentral.ArtistImg", _currArtist.ArtFullPath);
              GUIPropertyManager.SetProperty("#mvCentral.VideosByArtist", DBTrackInfo.GetEntriesByArtist(_currArtist).Count.ToString());
              GUIPropertyManager.SetProperty("#mvCentral.ArtistTracksRuntime", runningTime(DBTrackInfo.GetEntriesByArtist(_currArtist)));
              // Set BornOrFormed property
              if (_currArtist.Formed == null)
            _currArtist.Formed = string.Empty;
              if (_currArtist.Born == null)
            _currArtist.Born = string.Empty;

              if (_currArtist.Formed.Trim().Length == 0 && _currArtist.Born.Trim().Length == 0)
            GUIPropertyManager.SetProperty("#mvCentral.BornOrFormed", "No Born/Formed Details");
              else if (_currArtist.Formed.Trim().Length == 0)
            GUIPropertyManager.SetProperty("#mvCentral.BornOrFormed", String.Format("{0}: {1}",Localization.Born, _currArtist.Born));
              else
            GUIPropertyManager.SetProperty("#mvCentral.BornOrFormed", String.Format("{0}: {1}",Localization.Formed, _currArtist.Formed));

              GUIPropertyManager.SetProperty("#mvCentral.Genre", _currArtist.Genre);

              // Artist Genres
              string artistTags = string.Empty;
              foreach (string tag in _currArtist.Tag)
            artistTags += tag + " | ";
              if (!string.IsNullOrEmpty(artistTags))
            GUIPropertyManager.SetProperty("#mvCentral.ArtistTags", artistTags.Remove(artistTags.Length - 2, 2));
              // Clear properites set for tracks
              clearVideoAudioProps();
              // Set the View
              GUIPropertyManager.SetProperty("#mvCentral.ArtistView", "true");
              GUIPropertyManager.SetProperty("#mvCentral.TrackView", "false");
              GUIPropertyManager.SetProperty("#mvCentral.AlbumView", "false");
              // Let property manager knwo we have changes something
              GUIPropertyManager.Changed = true;
              // Store postions in facade
              lastItemArt = facadeLayout.SelectedListItemIndex;
              CurrentArtistInfo = _currArtist;
              CurrentArtistId = item.ItemId;
        }
Пример #19
0
        /// <summary>
        /// Get the Artist Artwork from Mediaportal folder
        /// </summary>
        /// <param name="mvArtistObject"></param>
        /// <returns></returns>
        private bool getMPArtistArt(DBArtistInfo mvArtistObject)
        {
            logger.Debug("In Method: getMPArtistArt(DBArtistInfo mvArtistObject)");
              bool found = false;

              string thumbFolder = Thumbs.MusicArtists;
              string cleanTitle = MediaPortal.Util.Utils.MakeFileName(mvArtistObject.Artist);
              string filename = thumbFolder + @"\" + cleanTitle + "L.jpg";

              if (File.Exists(filename))
              {
            found &= mvArtistObject.AddArtFromFile(filename);
              }
              logger.Debug("In Method: getMPArtistArt(DBArtistInfo mvArtistObject) filename: " + filename + " - " + found);
              return found;
        }
Пример #20
0
        /// <summary>
        /// Video/Album item selected - set a load of properities
        /// </summary>
        /// <param name="item"></param>
        /// <param name="parent"></param>
        void onVideoSelected(GUIListItem item, GUIControl parent)
        {
            DBAlbumInfo albumInfo = null;
              DBTrackInfo trackInfo = null;

              // Is this a Track or Album object we are on
              if (item.MusicTag.GetType() == typeof(DBTrackInfo))
              {
            // This is an Video
            trackInfo = (DBTrackInfo)item.MusicTag;
            GUIPropertyManager.SetProperty("#mvCentral.VideoImg", item.ThumbnailImage);
            // Track information
            if (string.IsNullOrEmpty(item.TVTag.ToString().Trim()))
              GUIPropertyManager.SetProperty("#mvCentral.TrackInfo", Localization.NoTrackInfo);
            else
              GUIPropertyManager.SetProperty("#mvCentral.TrackInfo", item.TVTag.ToString());
            // Track Rating
            GUIPropertyManager.SetProperty("#mvCentral.Track.Rating", trackInfo.Rating.ToString());
            // Track Composers
            if (trackInfo.Composers.Trim().Length == 0)
              GUIPropertyManager.SetProperty("#mvCentral.Composers", Localization.NoComposerInfo);
            else
              GUIPropertyManager.SetProperty("#mvCentral.Composers", trackInfo.Composers.Replace("|", ", "));
            // #iswatched
            DBUserMusicVideoSettings userSettings = trackInfo.ActiveUserSettings;
            if (userSettings.WatchedCount > 0)
            {
              GUIPropertyManager.SetProperty("#iswatched", "yes");
              GUIPropertyManager.SetProperty("#mvCentral.Watched.Count", userSettings.WatchedCount.ToString());
            }
            else
            {
              GUIPropertyManager.SetProperty("#iswatched", "no");
              GUIPropertyManager.SetProperty("#mvCentral.Watched.Count", "0");
            }

            // Get the artist
            DBArtistInfo artistInfo = trackInfo.ArtistInfo[0];
            _currArtist = artistInfo;
            CurrentArtistId = item.ItemId;
            // And set some artist properites
            GUIPropertyManager.SetProperty("#mvCentral.ArtistName", artistInfo.Artist);
            GUIPropertyManager.SetProperty("#mvCentral.Genre", artistInfo.Genre);

            // Get the Album and set some skin props
            albumInfo = DBAlbumInfo.Get(trackInfo);
            if (albumInfo == null)
            {
              GUIPropertyManager.SetProperty("#mvCentral.Hierachy", artistInfo.Artist);
              GUIPropertyManager.SetProperty("#mvCentral.Album.Rating", string.Empty);
              GUIPropertyManager.SetProperty("#mvCentral.Album", string.Empty);
            }
            else
            {
              GUIPropertyManager.SetProperty("#mvCentral.Hierachy", artistInfo.Artist + " | " + albumInfo.Album);
              GUIPropertyManager.SetProperty("#mvCentral.Album", albumInfo.Album);
              GUIPropertyManager.SetProperty("#mvCentral.Album.Rating", albumInfo.Rating.ToString());
            }

            // Misc Proprities
            GUIPropertyManager.SetProperty("#mvCentral.Duration", trackDuration(trackInfo.PlayTime));

            if (trackInfo.LocalMedia[0].IsDVD)
            {
              GUIPropertyManager.SetProperty("#mvCentral.DVDView", "true");
              GUIPropertyManager.SetProperty("#mvCentral.TrackView", "false");
              GUIPropertyManager.SetProperty("#mvCentral.ArtistView", "false");
              GUIPropertyManager.SetProperty("#mvCentral.AlbumView", "false");
              clearVideoAudioProps();
            }
            else
            {
              // Set the view
              GUIPropertyManager.SetProperty("#mvCentral.TrackView", "true");
              GUIPropertyManager.SetProperty("#mvCentral.ArtistView", "false");
              GUIPropertyManager.SetProperty("#mvCentral.AlbumView", "false");
              GUIPropertyManager.SetProperty("#mvCentral.DVDView", "false");
              // Get the mediainfo details
              DBLocalMedia mediaInfo = (DBLocalMedia)trackInfo.LocalMedia[0];
              // Set Video skin props
              GUIPropertyManager.SetProperty("#mvCentral.LocalMedia.videoresolution", mediaInfo.VideoResolution);
              GUIPropertyManager.SetProperty("#mvCentral.LocalMedia.videoaspectratio", mediaInfo.VideoAspectRatio);
              GUIPropertyManager.SetProperty("#mvCentral.LocalMedia.videocodec", mediaInfo.VideoCodec);
              GUIPropertyManager.SetProperty("#mvCentral.LocalMedia.videowidth", mediaInfo.VideoWidth.ToString());
              GUIPropertyManager.SetProperty("#mvCentral.LocalMedia.videoheight", mediaInfo.VideoHeight.ToString());
              GUIPropertyManager.SetProperty("#mvCentral.LocalMedia.videoframerate", mediaInfo.VideoFrameRate.ToString());
              // Set Audio skin props
              GUIPropertyManager.SetProperty("#mvCentral.LocalMedia.audiocodec", mediaInfo.AudioCodec);
              GUIPropertyManager.SetProperty("#mvCentral.LocalMedia.audiochannels", mediaInfo.AudioChannels);
              GUIPropertyManager.SetProperty("#mvCentral.LocalMedia.audio", string.Format("{0} {1}", mediaInfo.AudioCodec, mediaInfo.AudioChannels));
            }

            if (item.Label != "..")
            {
              //logger.Debug("Setting lastItemVid (1) to {0}", facadeLayout.SelectedListItemIndex);
              lastItemVid = facadeLayout.SelectedListItemIndex;
            }

              }
              else
              {
            // Clear the audio/video props
            clearVideoAudioProps();
            // This is a Album
            albumInfo = (DBAlbumInfo)item.MusicTag;
            // Major issue as this should be an album - report and bomb out
            if (albumInfo == null)
            {
              logger.Error("Album data not found - exit method!");
              return;
            }

            GUIPropertyManager.SetProperty("#mvCentral.Album", albumInfo.Album);
            GUIPropertyManager.SetProperty("#mvCentral.Album.Rating", albumInfo.Rating.ToString());

            // get list of tracks in this album
            List<DBTrackInfo> tracksInAlbum = DBTrackInfo.GetEntriesByAlbum(albumInfo);
            DBArtistInfo thisArtist = DBArtistInfo.Get(tracksInAlbum[0]);
            GUIPropertyManager.SetProperty("#mvCentral.ArtistName", thisArtist.Artist);

            // Set the Hierachy
            GUIPropertyManager.SetProperty("#mvCentral.Hierachy", thisArtist.Artist);
            // Set image
            GUIPropertyManager.SetProperty("#mvCentral.VideoImg", item.ThumbnailImage);

            _currArtist = thisArtist;
            CurrentArtistId = item.ItemId;

            // Set the descrioption
            if (string.IsNullOrEmpty(albumInfo.bioContent.Trim()))
            {
              GUIPropertyManager.SetProperty("#mvCentral.TrackInfo", Localization.NoTrackInfo);
              GUIPropertyManager.SetProperty("#mvCentral.AlbumInfo", Localization.NoAlbumInfo);
            }
            else
            {
              GUIPropertyManager.SetProperty("#mvCentral.TrackInfo", mvCentralUtils.bioNoiseFilter(albumInfo.bioContent));
              GUIPropertyManager.SetProperty("#mvCentral.AlbumInfo", mvCentralUtils.bioNoiseFilter(albumInfo.bioContent));
            }
            // Set tracks and Runtime for Album contents
            GUIPropertyManager.SetProperty("#mvCentral.AlbumTracksRuntime", runningTime(tracksInAlbum));
            GUIPropertyManager.SetProperty("#mvCentral.TracksForAlbum", tracksInAlbum.Count.ToString());
            // Set the View
            GUIPropertyManager.SetProperty("#mvCentral.AlbumView", "true");
            GUIPropertyManager.SetProperty("#mvCentral.ArtistView", "false");
            GUIPropertyManager.SetProperty("#mvCentral.TrackView", "false");
            GUIPropertyManager.SetProperty("#mvCentral.DVDView", "false");
            if (item.Label != "..")
            {
              //logger.Debug("Setting lastItemAlb (1) to {0}", facadeLayout.SelectedListItemIndex);
              lastItemAlb = facadeLayout.SelectedListItemIndex;
            }

              }
              GUIPropertyManager.Changed = true;
        }
Пример #21
0
        /// <summary>
        /// Get Local Artist Artwork, check for custom folder or artwork in the same folder as the music video
        /// </summary>
        /// <param name="artistInfo"></param>
        /// <returns></returns>
        public bool GetArtistArt(DBArtistInfo artistInfo)
        {
            logger.Debug("In Method GetArtistArt(DBArtistInfo artistInfo)");

              if (artistInfo == null)
            return false;

              // if we already have a artist move on for now
              if (artistInfo.ArtFullPath.Trim().Length > 0)
            return false;

              bool found = false;
              // If a custom artfolder is specified the search
              if (mvCentralCore.Settings.SearchCustomFolderForArtistArt)
              {
            found = getArtistArtFromCustomArtistArtFolder(artistInfo);
            logger.Debug("Sucessfully added fanart from custom folder: {0}", artistInfo.ArtFullPath);
              }// Look for Artwork in same folder as video
              if (!found)
            found = getArtistArtFromArtistArtFolder(artistInfo);
              // Look for artwork in the ..\thumbs\mvCentral\Artists\FullSize folder
              if (!found)
            found = getOldArtistArt(artistInfo);

              return found;
        }
Пример #22
0
 /// <summary>
 /// Match genre with any last.fm tag in the Artist object
 /// </summary>
 /// <param name="genreTag"></param>
 /// <param name="artistData"></param>
 /// <returns></returns>
 private bool tagMatched(string genreTag, DBArtistInfo artistData)
 {
     foreach (string artistTag in artistData.Tag)
       {
     if (artistTag == genreTag)
     {
       return true;
     }
       }
       return false;
 }
Пример #23
0
        /// <summary>
        /// Get Artist Artwork from the Custom Artist Artwork folder.
        /// </summary>
        /// <param name="mvArtistObject"></param>
        /// <returns></returns>
        private bool getArtistArtFromCustomArtistArtFolder(DBArtistInfo mvArtistObject)
        {
            string artistArtFolderPath = string.Empty;

              logger.Debug("In Method getArtistArtFromCustomArtistArtFolder(DBArtistInfo mv)");
              if (mvArtistObject == null)
            return false;

              // grab a list of possible filenames for the artist based on the user pattern
              string pattern = mvCentralCore.Settings.ArtistArtworkFilenamePattern;
              List<string> filenames = getPossibleNamesFromPattern(pattern, mvArtistObject);

              // check the ArtistArt folder for the user patterned ArtistArt
              artistArtFolderPath = mvCentralCore.Settings.CustomArtistArtFolder;
              FileInfo newArtistArt = getFirstFileFromFolder(artistArtFolderPath, filenames);
              if (newArtistArt != null && newArtistArt.Exists)
              {
            mvArtistObject.ArtFullPath = newArtistArt.FullName;
            mvArtistObject.AlternateArts.Add(newArtistArt.FullName);
            mvArtistObject.GenerateThumbnail();
            logger.Info("Loaded artistart from " + newArtistArt.FullName);
            return true;
              }
              return false;
        }
Пример #24
0
 /// <summary>
 /// Get Artist Artwork
 /// </summary>
 /// <param name="mvArtistObject"></param>
 /// <returns></returns>
 public bool GetArtistArt(DBArtistInfo mvArtistObject)
 {
     return false;
 }
Пример #25
0
        /// <summary>
        /// Get the Artist Artwork using the old Method
        /// </summary>
        /// <param name="mvArtistObject"></param>
        /// <returns></returns>
        private bool getOldArtistArt(DBArtistInfo mvArtistObject)
        {
            logger.Debug("In Method getOldArtistArt(DBArtistInfo mv)");
              bool found = false;

              string artistartFolderPath = mvCentralCore.Settings.ArtistArtFolder;
              DirectoryInfo artistartFolder = new DirectoryInfo(artistartFolderPath);

              string safeName = mvArtistObject.Artist.Replace(' ', '.').ToValidFilename();
              Regex oldArtistArtRegex = new Regex("^{?" + Regex.Escape(safeName) + "}? \\[-?\\d+\\]\\.(jpg|png)");

              foreach (FileInfo currFile in artistartFolder.GetFiles())
              {
            if (oldArtistArtRegex.IsMatch(currFile.Name))
            {
              found &= mvArtistObject.AddArtFromFile(currFile.FullName);
            }
              }
              return found;
        }
Пример #26
0
        /// <summary>
        /// Update missing Artist information
        /// </summary>
        /// <param name="mv"></param>
        /// <param name="artistInfo"></param>
        private void UpdateMusicVideoArtist(ref DBArtistInfo mv, ArtistInfo artistInfo, string strArtistHTML)
        {
            if (mv.Formed.Trim() == string.Empty)
            mv.Formed = mvCentralUtils.StripHTML(artistInfo.Formed);

              if (mv.Disbanded.Trim() == string.Empty)
            mv.Disbanded = mvCentralUtils.StripHTML(artistInfo.Disbanded);

              if (mv.Born.Trim() == string.Empty)
            mv.Born = mvCentralUtils.StripHTML(artistInfo.Born);

              if (mv.Death.Trim() == string.Empty)
            mv.Death = mvCentralUtils.StripHTML(artistInfo.Death);

              if (mv.bioSummary.Trim() == string.Empty)
            mv.bioSummary = getBioSummary(artistInfo.AMGBio, 50);

              if (mv.bioContent.Trim() == string.Empty)
            mv.bioContent = artistInfo.AMGBio;

              if (mv.Genre.Trim() == string.Empty)
            mv.Genre = artistInfo.Genres;

              if (mv.Tones.Trim() == string.Empty)
            mv.Tones = artistInfo.Tones;

              if (mv.Styles.Trim() == string.Empty)
            mv.Styles = artistInfo.Styles;

              if (mv.YearsActive.Trim() == string.Empty)
            mv.YearsActive = artistInfo.YearsActive;
        }
Пример #27
0
        /// <summary>
        /// parses and replaces variables from a filename based on the pattern supplied
        /// returning a list of possible file matches
        /// </summary>
        /// <param name="pattern"></param>
        /// <param name="mv"></param>
        /// <returns></returns>
        private List<string> getPossibleNamesFromPattern(string pattern, object mv)
        {
            Regex parser = new Regex("%(.*?)%", RegexOptions.IgnoreCase);
              // Artist Artwork
              if (mv.GetType() == typeof(DBArtistInfo))
              {
            mvArtistObject = (DBArtistInfo)mv;
            lock (lockObj)
            {
              List<string> filenames = new List<string>();
              foreach (string currPattern in pattern.Split('|'))
              {
            // replace db field patterns
            string filename = parser.Replace(currPattern, new MatchEvaluator(dbArtistNameParser)).Trim().ToLower();
            if (filename != null)
              filenames.Add(filename);
              }
              return filenames;
            }
              }
              // Album Artwork
              if (mv.GetType() == typeof(DBAlbumInfo))
              {
            mvAlbumObject = (DBAlbumInfo)mv;
            lock (lockObj)
            {
              List<string> filenames = new List<string>();
              foreach (string currPattern in pattern.Split('|'))
              {
            // replace db field patterns
            string filename = parser.Replace(currPattern, new MatchEvaluator(dbAlbumNameParser)).Trim().ToLower();
            if (filename != null)
              filenames.Add(filename);
              }
              return filenames;
            }
              }
              // This is track data
              if (mv.GetType() == typeof(DBTrackInfo))
              {
            // try to create our filename(s)
            this.mvTrackObject = (DBTrackInfo)mv;
            //this.mvTrackObject.LocalMedia[0].TrimmedFullPath;
            lock (lockObj)
            {
              List<string> filenames = new List<string>();
              foreach (string currPattern in pattern.Split('|'))
              {
            // replace db field patterns

            string filename = parser.Replace(currPattern, new MatchEvaluator(dbTrackNameParser)).Trim().ToLower();

            // replace %filename% pattern
            if (mvTrackObject.LocalMedia.Count > 0)
            {
              string videoFileName = Path.GetFileNameWithoutExtension(mvTrackObject.LocalMedia[0].File.Name);
              filename = filename.Replace("%filename%", videoFileName);
            }

            filenames.Add(filename);
              }
              return filenames;
            }
              }

              //should never get here
              return null;
        }
Пример #28
0
        public static DBArtistInfo GetOrCreate(DBTrackInfo mv)
        {
            DBArtistInfo rtn = mv.ArtistInfo[0];
              if (rtn != null)
            return rtn;

              rtn = new DBArtistInfo();
              mv.ArtistInfo.Add(rtn);
              return rtn;
        }
Пример #29
0
        /// <summary>
        /// get the artist details
        /// </summary>
        /// <param name="mv"></param>
        /// <returns></returns>
        public DBTrackInfo GetArtistDetail(DBTrackInfo mv)
        {
            // ****************** Additional Artist Info Processing ******************
              // Check and update Artist details from additional providers
              DBArtistInfo artInfo = new DBArtistInfo();
              artInfo = mv.ArtistInfo[0];

              foreach (DBSourceInfo artistExtraInfo in artistDetailSources)
              {
            if (artInfo.PrimarySource != artistExtraInfo.Provider)
            {
              artInfo = artistExtraInfo.Provider.GetArtistDetail(mv).ArtistInfo[0];
              artInfo.PrimarySource = artistExtraInfo;
            }
              }
              mv.ArtistInfo[0] = artInfo;

              return mv;
        }
Пример #30
0
 /// <summary>
 /// Does the keyword exist in the Track description
 /// </summary>
 /// <param name="artistInfo"></param>
 /// <returns></returns>
 bool keywordInTrackDescription(DBArtistInfo artistInfo, string keyWord)
 {
     List<DBTrackInfo> videosByArtist = DBTrackInfo.GetEntriesByArtist(artistInfo);
       foreach (DBTrackInfo track in videosByArtist)
       {
     if (track.bioContent.Contains(keyWord, StringComparison.OrdinalIgnoreCase))
       return true;
       }
       return false;
 }
Пример #31
0
        /// <summary>
        /// Get Local Artist Artwork, check for custom folder or artwork in the same folder as the music video
        /// </summary>
        /// <param name="artistInfo"></param>
        /// <returns></returns>
        public bool GetArtistArt(DBArtistInfo artistInfo)
        {
            if (artistInfo == null)
            return false;
              logger.Debug("In Method: GetArtistArt(DBArtistInfo artistInfo)");

              // if we already have a artist move on for now
              if (artistInfo.ArtFullPath.Trim().Length > 0 && File.Exists(artistInfo.ArtFullPath.Trim()))
            return false;

              // Look for Artwork in Mediaportal folder
              return getMPArtistArt(artistInfo);
        }