< Summary - Jellyfin

Information
Class: Jellyfin.Data.Entities.Libraries.MediaFile
Assembly: Jellyfin.Data
File(s): /srv/git/jellyfin/Jellyfin.Data/Entities/Libraries/MediaFile.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 7
Coverable lines: 7
Total lines: 72
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
OnSavingChanges()100%210%

File(s)

/srv/git/jellyfin/Jellyfin.Data/Entities/Libraries/MediaFile.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.ComponentModel.DataAnnotations;
 4using System.ComponentModel.DataAnnotations.Schema;
 5using Jellyfin.Data.Enums;
 6using Jellyfin.Data.Interfaces;
 7
 8namespace Jellyfin.Data.Entities.Libraries
 9{
 10    /// <summary>
 11    /// An entity representing a file on disk.
 12    /// </summary>
 13    public class MediaFile : IHasConcurrencyToken
 14    {
 15        /// <summary>
 16        /// Initializes a new instance of the <see cref="MediaFile"/> class.
 17        /// </summary>
 18        /// <param name="path">The path relative to the LibraryRoot.</param>
 19        /// <param name="kind">The file kind.</param>
 20        public MediaFile(string path, MediaFileKind kind)
 21        {
 022            ArgumentException.ThrowIfNullOrEmpty(path);
 23
 024            Path = path;
 025            Kind = kind;
 26
 027            MediaFileStreams = new HashSet<MediaFileStream>();
 028        }
 29
 30        /// <summary>
 31        /// Gets the id.
 32        /// </summary>
 33        /// <remarks>
 34        /// Identity, Indexed, Required.
 35        /// </remarks>
 36        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
 37        public int Id { get; private set; }
 38
 39        /// <summary>
 40        /// Gets or sets the path relative to the library root.
 41        /// </summary>
 42        /// <remarks>
 43        /// Required, Max length = 65535.
 44        /// </remarks>
 45        [MaxLength(65535)]
 46        [StringLength(65535)]
 47        public string Path { get; set; }
 48
 49        /// <summary>
 50        /// Gets or sets the kind of media file.
 51        /// </summary>
 52        /// <remarks>
 53        /// Required.
 54        /// </remarks>
 55        public MediaFileKind Kind { get; set; }
 56
 57        /// <inheritdoc />
 58        [ConcurrencyCheck]
 59        public uint RowVersion { get; private set; }
 60
 61        /// <summary>
 62        /// Gets a collection containing the streams in this file.
 63        /// </summary>
 64        public virtual ICollection<MediaFileStream> MediaFileStreams { get; private set; }
 65
 66        /// <inheritdoc />
 67        public void OnSavingChanges()
 68        {
 069            RowVersion++;
 070        }
 71    }
 72}