mirror of
https://github.com/ZetaKebab/MpcNET.git
synced 2025-07-01 16:47:37 +00:00
Decoders command + test. Still to Assert response depending on build server.
This commit is contained in:
36
LibMpc/Types/MpdDecoderPlugin.cs
Normal file
36
LibMpc/Types/MpdDecoderPlugin.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LibMpc.Types
|
||||
{
|
||||
public class MpdDecoderPlugin
|
||||
{
|
||||
public static readonly MpdDecoderPlugin Empty = new MpdDecoderPlugin(string.Empty);
|
||||
|
||||
private readonly IList<string> _suffixes = new List<string>();
|
||||
private readonly IList<string> _mediaTypes = new List<string>();
|
||||
|
||||
public MpdDecoderPlugin(string name)
|
||||
{
|
||||
name.CheckNotNull();
|
||||
|
||||
Name = name;
|
||||
IsInitialized = !string.IsNullOrEmpty(name);
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
public IEnumerable<string> Suffixes => _suffixes;
|
||||
public IEnumerable<string> MediaTypes => _mediaTypes;
|
||||
|
||||
internal bool IsInitialized { get; }
|
||||
|
||||
internal void AddSuffix(string suffix)
|
||||
{
|
||||
_suffixes.Add(suffix);
|
||||
}
|
||||
|
||||
internal void AddMediaType(string type)
|
||||
{
|
||||
_mediaTypes.Add(type);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,106 +1,106 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LibMpc.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// The MpdFile class contains all meta data for a file of the MPD.
|
||||
/// </summary>
|
||||
public class MpdFile
|
||||
{
|
||||
public static readonly MpdFile EmptyFile = new MpdFile(string.Empty);
|
||||
|
||||
private const string TagTime = "Time";
|
||||
private const string TagArtist = "Artist";
|
||||
private const string TagAlbum = "Album";
|
||||
private const string TagTitle = "Title";
|
||||
private const string TagTrack = "Track";
|
||||
private const string TagName = "Name";
|
||||
private const string TagGenre = "Genre";
|
||||
private const string TagDate = "Date";
|
||||
private const string TagComposer = "Composer";
|
||||
private const string TagPerformer = "Performer";
|
||||
private const string TagComment = "Comment";
|
||||
private const string TagDisc = "Disc";
|
||||
private const string TagPos = "Pos";
|
||||
private const string TagId = "Id";
|
||||
|
||||
private readonly IDictionary<string, string> _unknownTags = new Dictionary<string, string>();
|
||||
|
||||
public MpdFile(string file)
|
||||
{
|
||||
File = file;
|
||||
IsInitialized = !string.IsNullOrEmpty(File);
|
||||
}
|
||||
|
||||
public string File { get; }
|
||||
public int Time { get; private set; } = -1;
|
||||
public string Album { get; private set; } = string.Empty;
|
||||
public string Artist { get; private set; } = string.Empty;
|
||||
public string Title { get; private set; } = string.Empty;
|
||||
public string Track { get; private set; } = string.Empty;
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public string Genre { get; private set; } = string.Empty;
|
||||
public string Date { get; private set; } = string.Empty;
|
||||
public string Composer { get; private set; } = string.Empty;
|
||||
public string Performer { get; private set; } = string.Empty;
|
||||
public string Comment { get; private set; } = string.Empty;
|
||||
public int Disc { get; private set; } = -1;
|
||||
public int Pos { get; private set; } = -1;
|
||||
public int Id { get; private set; } = -1;
|
||||
public IDictionary<string, string> UnknownTags => _unknownTags;
|
||||
|
||||
internal bool IsInitialized { get; }
|
||||
|
||||
internal void AddTag(string tag, string value)
|
||||
{
|
||||
switch (tag)
|
||||
{
|
||||
case TagTime:
|
||||
Time = int.Parse(value);
|
||||
break;
|
||||
case TagArtist:
|
||||
Artist = value;
|
||||
break;
|
||||
case TagAlbum:
|
||||
Album = value;
|
||||
break;
|
||||
case TagTitle:
|
||||
Title = value;
|
||||
break;
|
||||
case TagTrack:
|
||||
Track = value;
|
||||
break;
|
||||
case TagName:
|
||||
Name = value;
|
||||
break;
|
||||
case TagGenre:
|
||||
Genre = value;
|
||||
break;
|
||||
case TagDate:
|
||||
Date = value;
|
||||
break;
|
||||
case TagComposer:
|
||||
Composer = value;
|
||||
break;
|
||||
case TagPerformer:
|
||||
Performer = value;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LibMpc.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// The MpdFile class contains all meta data for a file of the MPD.
|
||||
/// </summary>
|
||||
public class MpdFile
|
||||
{
|
||||
public static readonly MpdFile EmptyFile = new MpdFile(string.Empty);
|
||||
|
||||
private const string TagTime = "Time";
|
||||
private const string TagArtist = "Artist";
|
||||
private const string TagAlbum = "Album";
|
||||
private const string TagTitle = "Title";
|
||||
private const string TagTrack = "Track";
|
||||
private const string TagName = "Name";
|
||||
private const string TagGenre = "Genre";
|
||||
private const string TagDate = "Date";
|
||||
private const string TagComposer = "Composer";
|
||||
private const string TagPerformer = "Performer";
|
||||
private const string TagComment = "Comment";
|
||||
private const string TagDisc = "Disc";
|
||||
private const string TagPos = "Pos";
|
||||
private const string TagId = "Id";
|
||||
|
||||
private readonly IDictionary<string, string> _unknownTags = new Dictionary<string, string>();
|
||||
|
||||
public MpdFile(string file)
|
||||
{
|
||||
File = file;
|
||||
IsInitialized = !string.IsNullOrEmpty(File);
|
||||
}
|
||||
|
||||
public string File { get; }
|
||||
public int Time { get; private set; } = -1;
|
||||
public string Album { get; private set; } = string.Empty;
|
||||
public string Artist { get; private set; } = string.Empty;
|
||||
public string Title { get; private set; } = string.Empty;
|
||||
public string Track { get; private set; } = string.Empty;
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public string Genre { get; private set; } = string.Empty;
|
||||
public string Date { get; private set; } = string.Empty;
|
||||
public string Composer { get; private set; } = string.Empty;
|
||||
public string Performer { get; private set; } = string.Empty;
|
||||
public string Comment { get; private set; } = string.Empty;
|
||||
public int Disc { get; private set; } = -1;
|
||||
public int Pos { get; private set; } = -1;
|
||||
public int Id { get; private set; } = -1;
|
||||
public IDictionary<string, string> UnknownTags => _unknownTags;
|
||||
|
||||
internal bool IsInitialized { get; }
|
||||
|
||||
internal void AddTag(string tag, string value)
|
||||
{
|
||||
switch (tag)
|
||||
{
|
||||
case TagTime:
|
||||
Time = int.Parse(value);
|
||||
break;
|
||||
case TagComment:
|
||||
Comment = value;
|
||||
case TagArtist:
|
||||
Artist = value;
|
||||
break;
|
||||
case TagDisc:
|
||||
Disc = int.Parse(value);
|
||||
case TagAlbum:
|
||||
Album = value;
|
||||
break;
|
||||
case TagPos:
|
||||
Pos = int.Parse(value);
|
||||
case TagTitle:
|
||||
Title = value;
|
||||
break;
|
||||
case TagId:
|
||||
Id = int.Parse(value);
|
||||
case TagTrack:
|
||||
Track = value;
|
||||
break;
|
||||
default:
|
||||
_unknownTags.Add(tag, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case TagName:
|
||||
Name = value;
|
||||
break;
|
||||
case TagGenre:
|
||||
Genre = value;
|
||||
break;
|
||||
case TagDate:
|
||||
Date = value;
|
||||
break;
|
||||
case TagComposer:
|
||||
Composer = value;
|
||||
break;
|
||||
case TagPerformer:
|
||||
Performer = value;
|
||||
break;
|
||||
case TagComment:
|
||||
Comment = value;
|
||||
break;
|
||||
case TagDisc:
|
||||
Disc = int.Parse(value);
|
||||
break;
|
||||
case TagPos:
|
||||
Pos = int.Parse(value);
|
||||
break;
|
||||
case TagId:
|
||||
Id = int.Parse(value);
|
||||
break;
|
||||
default:
|
||||
_unknownTags.Add(tag, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user