public override void MediaRemove(IMedia media) { ArchiveMedia m = (ArchiveMedia)media; m.MediaStatus = TMediaStatus.Deleted; m.IsVerified = false; m.Save(); base.MediaRemove(media); }
public override IMedia CreateMedia(IMediaProperties mediaProperties) { string path = Path.Combine(Folder, GetCurrentFolder()); var result = new ArchiveMedia(this, mediaProperties.MediaGuid, 0) { FullPath = Path.Combine(path, FileUtils.GetUniqueFileName(path, mediaProperties.FileName)), }; result.CloneMediaProperties(mediaProperties); return(result); }
private static ArchiveMedia _readArchiveMedia(MySqlDataReader dataReader, ArchiveDirectory dir) { byte typVideo = dataReader.IsDBNull(dataReader.GetOrdinal("typVideo")) ? (byte)0 : dataReader.GetByte("typVideo"); ArchiveMedia media = new ArchiveMedia() { idPersistentMedia = dataReader.GetUInt64("idArchiveMedia"), Directory = dir, }; _mediaReadFields(dataReader, media); ThreadPool.QueueUserWorkItem(o => media.Verify()); return media; }
public ArchiveMedia GetArchiveMedia(Media media, bool searchExisting = true) { ArchiveMedia result = null; if (searchExisting) result = this.DbMediaFind(media); if (result == null) result = new ArchiveMedia() { _audioChannelMapping = media.AudioChannelMapping, _audioVolume = media.AudioVolume, _audioLevelIntegrated = media.AudioLevelIntegrated, _audioLevelPeak = media.AudioLevelPeak, _duration = media.Duration, _durationPlay = media.DurationPlay, _fileName = (media is IngestMedia) ? Path.GetFileNameWithoutExtension(media.FileName) + DefaultFileExtension(media.MediaType) : media.FileName, _fileSize = media.FileSize, _folder = GetCurrentFolder(), _lastUpdated = media.LastUpdated, _mediaName = media.MediaName, _mediaStatus = TMediaStatus.Required, _tCStart = media.TCStart, _tCPlay = media.TCPlay, _videoFormat = media.VideoFormat, KillDate = (media is PersistentMedia) ? (media as PersistentMedia).KillDate : (media is IngestMedia ? media.LastUpdated + TimeSpan.FromDays(((IngestDirectory)media.Directory).MediaRetnentionDays) : default(DateTime)), idAux = (media is PersistentMedia) ? (media as PersistentMedia).idAux : string.Empty, idFormat = (media is PersistentMedia) ? (media as PersistentMedia).idFormat : 0L, idProgramme = (media is PersistentMedia) ? (media as PersistentMedia).idProgramme : 0L, MediaType = (media.MediaType == TMediaType.Unknown) ? (StillFileTypes.Any(ve => ve == Path.GetExtension(media.FullPath).ToLowerInvariant()) ? TMediaType.Still : TMediaType.Movie) : media.MediaType, _mediaCategory = media.MediaCategory, _parental = media.Parental, _mediaGuid = media.MediaGuid, OriginalMedia = media, Directory = this, }; return result; }
public void ArchiveRestore(ArchiveMedia media, ServerMedia mediaPGM, bool toTop) { if (mediaPGM != null) _archiveCopy(media, mediaPGM, false, toTop); }