/// <summary> /// Returns a list of DBTrackInfo objects that match the Album /// </summary> /// <param name="mbid"></param> /// <returns></returns> public static List <DBTrackInfo> GetEntriesByTrack(string trackmbid) { DBField trackmbidField = DBField.GetField(typeof(DBTrackInfo), "MdID"); ICriteria criteria = new BaseCriteria(trackmbidField, "=", trackmbid); return(mvCentralCore.DatabaseManager.Get <DBTrackInfo>(criteria)); }
/// <summary> /// Get a movie object by movie name /// </summary> /// <param name="movieName">Name of a movie</param> /// <returns>Returns a movie object or null if no movie was found.</returns> private static DBMovieInfo GetMovieByName(string movieName) { ICriteria titleFilter = new BaseCriteria(DBField.GetField(typeof(DBMovieInfo), "Title"), "like", "%" + movieName + "%"); List <DBMovieInfo> foundMovies = MovingPicturesCore.DatabaseManager.Get <DBMovieInfo>(titleFilter); // If there are more than one result return the movie with an exact title // match or first movie if no exact match was found if (foundMovies.Count > 1) { foreach (DBMovieInfo movie in foundMovies) { if (movie.Title.ToLower().Equals(movieName.ToLower())) { return(movie); } } return(foundMovies[0]); } else { // Return the first and only movie or null if there was no result if (foundMovies.Count == 1) { return(foundMovies[0]); } else { WifiRemote.LogMessage("Could not find MovingPictures movie " + movieName, WifiRemote.LogType.Info); return(null); } } }
/// <summary> /// Returns a list of DBArtistInfo objects that match the Album /// </summary> /// <param name="mbid"></param> /// <returns></returns> public static List <DBArtistInfo> GetEntriesByArtistMbID(string artistmbid) { DBField artistmbidField = DBField.GetField(typeof(DBArtistInfo), "MdID"); ICriteria criteria = new BaseCriteria(artistmbidField, "=", artistmbid); return(mvCentralCore.DatabaseManager.Get <DBArtistInfo>(criteria)); }
/// <summary> /// Returns a list of DBLocalMedia objects that match the discid /// </summary> /// <param name="filehash"></param> /// <returns></returns> public static List <DBLocalMedia> GetEntriesByDiscId(string discId) { DBField discIdField = DBField.GetField(typeof(DBLocalMedia), "DiscId"); ICriteria criteria = new BaseCriteria(discIdField, "=", discId); return(MovingPicturesCore.DatabaseManager.Get <DBLocalMedia>(criteria)); }
/// <summary> /// Returns a list of DBLocalMedia objects that match the filehash /// </summary> /// <param name="filehash"></param> /// <returns></returns> public static List <DBLocalMedia> GetEntriesByHash(string filehash) { DBField fileHashField = DBField.GetField(typeof(DBLocalMedia), "FileHash"); ICriteria criteria = new BaseCriteria(fileHashField, "=", filehash); return(MovingPicturesCore.DatabaseManager.Get <DBLocalMedia>(criteria)); }
/// <summary> /// Returns a list of DBAlbumInfo objects that match the Track /// </summary> /// <param name="mbid"></param> /// <returns></returns> public static List <DBAlbumInfo> GetEntriesByAlbumName(string albumname) { lock (lockList) { DBField albumnameField = DBField.GetField(typeof(DBAlbumInfo), "Album"); ICriteria criteria = new BaseCriteria(albumnameField, "=", albumname); return(mvCentralCore.DatabaseManager.Get <DBAlbumInfo>(criteria)); } }
/// <summary> /// Returns a list of DBAlbumInfo objects based on int id that match the Track /// </summary> /// <param name="mbid"></param> /// <returns></returns> public static List <DBAlbumInfo> GetEntriesByIntIdAlbum(string trackintid) { lock (lockList) { DBField albummbidField = DBField.GetField(typeof(DBAlbumInfo), "trackint_id"); ICriteria criteria = new BaseCriteria(albummbidField, "=", trackintid); return(mvCentralCore.DatabaseManager.Get <DBAlbumInfo>(criteria)); } }
// Gets the corresponding DBImportPath object using it's FullPath property public static DBImportPath Get(string fullPath) { DBField pathField = DBField.GetField(typeof(DBImportPath), "FullPath"); ICriteria criteria = new BaseCriteria(pathField, "like", fullPath); List <DBImportPath> resultSet = MovingPicturesCore.DatabaseManager.Get <DBImportPath>(criteria); if (resultSet.Count > 0) { return(resultSet[0]); } DBImportPath newImportPath = new DBImportPath(); newImportPath.FullPath = fullPath; return(newImportPath); }
protected void FieldChanged(string fieldName) { if (RetrievalInProcess) { return; } DBField field = DBField.GetField(GetType(), fieldName); if (field == null) { field = DBField.GetFieldByDBName(GetType(), fieldName); } if (field != null) { changedFields.Add(field); } }
public static List <DBLocalMedia> GetAll(string fullPath, string volumeSerial) { DBField pathField = DBField.GetField(typeof(DBLocalMedia), "FullPath"); // using operator LIKE to make the search case insensitive ICriteria pathCriteria = new BaseCriteria(pathField, "like", fullPath); ICriteria criteria = pathCriteria; if (volumeSerial != null) { DBField serialField = DBField.GetField(typeof(DBLocalMedia), "VolumeSerial"); ICriteria serialCriteria = new BaseCriteria(serialField, "=", volumeSerial); criteria = new GroupedCriteria(pathCriteria, GroupedCriteria.Operator.AND, serialCriteria); } List <DBLocalMedia> resultSet = MovingPicturesCore.DatabaseManager.Get <DBLocalMedia>(criteria); return(resultSet); }
public static bool RatingChanged(this TableUpdateInfo self) { return(self.UpdatedFields.Contains(DBField.GetField(typeof(DBUserMovieSettings), "UserRating"))); }