Added base classes to encapsulate metadata in media
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using Aurora.Backend.Models;
|
||||
using Aurora.Backend.Models.Media;
|
||||
using Aurora.Backend.Utils;
|
||||
|
||||
namespace Aurora.Backend.Services
|
||||
@ -14,7 +14,6 @@ namespace Aurora.Backend.Services
|
||||
private string _extensions = ".wav,.mp3,.aiff,.flac,.m4a,.m4b,.wma";
|
||||
private Dictionary<string, BaseMedia> _library;
|
||||
|
||||
|
||||
#endregion Fields
|
||||
|
||||
public LibraryService()
|
||||
@ -50,13 +49,7 @@ namespace Aurora.Backend.Services
|
||||
{
|
||||
TagLib.File tagFile = TagLib.File.Create(file.FullName);
|
||||
|
||||
BaseMedia song = new LocalAudio(file)
|
||||
{
|
||||
Title = tagFile.Tag.Title,
|
||||
Album = tagFile.Tag.Album,
|
||||
Artist = tagFile.Tag.FirstAlbumArtist
|
||||
};
|
||||
|
||||
BaseMedia song = new LocalAudio(file);
|
||||
_library.Add(song.Id, song);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using Aurora.Backend.Models;
|
||||
using Aurora.Backend.Models.Media;
|
||||
using LibVLCSharp.Shared;
|
||||
|
||||
namespace Aurora.Backend.Services.PlayerService
|
||||
@ -54,10 +54,10 @@ namespace Aurora.Backend.Services.PlayerService
|
||||
/// </summary>
|
||||
public void Play()
|
||||
{
|
||||
PlaybackStateChanged.Invoke(this, new PlaybackStateChangedEventArgs(_state, PlaybackState.Playing));
|
||||
PlaybackState oldState = _state;
|
||||
_state = PlaybackState.Playing;
|
||||
_mediaPlayer.Play();
|
||||
|
||||
PlaybackStateChanged.Invoke(this, new PlaybackStateChangedEventArgs(oldState, _state));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -65,9 +65,10 @@ namespace Aurora.Backend.Services.PlayerService
|
||||
/// </summary>
|
||||
public void Pause()
|
||||
{
|
||||
PlaybackStateChanged.Invoke(this, new PlaybackStateChangedEventArgs(_state, PlaybackState.Buffering));
|
||||
PlaybackState oldState = _state;
|
||||
_state = PlaybackState.Buffering;
|
||||
_mediaPlayer.Pause();
|
||||
PlaybackStateChanged.Invoke(this, new PlaybackStateChangedEventArgs(oldState, _state));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -75,9 +76,10 @@ namespace Aurora.Backend.Services.PlayerService
|
||||
/// </summary>
|
||||
public void Stop()
|
||||
{
|
||||
PlaybackStateChanged.Invoke(this, new PlaybackStateChangedEventArgs(_state, PlaybackState.Stopped));
|
||||
PlaybackState oldState = _state;
|
||||
_state = PlaybackState.Stopped;
|
||||
_mediaPlayer.Stop();
|
||||
PlaybackStateChanged.Invoke(this, new PlaybackStateChangedEventArgs(oldState, _state));
|
||||
}
|
||||
|
||||
public void Enqueue(BaseMedia song)
|
||||
|
Reference in New Issue
Block a user