< Summary - Jellyfin

Information
Class: MediaBrowser.Controller.Entities.MusicVideo
Assembly: MediaBrowser.Controller
File(s): /srv/git/jellyfin/MediaBrowser.Controller/Entities/MusicVideo.cs
Line coverage
14%
Covered lines: 3
Uncovered lines: 18
Coverable lines: 21
Total lines: 75
Line coverage: 14.2%
Branch coverage
0%
Covered branches: 0
Total branches: 8
Branch coverage: 0%
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%11100%
GetBlockUnratedType()100%210%
GetLookupInfo()100%210%
BeforeMetadataRefresh(...)0%7280%

File(s)

/srv/git/jellyfin/MediaBrowser.Controller/Entities/MusicVideo.cs

#LineLine coverage
 1#nullable disable
 2
 3#pragma warning disable CS1591
 4
 5using System;
 6using System.Collections.Generic;
 7using System.Text.Json.Serialization;
 8using Jellyfin.Data.Enums;
 9using MediaBrowser.Controller.Entities.Audio;
 10using MediaBrowser.Controller.Providers;
 11
 12namespace MediaBrowser.Controller.Entities
 13{
 14    public class MusicVideo : Video, IHasArtist, IHasMusicGenres, IHasLookupInfo<MusicVideoInfo>
 15    {
 316        public MusicVideo()
 17        {
 318            Artists = Array.Empty<string>();
 319        }
 20
 21        /// <inheritdoc />
 22        [JsonIgnore]
 23        public IReadOnlyList<string> Artists { get; set; }
 24
 25        public override UnratedItem GetBlockUnratedType()
 26        {
 027            return UnratedItem.Music;
 28        }
 29
 30        public MusicVideoInfo GetLookupInfo()
 31        {
 032            var info = GetItemLookupInfo<MusicVideoInfo>();
 33
 034            info.Artists = Artists;
 35
 036            return info;
 37        }
 38
 39        public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
 40        {
 041            var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
 42
 043            if (!ProductionYear.HasValue)
 44            {
 045                var info = LibraryManager.ParseName(Name);
 46
 047                var yearInName = info.Year;
 48
 049                if (yearInName.HasValue)
 50                {
 051                    ProductionYear = yearInName;
 052                    hasChanges = true;
 53                }
 54                else
 55                {
 56                    // Try to get the year from the folder name
 057                    if (!IsInMixedFolder)
 58                    {
 059                        info = LibraryManager.ParseName(System.IO.Path.GetFileName(ContainingFolderPath));
 60
 061                        yearInName = info.Year;
 62
 063                        if (yearInName.HasValue)
 64                        {
 065                            ProductionYear = yearInName;
 066                            hasChanges = true;
 67                        }
 68                    }
 69                }
 70            }
 71
 072            return hasChanges;
 73        }
 74    }
 75}