#5 basic view model for audio narrations get api

This commit is contained in:
Hamid Reza Mohammadi 2020-08-30 16:19:37 +04:30
parent 104a845fa2
commit 464f69feca
3 changed files with 389 additions and 0 deletions

View File

@ -89,6 +89,11 @@ namespace RMuseum.Models.GanjoorAudio
/// </remarks>
public string RemoteXMLFilePath { get { return $"/i/{SoundFilesFolder}/x/{FileNameWithoutExtension}.xml"; } }
/// <summary>
/// XML url
/// </summary>
public string XMLUrl { get { return $"https://i.ganjoor.net/{SoundFilesFolder}/x/{FileNameWithoutExtension}.xml"; } }
/// <summary>
/// Audio Title
/// </summary>

View File

@ -0,0 +1,214 @@
using RSecurityBackend.Models.Auth.ViewModels;
using System;
using System.Collections.Generic;
namespace RMuseum.Models.GanjoorAudio.ViewModels
{
/// <summary>
/// Poem Narration view model
/// </summary>
public class PoemNarrationViewModel
{
/// <summary>
/// constructor
/// </summary>
/// <param name="src"></param>
public PoemNarrationViewModel(PoemNarration src)
{
Id = src.Id;
Owner = new PublicRAppUser(src.Owner);
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;
List<AudioSyncStatus> lst = new List<AudioSyncStatus>();
foreach(AudioSyncStatus status in
new AudioSyncStatus[]
{
AudioSyncStatus.SynchronizedOrRejected,
AudioSyncStatus.NewItem,
AudioSyncStatus.MetadataChanged,
AudioSyncStatus.SoundFilesChanged,
AudioSyncStatus.XmlFileChanged,
AudioSyncStatus.Deleted
})
{
if(
src.AudioSyncStatus == (( (int)status )| src.AudioSyncStatus)
)
{
lst.Add(status);
}
}
AudioSyncStatusArray = lst.ToArray();
}
/// <summary>
/// Id
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Owner User
/// </summary>
public PublicRAppUser Owner { get; set; }
/// <summary>
/// Final data is actually exported to a MySQL database which this auto increment field is its key
/// </summary>
public int GanjoorAudioId { get; set; }
/// <summary>
/// Ganjoor Post Id
/// </summary>
public int GanjoorPostId { get; set; }
/// <summary>
/// This determines where an audio is displayed between a list of sounds related to a specfic poem
/// </summary>
public int AudioOrder { get; set; }
/// <summary>
/// Using this field content you would determine xml, mp3 and ogg file names
/// </summary>
public string FileNameWithoutExtension { get; set; }
/// <summary>
/// combining this with <see cref="FileNameWithoutExtension"/> + .ext would preduce relative path of sound files on our file server the full path would become [HOMEPath] + '/i/' + this value
/// </summary>
/// <sample>
/// "a2"
/// </sample>
/// <remarks>
/// 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
/// </remarks>
public string SoundFilesFolder { get; set; }
/// <summary>
/// MP3 File Path
/// </summary>
public string RemoteMp3FilePath { get { return $"/i/{SoundFilesFolder}/{FileNameWithoutExtension}.mp3"; } }
/// <summary>
/// MP3 url
/// </summary>
public string Mp3Url { get { return $"https://i.ganjoor.net/{SoundFilesFolder}/{FileNameWithoutExtension}.mp3"; } }
/// <summary>
/// OGG File Path
/// </summary>
public string RemoteOggFilePath { get { return $"/i/{SoundFilesFolder}/{FileNameWithoutExtension}.ogg"; } }
/// <summary>
/// OGG url
/// </summary>
public string OggUrl { get { return $"https://i.ganjoor.net/{SoundFilesFolder}/{FileNameWithoutExtension}.ogg"; } }
/// <summary>
/// This is also a legacy field
/// </summary>
/// <sample>
/// "/i/a2/x"
/// </sample>
/// <remarks>
/// 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
/// </remarks>
public string RemoteXMLFilePath { get { return $"/i/{SoundFilesFolder}/x/{FileNameWithoutExtension}.xml"; } }
/// <summary>
/// XML url
/// </summary>
public string XMLUrl { get { return $"https://i.ganjoor.net/{SoundFilesFolder}/x/{FileNameWithoutExtension}.xml"; } }
/// <summary>
/// Audio Title
/// </summary>
public string AudioTitle { get; set; }
/// <summary>
/// Audio Artist
/// </summary>
public string AudioArtist { get; set; }
/// <summary>
/// Audio Artist Url
/// </summary>
public string AudioArtistUrl { get; set; }
/// <summary>
/// Audio Source
/// </summary>
public string AudioSrc { get; set; }
/// <summary>
/// Audio Src Url
/// </summary>
public string AudioSrcUrl { get; set; }
/// <summary>
/// Legacy Audio Guid
/// </summary>
public Guid LegacyAudioGuid { get; set; }
/// <summary>
/// Audio File CheckSum
/// </summary>
public string Mp3FileCheckSum { get; set; }
/// <summary>
/// mp3 size in bytes
/// </summary>
public int Mp3SizeInBytes { get; set; }
/// <summary>
/// ogg size in bytes
/// </summary>
public int OggSizeInBytes { get; set; }
/// <summary>
/// Upload Date
/// </summary>
public DateTime UploadDate { get; set; }
/// <summary>
/// Review Date (Approve or Reject)
/// </summary>
public DateTime ReviewDate { get; set; }
/// <summary>
/// MP3 File local path on Windows Server (if item is not rejected probably it is not valid and it is deleted)
/// </summary>
public string LocalMp3FilePath { get; set; }
/// <summary>
/// XML File local path on Windows Server (if item is not rejected probably it is not valid and it is deleted)
/// </summary>
public string LocalXmlFilePath { get; set; }
/// <summary>
/// Value is one or a combination of <see cref="RMuseum.Models.GanjoorAudio.AudioSyncStatus"/>
/// </summary>
public AudioSyncStatus[] AudioSyncStatusArray { get; set; }
/// <summary>
/// Review Status
/// </summary>
public AudioReviewStatus ReviewStatus { get; set; }
}
}

