Song uploads
Uploading songs is functional and does not use the song metadata for the filename or directory creation
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user