using RMuseum.Models.Ganjoor;
using RSecurityBackend.Models.Auth.Db;
using RSecurityBackend.Models.Auth.ViewModels;
using System;
namespace RMuseum.Models.GanjoorAudio.ViewModels
{
///
/// Poem Narration view model
///
public class RecitationViewModel
{
///
/// parameterless constructor for deserialization support
///
public RecitationViewModel()
{
}
///
/// constructor
///
///
///
///
///
public RecitationViewModel(Recitation src, RAppUser appUser, GanjoorPoem poem, string mistake)
{
Id = src.Id;
Owner = new PublicRAppUser()
{
Id = appUser.Id,
Username = appUser.UserName,
Email = appUser.Email,
FirstName = appUser.FirstName,
SurName = appUser.SurName,
PhoneNumber = appUser.PhoneNumber,
RImageId = appUser.RImageId,
Status = appUser.Status,
NickName = appUser.NickName,
Website = appUser.Website,
Bio = appUser.Bio,
EmailConfirmed = appUser.EmailConfirmed
};
GanjoorAudioId = src.GanjoorAudioId;
GanjoorPostId = src.GanjoorPostId;
AudioOrder = src.AudioOrder;
FileNameWithoutExtension = src.FileNameWithoutExtension;
SoundFilesFolder = src.SoundFilesFolder;
AudioTitle = src.AudioTitle;
AudioArtist = src.AudioArtist;
AudioArtistUrl = src.AudioArtistUrl;
AudioSrc = src.AudioSrc;
AudioSrcUrl = src.AudioSrcUrl;
LegacyAudioGuid = src.LegacyAudioGuid;
Mp3FileCheckSum = src.Mp3FileCheckSum;
Mp3SizeInBytes = src.Mp3SizeInBytes;
OggSizeInBytes = src.OggSizeInBytes;
LocalMp3FilePath = src.LocalMp3FilePath;
LocalXmlFilePath = src.LocalXmlFilePath;
ReviewStatus = src.ReviewStatus;
UploadDate = src.UploadDate;
FileLastUpdated = src.FileLastUpdated;
ReviewDate = src.ReviewDate;
if(poem != null)
{
PoemFullTitle = poem.FullTitle;
PoemFullUrl = poem.FullUrl;
}
AudioSyncStatus = src.AudioSyncStatus;
if (string.IsNullOrEmpty(mistake))
ReviewMsg = src.ReviewMsg;
else
ReviewMsg = mistake;
RecitationType = src.RecitationType;
InSyncWithText = src.InSyncWithText;
}
///
/// Id
///
public int Id { get; set; }
///
/// Owner User
///
public PublicRAppUser Owner { get; set; }
///
/// Final data is actually exported to a MySQL database which this auto increment field is its key
///
public int GanjoorAudioId { get; set; }
///
/// Ganjoor Post Id
///
public int GanjoorPostId { get; set; }
///
/// Poem Full Title
///
public string PoemFullTitle { get; set; }
///
/// Poem Full Url (without domain name)
///
public string PoemFullUrl { get; set; }
///
/// This determines where an audio is displayed between a list of sounds related to a specfic poem
///
public int AudioOrder { get; set; }
///
/// Using this field content you would determine xml, mp3 and ogg file names
///
public string FileNameWithoutExtension { get; set; }
///
/// combining this with + .ext would preduce relative path of sound files on our file server the full path would become [HOMEPath] + '/i/' + this value
///
///
/// "a2"
///
///
/// We had previously used different pathes because when a directory became overcrowded our connection time would increase unbearably due to IRAN internet problems, so it is sensible to store it per record and not as a global option value
///
public string SoundFilesFolder { get; set; }
///
/// MP3 File Path
///
public string RemoteMp3FilePath { get { return $"/i/{SoundFilesFolder}/{FileNameWithoutExtension}.mp3"; } }
///
/// MP3 url
///
public string Mp3Url { get { return $"https://i.ganjoor.net/{SoundFilesFolder}/{FileNameWithoutExtension}.mp3"; } }
///
/// OGG File Path
///
public string RemoteOggFilePath { get { return $"/i/{SoundFilesFolder}/{FileNameWithoutExtension}.ogg"; } }
///
/// OGG url
///
public string OggUrl { get { return $"https://i.ganjoor.net/{SoundFilesFolder}/{FileNameWithoutExtension}.ogg"; } }
///
/// This is also a legacy field
///
///
/// "/i/a2/x"
///
///
/// XML Schema is defined based on Desktop Ganjoor (https://github.com/ganjoor/ganjoor) code, for
/// more information take a look at this code:
/// https://github.com/ganjoor/ganjoor/blob/master/ganjoor/Audio%20Support/PoemAudioListProcessor.cs
///
public string RemoteXMLFilePath { get { return $"/i/{SoundFilesFolder}/x/{FileNameWithoutExtension}.xml"; } }
///
/// XML url
///
public string XMLUrl { get { return $"https://i.ganjoor.net/{SoundFilesFolder}/x/{FileNameWithoutExtension}.xml"; } }
///
/// Audio Title
///
public string AudioTitle { get; set; }
///
/// Audio Artist
///
public string AudioArtist { get; set; }
///
/// Audio Artist Url
///
public string AudioArtistUrl { get; set; }
///
/// Audio Source
///
public string AudioSrc { get; set; }
///
/// Audio Src Url
///
public string AudioSrcUrl { get; set; }
///
/// Legacy Audio Guid
///
public Guid LegacyAudioGuid { get; set; }
///
/// Audio File CheckSum
///
public string Mp3FileCheckSum { get; set; }
///
/// mp3 size in bytes
///
public int Mp3SizeInBytes { get; set; }
///
/// ogg size in bytes
///
public int OggSizeInBytes { get; set; }
///
/// Upload Date
///
public DateTime UploadDate { get; set; }
///
/// File Last Updated
///
public DateTime FileLastUpdated { get; set; }
///
/// Review Date (Approve or Reject)
///
public DateTime ReviewDate { get; set; }
///
/// MP3 File local path on Windows Server (if item is not rejected probably it is not valid and it is deleted)
///
public string LocalMp3FilePath { get; set; }
///
/// XML File local path on Windows Server (if item is not rejected probably it is not valid and it is deleted)
///
public string LocalXmlFilePath { get; set; }
///
/// Value is one or a combination of
///
public AudioSyncStatus AudioSyncStatus { get; set; }
///
/// Review Status
///
public AudioReviewStatus ReviewStatus { get; set; }
///
/// Review Message
///
public string ReviewMsg { get; set; }
///
/// Recitation Type
///
public RecitationType RecitationType { get; set; }
///
/// in sync with text
///
public bool InSyncWithText { get; set; }
}
}