Tricky implementing taglib's APIC extracting/saving feature, but I got it. Left some TODO's on where to pick up #56

This commit is contained in:
kdeng00
2019-08-11 17:51:42 -04:00
parent 023c467a9d
commit 51d40f270d
11 changed files with 183 additions and 68 deletions
+10
View File
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.InteropServices;
using System.Text;
using Newtonsoft.Json;
@@ -21,4 +22,13 @@ namespace Icarus.Models
[JsonIgnore]
public List<Song> Songs { get; set; }
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CovArt
{
public int CoverArtId;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string SongTitle;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string ImagePath;
}
}
+56 -37
View File
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.InteropServices;
using Newtonsoft.Json;
@@ -8,47 +9,65 @@ namespace Icarus.Models
public class Song
{
[JsonProperty("id")]
public int Id { get; set; }
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("album")]
public string AlbumTitle { get; set; }
[JsonProperty("artist")]
public string Artist { get; set; }
[JsonProperty("year")]
public int? Year { get; set; }
[JsonProperty("genre")]
public string Genre { get; set; }
[JsonProperty("duration")]
public int Duration { get; set; }
[JsonProperty("filename")]
public string Filename { get; set; }
[JsonProperty("song_path")]
public string SongPath { get; set; }
public int Id { get; set; }
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("album")]
public string AlbumTitle { get; set; }
[JsonProperty("artist")]
public string Artist { get; set; }
[JsonProperty("year")]
public int? Year { get; set; }
[JsonProperty("genre")]
public string Genre { get; set; }
[JsonProperty("duration")]
public int Duration { get; set; }
[JsonProperty("filename")]
public string Filename { get; set; }
[JsonProperty("song_path")]
public string SongPath { get; set; }
[JsonIgnore]
public Album Album { get; set; }
[JsonIgnore]
public int? AlbumId { get; set; }
[JsonIgnore]
public Album Album { get; set; }
[JsonIgnore]
public int? AlbumId { get; set; }
[JsonIgnore]
public Artist SongArtist { get; set; }
[JsonIgnore]
public int? ArtistId { get; set; }
[JsonIgnore]
public Artist SongArtist { get; set; }
[JsonIgnore]
public int? ArtistId { get; set; }
[JsonIgnore]
public Genre SongGenre { get; set; }
[JsonIgnore]
public int? GenreId { get; set; }
[JsonIgnore]
public Genre SongGenre { get; set; }
[JsonIgnore]
public int? GenreId { get; set; }
[JsonIgnore]
public Year SongYear { get; set; }
[JsonIgnore]
public int? YearId { get; set; }
[JsonIgnore]
public Year SongYear { get; set; }
[JsonIgnore]
public int? YearId { get; set; }
[JsonIgnore]
public CoverArt SongCoverArt { get; set; }
[JsonIgnore]
public int? CoverArtId { get; set; }
[JsonIgnore]
public CoverArt SongCoverArt { get; set; }
[JsonIgnore]
public int? CoverArtId { get; set; }
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct Sng
{
public int Id;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string Title;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string Artist;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string Album;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string Genre;
public int Year;
public int Duration;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string SongPath;
}
}