/// <summary> /// Get the album details /// </summary> /// <param name="basicInfo"></param> /// <param name="albumTitle"></param> /// <param name="albumMbid"></param> /// <returns></returns> public bool GetAlbumDetails(DBBasicInfo basicInfo, string albumTitle, string albumMbid) { return true; }
/// <summary> /// Get the Artist, Album Details /// </summary> /// <param name="mv"></param> /// <returns></returns> public bool GetDetails(DBBasicInfo mv) { string strArtistHTML; string strAlbumHTML; string strArtistURL; ReportProgress(string.Empty); // Get details of the artist if (mv.GetType() == typeof(DBArtistInfo)) { string artist = ((DBArtistInfo)mv).Artist; ReportProgress("Getting Artist..."); if (GetArtistHTML(artist, out strArtistHTML, out strArtistURL)) { var artistInfo = AMGHTMLParser.ParseArtistHTML(strArtistHTML, artist); if (artistInfo != null) { artistInfo.Artist = artist; DBArtistInfo mv1 = (DBArtistInfo)mv; SetMusicVideoArtist(ref mv1, artistInfo, strArtistHTML); GetArtistArt((DBArtistInfo)mv); ReportProgress("Done..."); return true; } } return false; } // get details of the album if (mv.GetType() == typeof(DBAlbumInfo)) { string album = ((DBAlbumInfo)mv).Album; List<DBTrackInfo> trackList = DBTrackInfo.GetEntriesByAlbum((DBAlbumInfo)mv); DBArtistInfo artist = DBArtistInfo.Get(trackList[0]); if (GetAlbumHTML(artist.Artist, album, out strAlbumHTML)) { var albumInfo = AMGHTMLParser.ParseAlbumHTML(strAlbumHTML, album, artist.Artist); if (albumInfo != null) { albumInfo.Artist = album; DBAlbumInfo mv1 = (DBAlbumInfo)mv; SetMusicVideoAlbum(ref mv1, albumInfo); } } return false; } // get details of the track if (mv.GetType() == typeof(DBTrackInfo)) { if (((DBTrackInfo)mv).LocalMedia[0].IsDVD) { string track = ((DBTrackInfo)mv).Track; GetDVDDetails((DBTrackInfo)mv); return true; } else { string track = ((DBTrackInfo)mv).Track; GetTrackDetails((DBTrackInfo)mv); return true; } } return true; }
public static DBSourceMusicVideoInfo Get(DBBasicInfo movie, int scriptID) { // return Get(movie, DBSourceInfo.GetFromScriptID(scriptID)); return null; }
/// <summary> /// Get the Artist, Album Details /// </summary> /// <param name="mv"></param> /// <returns></returns> public bool GetDetails(DBBasicInfo mv) { return false; }
/// <summary> /// Get the details for the suppkied object type, Artist, Album or Track /// </summary> /// <param name="mvDbObject"></param> /// <returns></returns> public bool GetDetails(DBBasicInfo mvDbObject) { // Artist if (mvDbObject.GetType() == typeof(DBArtistInfo)) { // if we have already hit our limit for the number of Artist arts to load, quit if (mvDbObject.AlternateArts.Count >= mvCentralCore.Settings.MaxArtistArts) return true; List<DBSourceInfo> sources; lock (artistArtSources) sources = new List<DBSourceInfo>(artistArtSources); foreach (DBSourceInfo currSource in sources) { if (currSource.IsDisabled(DataType.ARTISTART)) continue; bool success = currSource.Provider.GetDetails((DBArtistInfo)mvDbObject); if (success) return true; } } // Album if (mvDbObject.GetType() == typeof(DBAlbumInfo)) { // if we have already hit our limit for the number of Album arts to load, quit if (mvDbObject.AlternateArts.Count >= mvCentralCore.Settings.MaxAlbumArts) return true; List<DBSourceInfo> sources; lock (albumArtSources) sources = new List<DBSourceInfo>(albumArtSources); foreach (DBSourceInfo currSource in sources) { if (currSource.IsDisabled(DataType.ALBUMART)) continue; bool success = currSource.Provider.GetDetails((DBAlbumInfo)mvDbObject); if (success) return true; } } // Track if (mvDbObject.GetType() == typeof(DBTrackInfo)) { // if we have already hit our limit for the number of Track arts to load, quit if (mvDbObject.AlternateArts.Count >= mvCentralCore.Settings.MaxTrackArts) return true; List<DBSourceInfo> sources; lock (trackArtSources) sources = new List<DBSourceInfo>(trackArtSources); foreach (DBSourceInfo currSource in sources) { if (currSource.IsDisabled(DataType.TRACKART)) continue; bool success = currSource.Provider.GetDetails((DBTrackInfo)mvDbObject); if (success) return true; } } return false; }
public static DBSourceMusicVideoInfo GetOrCreate(DBBasicInfo mv, int scriptID) { // return GetOrCreate(mv, DBSourceInfo.GetFromScriptID(scriptID)); return null; }
public static BasicArt FromFile(DBBasicInfo mv, string path, bool ignoreRestrictions, out ImageLoadResults status) { ImageSize minSize = null; ImageSize maxSize = new ImageSize(); if (mvs == null) mvs = mv; if (!ignoreRestrictions) { minSize = new ImageSize(); if (mvs.GetType() == typeof(DBTrackInfo)) { minSize.Width = mvCentralCore.Settings.MinimumTrackWidth; minSize.Height = mvCentralCore.Settings.MinimumTrackHeight; } if (mvs.GetType() == typeof(DBAlbumInfo)) { minSize.Width = mvCentralCore.Settings.MinimumAlbumWidth; minSize.Height = mvCentralCore.Settings.MinimumAlbumHeight; } if (mvs.GetType() == typeof(DBArtistInfo)) { minSize.Width = mvCentralCore.Settings.MinimumArtistWidth; minSize.Height = mvCentralCore.Settings.MinimumArtistHeight; } } bool redownload = false; if (mvs.GetType() == typeof(DBTrackInfo)) { maxSize.Width = mvCentralCore.Settings.MaximumTrackWidth; maxSize.Height = mvCentralCore.Settings.MaximumTrackHeight; redownload = mvCentralCore.Settings.RedownloadTrackArtwork; } if (mvs.GetType() == typeof(DBAlbumInfo)) { maxSize.Width = mvCentralCore.Settings.MaximumAlbumWidth; maxSize.Height = mvCentralCore.Settings.MaximumAlbumHeight; redownload = mvCentralCore.Settings.RedownloadAlbumArtwork; } if (mvs.GetType() == typeof(DBArtistInfo)) { maxSize.Width = mvCentralCore.Settings.MaximumArtistWidth; maxSize.Height = mvCentralCore.Settings.MaximumArtistHeight; redownload = mvCentralCore.Settings.RedownloadArtistArtwork; } BasicArt newTrack = new BasicArt(mv); newTrack.Filename = GenerateFilename(path); status = newTrack.FromFile(path, ignoreRestrictions, minSize, maxSize, redownload); string threadID = Thread.CurrentThread.ManagedThreadId.ToString(); switch (status) { case ImageLoadResults.SUCCESS: logger.Info("Added art for \"{0}\" from: {1}", mv.Basic, path); break; case ImageLoadResults.SUCCESS_REDUCED_SIZE: logger.Info("Added resized art for \"{1}\" from: {2}", mv.Basic, path); break; case ImageLoadResults.FAILED_ALREADY_LOADED: logger.Debug("art for \"{0}\" from the following path is already loaded: {1}", mv.Basic, path); return null; case ImageLoadResults.FAILED_TOO_SMALL: logger.Debug("Downloaded art for \"{0}\" failed minimum resolution requirements: {1}", mv.Basic, path); return null; case ImageLoadResults.FAILED: logger.Error("(Failed art for \"{0}\": {1}", mv.Basic, path); return null; } return newTrack; }
public bool GetDetails(DBBasicInfo mv) { logger.Debug("In Method: GetDetails(DBBasicInfo mv)"); MusicDatabase m_db = null; string inLang = mvCentralCore.Settings.DataProviderAutoLanguage; ReportProgress(string.Empty); try { m_db = MusicDatabase.Instance; } catch (Exception e) { logger.Error("GetDetails: Music database init failed " + e.ToString()); return false; } // ---------------- Get Artist Info --------------------- if (mv.GetType() == typeof (DBArtistInfo)) { var artist = ((DBArtistInfo) mv).Artist; var releases = new List<Release>(); var artists = new ArrayList(); // Grab the Artist Info if (artist != null) { ReportProgress("Getting Artists..."); logger.Debug("GetDetails: Getting Artists: " + artist); artists.Clear(); string strArtist = NormalizeArtist(artist); string strSQL = String.Format("SELECT a.strArtist FROM artist a, artistinfo i WHERE LOWER(a.strArtist) = LOWER(i.strArtist) AND i.strAMGBio IS NOT NULL AND TRIM(i.strAMGBio) <> '' AND LOWER(i.strArtist) LIKE '%{0}%';", strArtist); List<Song> songInfo = new List<Song>(); m_db.GetSongsByFilter(strSQL, out songInfo, "artist"); foreach (Song mySong in songInfo) { if (!string.IsNullOrEmpty(mySong.Artist)) { artists.Add(mySong.Artist); } } } else return false; if (artists == null || artists.Count <= 0) return false; foreach (string _artist in artists) { Release r2 = new Release(_artist, string.Empty); releases.Add(r2); } ReportProgress("Done!"); // Now sort and Display the retrived matches releases.Sort(Release.TitleComparison); var resultsDialog = new DetailsPopup(releases); // Get the full info for the selection if (resultsDialog.ShowDialog() == DialogResult.OK) { var mv1 = (DBArtistInfo)mv; mv.ArtUrls.Clear(); string title = resultsDialog.selectedItem.Text; string mbid = resultsDialog.label8.Text; if (title.Trim().Length == 0) title = null; if (mbid.Trim().Length == 0) mbid = null; setMusicVideoArtist(ref mv1, title, mbid); GetArtistArt((DBArtistInfo) mv); } } // -------------- Get Album Info -------------- if (mv.GetType() == typeof(DBAlbumInfo)) { List<DBTrackInfo> a1 = DBTrackInfo.GetEntriesByAlbum((DBAlbumInfo)mv); if (a1.Count > 0) { string artist = a1[0].ArtistInfo[0].Artist; var albums = new ArrayList(); ; if (artist != null) { ReportProgress("Getting Albums..."); logger.Debug("GetDetails: Getting Albums: " + artist); albums.Clear(); string strArtist = NormalizeArtist(artist); string strSQL = String.Format("SELECT DISTINCT T.strAlbum, A.strReview FROM albuminfo A, tracks T WHERE A.strReview IS NOT NULL AND TRIM(A.strReview) <> '' AND (A.strArtist LIKE '%{0}%' OR A.strAlbumArtist LIKE '%{1}%') AND T.strAlbum = A.strAlbum COLLATE NOCASE;", strArtist, strArtist); List<Song> songInfo = new List<Song>(); m_db.GetSongsByFilter(strSQL, out songInfo, "album"); logger.Debug("GetDetails: Getting Albums: " + artist + " - " + songInfo.Count); foreach (Song mySong in songInfo) { if (!string.IsNullOrEmpty(mySong.Album)) { albums.Add(mySong.Album); } } } else return false; if (albums == null || albums.Count <= 0) return false; List<Release> artistTopAlbumns = new List<Release>(); foreach (string _album in albums) { logger.Debug("GetDetails: Getting Albums: " + artist + " - " + _album); Release r2 = new Release(_album, string.Empty); artistTopAlbumns.Add(r2); } ReportProgress("Done!"); artistTopAlbumns.Sort(Release.TitleComparison); DetailsPopup d1 = new DetailsPopup(artistTopAlbumns); if (d1.ShowDialog() == DialogResult.OK) { DBAlbumInfo mv1 = (DBAlbumInfo)mv; mv.ArtUrls.Clear(); string title = d1.selectedItem.Text; string mbid = d1.label8.Text; if (title.Trim().Length == 0) title = null; if (mbid.Trim().Length == 0) mbid = null; setMusicVideoAlbum(ref mv1, artist, title, mbid); GetAlbumArt((DBAlbumInfo)mv); } } } // -------------- Get Track Info -------------- if (mv.GetType() == typeof(DBTrackInfo)) { string artist = ((DBTrackInfo)mv).ArtistInfo[0].Artist; var tracks = new ArrayList();; if (artist != null) { ReportProgress("Getting Tracks..."); logger.Debug("GetDetails: Getting Tracks: " + artist); tracks.Clear(); string strArtist = NormalizeArtist(artist); string strSQL = String.Format("SELECT strTitle FROM tracks WHERE strArtist LIKE '%| {0} |%' OR strAlbumArtist LIKE '%| {1} |%';');", strArtist, strArtist); List<Song> songInfo = new List<Song>(); m_db.GetSongsByFilter(strSQL, out songInfo, "tracks"); logger.Debug("GetDetails: Getting Tracks: " + artist + " - " + songInfo.Count); foreach (Song mySong in songInfo) { if (!string.IsNullOrEmpty(mySong.Title)) { tracks.Add(mySong.Title); } } } else return false; if (tracks == null || tracks.Count <= 0) return false; List<Release> artistTopTracks = new List<Release>(); foreach (string _track in tracks) { logger.Debug("GetDetails: Getting Track: " + artist + " - " + _track); Release r2 = new Release(_track, string.Empty); artistTopTracks.Add(r2); } ReportProgress("Done!"); artistTopTracks.Sort(Release.TitleComparison); DetailsPopup d1 = new DetailsPopup(artistTopTracks); if (d1.ShowDialog() == DialogResult.OK) { DBTrackInfo mv1 = (DBTrackInfo)mv; mv.ArtUrls.Clear(); if (artist.Trim().Length == 0) artist = null; string title = d1.selectedItem.Text; string mbid = d1.label8.Text; if (title.Trim().Length == 0) title = null; if (mbid.Trim().Length == 0) mbid = null; setMusicVideoTrack(ref mv1, artist, title, mbid); GetTrackArt((DBTrackInfo)mv); } } return true; }
public BasicArt(DBBasicInfo mv) { mvs = mv; }
public static BasicArt FromFile(DBBasicInfo mv, string path, out ImageLoadResults status) { return FromFile(mv, path, false, out status); }
public static BasicArt FromUrl(DBBasicInfo mv, string url, out ImageLoadResults status) { return FromUrl(mv, url, false, out status); }
public static DBSourceMusicVideoInfo Get(DBBasicInfo movie, int scriptID) { // return Get(movie, DBSourceInfo.GetFromScriptID(scriptID)); return(null); }
public static DBSourceMusicVideoInfo GetOrCreate(DBBasicInfo mv, int scriptID) { // return GetOrCreate(mv, DBSourceInfo.GetFromScriptID(scriptID)); return(null); }
public bool GetAlbumDetails(DBBasicInfo basicInfo, string albumTitle, string albumMbid) { throw new NotImplementedException(); }
/// <summary> /// Get artwork for suppiled object, Artist, Album or Track /// </summary> /// <param name="mvDBObject"></param> /// <returns></returns> public bool GetArt(DBBasicInfo mvDBObject, bool primarySourceOnly) { bool success = false; int artWorkAdded = 0; logger.Debug("In Method: GetArt(DBBasicInfo mvDBObject, bool primarySourceOnly = " + primarySourceOnly + ")"); // Artist if (mvDBObject.GetType() == typeof(DBArtistInfo)) { var _count = 0; foreach (string _art in mvDBObject.AlternateArts) { if (File.Exists(_art)) _count++; } logger.Debug("GetArt: Artist: mvDBObject.AlternateArts.Count: " + _count + " mvCentralCore.Settings.MaxArtistArts: " + mvCentralCore.Settings.MaxArtistArts); // if we have already hit our limit for the number of artist arts to load, quit if (_count >= mvCentralCore.Settings.MaxArtistArts) return true; List<DBSourceInfo> sources; lock (artistArtSources) sources = new List<DBSourceInfo>(artistArtSources); foreach (DBSourceInfo currSource in sources) { if (currSource.IsDisabled(DataType.ARTISTART)) continue; if (currSource.Provider != mvDBObject.PrimarySource.Provider && primarySourceOnly) continue; logger.Debug("Try to get art from provider : " + currSource.Provider.Name); success = currSource.Provider.GetArtistArt((DBArtistInfo)mvDBObject); if (success) artWorkAdded++; } if (artWorkAdded > 0) { mvDBObject.Commit(); return true; } } // Album if (mvDBObject.GetType() == typeof(DBAlbumInfo)) { var _count = 0; foreach (string _art in mvDBObject.AlternateArts) { if (File.Exists(_art)) _count++; } logger.Debug("GetArt: Album: mvDBObject.AlternateArts.Count: " + _count + " mvCentralCore.Settings.MaxAlbumArts: " + mvCentralCore.Settings.MaxAlbumArts); // if we have already hit our limit for the number of album arts to load, quit if (_count >= mvCentralCore.Settings.MaxAlbumArts) return true; List<DBSourceInfo> sources; lock (albumArtSources) sources = new List<DBSourceInfo>(albumArtSources); artWorkAdded = 0; foreach (DBSourceInfo currSource in sources) { logger.Debug("*** : " + currSource.Provider.Name + " - " + currSource.IsDisabled(DataType.ALBUMART)); if (currSource.IsDisabled(DataType.ALBUMART)) continue; logger.Debug("*** : " + currSource.Provider.Name + " - " + mvDBObject.PrimarySource.Provider.Name + " - " + primarySourceOnly); if (currSource.Provider != mvDBObject.PrimarySource.Provider && primarySourceOnly) continue; logger.Debug("Try to get art from provider: " + currSource.Provider.Name); success = currSource.Provider.GetAlbumArt((DBAlbumInfo)mvDBObject); if (success) artWorkAdded++; } if (artWorkAdded > 0) { mvDBObject.Commit(); return true; } } // Track if (mvDBObject.GetType() == typeof(DBTrackInfo)) { var _count = 0; foreach (string _art in mvDBObject.AlternateArts) { if (File.Exists(_art)) _count++; } logger.Debug("GetArt: Track: mvDBObject.AlternateArts.Count: " + _count + " mvCentralCore.Settings.MaxTrackArts: " + mvCentralCore.Settings.MaxTrackArts); // if we have already hit our limit for the number of Track arts to load, quit if (_count >= mvCentralCore.Settings.MaxTrackArts) return true; List<DBSourceInfo> sources; lock (trackArtSources) sources = new List<DBSourceInfo>(trackArtSources); artWorkAdded = 0; foreach (DBSourceInfo currSource in sources) { if (currSource.IsDisabled(DataType.TRACKART)) continue; if (currSource.Provider != mvDBObject.PrimarySource.Provider && primarySourceOnly) continue; logger.Debug("Try to get art from provider : " + currSource.Provider.Name); success = currSource.Provider.GetTrackArt((DBTrackInfo)mvDBObject); if (success) artWorkAdded++; } if (artWorkAdded > 0) { mvDBObject.Commit(); return true; } } return false; }
public bool GetDetails(DBBasicInfo mv) { throw new NotImplementedException(); }
public bool GetAlbumDetails(DBBasicInfo basicInfo, string albumTitle, string albumMbid) { logger.Debug("In Method: GetAlbumDetails(DBBasicInfo basicInfo, Album: " + albumTitle + " MBID: " + albumMbid + ")"); List<DBTrackInfo> tracksOnAlbum = DBTrackInfo.GetEntriesByAlbum((DBAlbumInfo)basicInfo); if (tracksOnAlbum.Count > 0) { string artist = tracksOnAlbum[0].ArtistInfo[0].Artist; DBAlbumInfo mv1 = (DBAlbumInfo)basicInfo; basicInfo.ArtUrls.Clear(); setMusicVideoAlbum(ref mv1, artist, albumTitle, albumMbid); GetAlbumArt((DBAlbumInfo)basicInfo); } return true; }