Song uploads

Uploading songs is functional and does not use the song metadata for the filename or directory creation
This commit is contained in:
kdeng00
2021-12-25 21:36:42 -05:00
parent 64e6f33d7c
commit b529731c95
9 changed files with 105 additions and 77 deletions
+3
View File
@@ -13,10 +13,13 @@ namespace Icarus.Models
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("album_artist")]
[Column("Artist")]
public string AlbumArtist { get; set; }
[JsonProperty("song_count")]
[NotMapped]
public int SongCount { get; set; }
[JsonProperty("year")]
public int Year { get; set; }
[JsonIgnore]
[NotMapped]
+1
View File
@@ -11,6 +11,7 @@ namespace Icarus.Models
[JsonProperty("artist_id")]
public int ArtistID { get; set; }
[JsonProperty("name")]
[Column("Artist")]
public string Name { get; set; }
[JsonProperty("song_count")]
[NotMapped]
+21 -2
View File
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
@@ -9,16 +10,34 @@ namespace Icarus.Models
{
public class CoverArt
{
#region Properties
[JsonProperty("cover_art_id")]
public int CoverArtID { get; set; }
[JsonProperty("title")]
public string SongTitle { get; set; }
[JsonIgnore]
public string ImagePath { get; set; }
[JsonProperty("song_id")]
public int SongId { get; set; }
[JsonIgnore]
[NotMapped]
public int SongID { get; set; }
[JsonIgnore]
[NotMapped]
public List<Song> Songs { get; set; }
#endregion
#region Methods
public string GenerateFilename(int flag)
{
const int length = 25;
const string chars = "ABCDEF0123456789";
var random = new Random();
var filename = new string(Enumerable.Repeat(chars, length).Select(s =>
s[random.Next(s.Length)]).ToArray());
var extension = ".mp3";
return (flag == 0) ? filename : $"{filename}{extension}";
}
#endregion
}
}
+1
View File
@@ -11,6 +11,7 @@ namespace Icarus.Models
[JsonProperty("genre_id")]
public int GenreID { get; set; }
[JsonProperty("genre")]
[Column("Category")]
public string GenreName { get; set; }
[JsonProperty("song_count")]
[NotMapped]
+13
View File
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using Newtonsoft.Json;
@@ -58,6 +59,18 @@ namespace Icarus.Models
return fullPath;
}
public string GenerateFilename()
{
const int length = 25;
const string chars = "ABCDEF0123456789";
var random = new Random();
var filename = new string(Enumerable.Repeat(chars, length).Select(s =>
s[random.Next(s.Length)]).ToArray());
var extension = ".mp3";
return $"{filename}{extension}";
}
#endregion
}
}