View File

@ -1668,6 +1668,11 @@
https://github.com/ganjoor/ganjoor/blob/master/ganjoor/Audio%20Support/PoemAudioListProcessor.cs
</remarks>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.PoemNarration.XMLUrl">
<summary>
XML url
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.PoemNarration.AudioTitle">
<summary>
Audio Title
@ -1743,6 +1748,171 @@
Review Status
</summary>
</member>
<member name="T:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel">
<summary>
Poem Narration view model
</summary>
</member>
<member name="M:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.#ctor(RMuseum.Models.GanjoorAudio.PoemNarration)">
<summary>
constructor
</summary>
<param name="src"></param>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.Id">
<summary>
Id
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.Owner">
<summary>
Owner User
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.GanjoorAudioId">
<summary>
Final data is actually exported to a MySQL database which this auto increment field is its key
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.GanjoorPostId">
<summary>
Ganjoor Post Id
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.AudioOrder">
<summary>
This determines where an audio is displayed between a list of sounds related to a specfic poem
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.FileNameWithoutExtension">
<summary>
Using this field content you would determine xml, mp3 and ogg file names
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.SoundFilesFolder">
<summary>
combining this with <see cref="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.FileNameWithoutExtension"/> + .ext would preduce relative path of sound files on our file server the full path would become [HOMEPath] + '/i/' + this value
</summary>
<sample>
"a2"
</sample>
<remarks>
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
</remarks>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.RemoteMp3FilePath">
<summary>
MP3 File Path
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.Mp3Url">
<summary>
MP3 url
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.RemoteOggFilePath">
<summary>
OGG File Path
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.OggUrl">
<summary>
OGG url
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.RemoteXMLFilePath">
<summary>
This is also a legacy field
</summary>
<sample>
"/i/a2/x"
</sample>
<remarks>
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
</remarks>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.XMLUrl">
<summary>
XML url
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.AudioTitle">
<summary>
Audio Title
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.AudioArtist">
<summary>
Audio Artist
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.AudioArtistUrl">
<summary>
Audio Artist Url
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.AudioSrc">
<summary>
Audio Source
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.AudioSrcUrl">
<summary>
Audio Src Url
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.LegacyAudioGuid">
<summary>
Legacy Audio Guid
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.Mp3FileCheckSum">
<summary>
Audio File CheckSum
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.Mp3SizeInBytes">
<summary>
mp3 size in bytes
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.OggSizeInBytes">
<summary>
ogg size in bytes
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.UploadDate">
<summary>
Upload Date
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.ReviewDate">
<summary>
Review Date (Approve or Reject)
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.LocalMp3FilePath">
<summary>
MP3 File local path on Windows Server (if item is not rejected probably it is not valid and it is deleted)
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.LocalXmlFilePath">
<summary>
XML File local path on Windows Server (if item is not rejected probably it is not valid and it is deleted)
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.AudioSyncStatusArray">
<summary>
Value is one or a combination of <see cref="T:RMuseum.Models.GanjoorAudio.AudioSyncStatus"/>
</summary>
</member>
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.ReviewStatus">
<summary>
Review Status
</summary>
</member>
<member name="T:RMuseum.Models.GanjoorIntegration.GanjoorLink">
<summary>
ganjoor link for artifacts and items