mirror of
https://github.com/sphildreth/roadie
synced 2024-11-22 12:13:10 +00:00
WIP
This commit is contained in:
parent
7d078a0920
commit
c25103edfb
33 changed files with 2326 additions and 0 deletions
|
@ -0,0 +1,66 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class AlbumInfoXmlResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "albumInfo")]
|
||||
public albuminfo albumInfo { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class AlbumInfoJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public AlbumInfoResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class AlbumInfoResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "albumInfo")]
|
||||
public albuminfo albumInfo { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class albuminfo
|
||||
{
|
||||
[DataMember(Name = "notes")]
|
||||
[XmlTextAttribute()]
|
||||
public string notes { get; set; }
|
||||
|
||||
[DataMember(Name = "musicBrainzId")]
|
||||
[XmlElement(ElementName = "musicBrainzId")]
|
||||
public string musicBrainzId { get; set; }
|
||||
|
||||
[DataMember(Name = "lastFmUrl")]
|
||||
[XmlElement(ElementName = "lastFmUrl")]
|
||||
public string lastFmUrl { get; set; }
|
||||
|
||||
[DataMember(Name = "smallImageUrl")]
|
||||
[XmlElement(ElementName = "smallImageUrl")]
|
||||
public string smallImageUrl { get; set; }
|
||||
|
||||
[DataMember(Name = "mediumImageUrl")]
|
||||
[XmlElement(ElementName = "mediumImageUrl")]
|
||||
public string mediumImageUrl { get; set; }
|
||||
|
||||
[DataMember(Name = "largeImageUrl")]
|
||||
[XmlElement(ElementName = "largeImageUrl")]
|
||||
public string largeImageUrl { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
198
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Album.cs
Normal file
198
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Album.cs
Normal file
|
@ -0,0 +1,198 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
[DebuggerDisplay("Title [{title}], PlayCount [{playCount}]")]
|
||||
public class album
|
||||
{
|
||||
/// <summary>
|
||||
/// Database ID
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public int ID { get; set; }
|
||||
|
||||
[DataMember(Name = "id")]
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string id { get; set; }
|
||||
|
||||
[DataMember(Name = "userRating")]
|
||||
[XmlAttribute(AttributeName = "userRating")]
|
||||
public short userRating { get; set; }
|
||||
|
||||
[DataMember(Name = "averageRating")]
|
||||
[XmlAttribute(AttributeName = "averageRating")]
|
||||
public short averageRating { get; set; }
|
||||
|
||||
[DataMember(Name = "playCount")]
|
||||
[XmlAttribute(AttributeName = "playCount")]
|
||||
public int playCount { get; set; }
|
||||
|
||||
[DataMember(Name = "parent")]
|
||||
[XmlAttribute(AttributeName = "parent")]
|
||||
public string parent { get; set; }
|
||||
|
||||
[DataMember(Name = "title")]
|
||||
[XmlAttribute(AttributeName = "title")]
|
||||
public string title { get; set; }
|
||||
|
||||
[DataMember(Name = "genre")]
|
||||
[XmlAttribute(AttributeName = "genre")]
|
||||
public string genre { get; set; }
|
||||
|
||||
[DataMember(Name = "album")]
|
||||
[XmlAttribute(AttributeName = "album")]
|
||||
public string albumTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.title;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(Name = "year")]
|
||||
[XmlAttribute(AttributeName = "year")]
|
||||
public int year
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.yearDateTime.HasValue)
|
||||
{
|
||||
return this.yearDateTime.Value.Year;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public DateTime? yearDateTime { get; set; }
|
||||
|
||||
[DataMember(Name = "isDir")]
|
||||
[XmlAttribute(AttributeName = "isDir")]
|
||||
public bool isDir { get; set; }
|
||||
|
||||
[DataMember(Name = "coverArt")]
|
||||
[XmlAttribute(AttributeName = "coverArt")]
|
||||
public string coverArt { get; set; }
|
||||
|
||||
[DataMember(Name = "songCount")]
|
||||
[XmlAttribute(AttributeName = "songCount")]
|
||||
public int songCount { get; set; }
|
||||
|
||||
[DataMember(Name = "created")]
|
||||
[XmlAttribute(AttributeName = "created")]
|
||||
public string created
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.createdDateTime.HasValue)
|
||||
{
|
||||
return this.createdDateTime.Value.ToString("s");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public DateTime? createdDateTime { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public DateTime? lastPlayed { get; set; }
|
||||
|
||||
[DataMember(Name = "starred")]
|
||||
[XmlAttribute(AttributeName = "starred")]
|
||||
public string starred
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.starredDateTime.HasValue)
|
||||
{
|
||||
return this.starredDateTime.Value.ToString("s");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShouldSerializestarred()
|
||||
{
|
||||
return this.starredDateTime.HasValue;
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public DateTime? starredDateTime { get; set; }
|
||||
|
||||
[DataMember(Name = "artist")]
|
||||
[XmlAttribute(AttributeName = "artist")]
|
||||
public string artist { get; set; }
|
||||
|
||||
[DataMember(Name = "artistId")]
|
||||
[XmlAttribute(AttributeName = "artistId")]
|
||||
public string artistId { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public int artistID { get; set; }
|
||||
|
||||
[DataMember(Name = "duration")]
|
||||
[XmlAttribute(AttributeName = "duration")]
|
||||
public int duration
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.durationMilliseconds > 0)
|
||||
{
|
||||
var contentDurationTimeSpan = TimeSpan.FromMilliseconds((double) (this.durationMilliseconds ?? 0));
|
||||
return (int) contentDurationTimeSpan.TotalSeconds;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public int? durationMilliseconds { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public int? listNumber { get; set; }
|
||||
|
||||
[DataMember(Name = "song")]
|
||||
[XmlElement(ElementName = "song")]
|
||||
public song[] song { get; set; }
|
||||
|
||||
public bool ShouldSerializesong()
|
||||
{
|
||||
return this.song != null;
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public string notes { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public string musicBrainzId { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public string lastFMUrl { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public string smallImageUrl { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public string mediumImageUrl { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public string largeImageUrl { get; set; }
|
||||
}
|
||||
}
|
101
RoadieLibrary/Models/ThirdPartyApi/Subsonic/AlbumResponse.cs
Normal file
101
RoadieLibrary/Models/ThirdPartyApi/Subsonic/AlbumResponse.cs
Normal file
|
@ -0,0 +1,101 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[Serializable]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class AlbumListXmlResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "albumList")]
|
||||
public AlbumList albumList { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class AlbumXmlResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "album")]
|
||||
public album album { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class AlbumListJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public AlbumListJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class AlbumListJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "albumList")]
|
||||
public AlbumList albumList { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class AlbumList
|
||||
{
|
||||
[DataMember(Name = "album")]
|
||||
[XmlElement(ElementName = "album")]
|
||||
public album[] album { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
[DataContract]
|
||||
public class AlbumJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public AlbumJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class AlbumJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "album")]
|
||||
public album album { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//public class Song
|
||||
//{
|
||||
// public string id { get; set; }
|
||||
// public string parent { get; set; }
|
||||
// public bool isDir { get; set; }
|
||||
// public string title { get; set; }
|
||||
// public string album { get; set; }
|
||||
// public string artist { get; set; }
|
||||
// public int track { get; set; }
|
||||
// public int year { get; set; }
|
||||
// public string genre { get; set; }
|
||||
// public string coverArt { get; set; }
|
||||
// public int size { get; set; }
|
||||
// public string contentType { get; set; }
|
||||
// public string suffix { get; set; }
|
||||
// public int duration { get; set; }
|
||||
// public int bitRate { get; set; }
|
||||
// public string path { get; set; }
|
||||
// public int userRating { get; set; }
|
||||
// public int averageRating { get; set; }
|
||||
// public int playCount { get; set; }
|
||||
// public DateTime created { get; set; }
|
||||
// public DateTime starred { get; set; }
|
||||
// public string albumId { get; set; }
|
||||
// public string artistId { get; set; }
|
||||
// public string type { get; set; }
|
||||
//}
|
||||
|
||||
|
||||
}
|
98
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Artist.cs
Normal file
98
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Artist.cs
Normal file
|
@ -0,0 +1,98 @@
|
|||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
public class artist
|
||||
{
|
||||
/// <summary>
|
||||
/// Database ID
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public int ID { get; set; }
|
||||
|
||||
[DataMember(Name = "id")]
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string id { get; set; }
|
||||
|
||||
[DataMember(Name = "name")]
|
||||
[XmlAttribute(AttributeName = "name")]
|
||||
public string name { get; set; }
|
||||
|
||||
[DataMember(Name = "sortname")]
|
||||
[XmlAttribute(AttributeName = "sortname")]
|
||||
public string sortname { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public string biography { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public string musicBrainzId { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public string lastFMUrl { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public string smallImageUrl { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public string mediumImageUrl { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public string largeImageUrl { get; set; }
|
||||
|
||||
[DataMember(Name = "genre")]
|
||||
[XmlAttribute(AttributeName = "genre")]
|
||||
public string genre { get; set; }
|
||||
|
||||
[DataMember(Name = "starred")]
|
||||
[XmlAttribute(AttributeName = "starred")]
|
||||
public string starred
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.starredDateTime.HasValue)
|
||||
{
|
||||
return this.starredDateTime.Value.ToString("s");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShouldSerializestarred()
|
||||
{
|
||||
return this.starredDateTime.HasValue;
|
||||
}
|
||||
|
||||
[DataMember(Name = "coverArt")]
|
||||
[XmlAttribute(AttributeName = "coverArt")]
|
||||
public string coverArt { get; set; }
|
||||
|
||||
[DataMember(Name = "albumCount")]
|
||||
[XmlAttribute(AttributeName = "albumCount")]
|
||||
public int albumCount { get; set; }
|
||||
|
||||
[DataMember(Name = "userRating")]
|
||||
[XmlAttribute(AttributeName = "userRating")]
|
||||
public short userRating { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public DateTime? starredDateTime { get; set; }
|
||||
[XmlIgnore]
|
||||
public DateTime? createdDateTime { get; set; }
|
||||
|
||||
[DataMember(Name = "album")]
|
||||
[XmlElement(ElementName = "album")]
|
||||
public album[] album { get; set; }
|
||||
|
||||
public bool ShouldSerializealbum()
|
||||
{
|
||||
return this.album != null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
using System.Runtime.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class ArtistInfo2XmlResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "artistInfo2")]
|
||||
public artistinfo2 artistInfo2 { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class ArtistInfo2JsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public ArtistInfo2Response subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class ArtistInfo2Response : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "artistInfo2")]
|
||||
public artistinfo2 artistInfo2 { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class artistinfo2
|
||||
{
|
||||
[DataMember(Name = "biography")]
|
||||
[XmlElement(ElementName = "biography")]
|
||||
public string biography { get; set; }
|
||||
|
||||
[DataMember(Name = "musicBrainzId")]
|
||||
[XmlElement(ElementName = "musicBrainzId")]
|
||||
public string musicBrainzId { get; set; }
|
||||
|
||||
[DataMember(Name = "lastFmUrl")]
|
||||
[XmlElement(ElementName = "lastFmUrl")]
|
||||
public string lastFmUrl { get; set; }
|
||||
|
||||
[DataMember(Name = "smallImageUrl")]
|
||||
[XmlElement(ElementName = "smallImageUrl")]
|
||||
public string smallImageUrl { get; set; }
|
||||
|
||||
[DataMember(Name = "mediumImageUrl")]
|
||||
[XmlElement(ElementName = "mediumImageUrl")]
|
||||
public string mediumImageUrl { get; set; }
|
||||
|
||||
[DataMember(Name = "largeImageUrl")]
|
||||
[XmlElement(ElementName = "largeImageUrl")]
|
||||
public string largeImageUrl { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class ArtistXmlResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "artist")]
|
||||
public artist artist { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class ArtistJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public ArtistResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class ArtistResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "artist")]
|
||||
public artist artist { get; set; }
|
||||
}
|
||||
}
|
26
RoadieLibrary/Models/ThirdPartyApi/Subsonic/BaseResponse.cs
Normal file
26
RoadieLibrary/Models/ThirdPartyApi/Subsonic/BaseResponse.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class BaseResponse
|
||||
{
|
||||
[DataMember(Name = "status")]
|
||||
[XmlAttribute(AttributeName = "status")]
|
||||
public string status { get; set; }
|
||||
|
||||
[DataMember(Name = "version")]
|
||||
[XmlAttribute(AttributeName = "version")]
|
||||
public string version { get; set; }
|
||||
|
||||
public BaseResponse()
|
||||
{
|
||||
this.status = "ok";
|
||||
this.version = Credentials.API_VERSION;
|
||||
}
|
||||
}
|
||||
}
|
59
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Child.cs
Normal file
59
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Child.cs
Normal file
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[Serializable]
|
||||
public class Child
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string id { get; set; }
|
||||
[XmlAttribute(AttributeName = "parent")]
|
||||
public string parent { get; set; }
|
||||
[XmlAttribute(AttributeName = "title")]
|
||||
public string title { get; set; }
|
||||
/// <summary>
|
||||
/// True when a Album
|
||||
/// </summary>
|
||||
[XmlAttribute(AttributeName = "isDir")]
|
||||
public string isDir { get; set; }
|
||||
[XmlAttribute(AttributeName = "album")]
|
||||
public string album { get; set; }
|
||||
[XmlAttribute(AttributeName = "artist")]
|
||||
public string artist { get; set; }
|
||||
[XmlAttribute(AttributeName = "track")]
|
||||
public string track { get; set; }
|
||||
[XmlAttribute(AttributeName = "year")]
|
||||
public string year { get; set; }
|
||||
[XmlAttribute(AttributeName = "genre")]
|
||||
public string genre { get; set; }
|
||||
[XmlAttribute(AttributeName = "coverArt")]
|
||||
public string coverArt { get; set; }
|
||||
[XmlAttribute(AttributeName = "size")]
|
||||
public string size { get; set; }
|
||||
[XmlAttribute(AttributeName = "contentType")]
|
||||
public string contentType { get; set; }
|
||||
[XmlAttribute(AttributeName = "transcodedContentType")]
|
||||
public string transcodedContentType { get; set; }
|
||||
[XmlAttribute(AttributeName = "suffix")]
|
||||
public string suffix { get; set; }
|
||||
[XmlAttribute(AttributeName = "transcodedSuffix")]
|
||||
public string transcodedSuffix { get; set; }
|
||||
[XmlAttribute(AttributeName = "duration")]
|
||||
public string duration { get; set; }
|
||||
[XmlAttribute(AttributeName = "bitRate")]
|
||||
public string bitRate { get; set; }
|
||||
[XmlAttribute(AttributeName = "path")]
|
||||
public string path { get; set; }
|
||||
|
||||
|
||||
public Child()
|
||||
{
|
||||
this.isDir = "false";
|
||||
}
|
||||
}
|
||||
}
|
35
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Credentials.cs
Normal file
35
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Credentials.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[Serializable]
|
||||
public class Credentials
|
||||
{
|
||||
public const string API_VERSION = "1.14.0";
|
||||
|
||||
public string version { get; set; }
|
||||
public string appName { get; set; }
|
||||
public string salt { get; set; }
|
||||
public string user { get; set; }
|
||||
//public string token
|
||||
//{
|
||||
// get { return _token; }
|
||||
// // set { _token = BitConverter.ToString(Encoding.UTF8.GetBytes(value)).Replace("-", ""); }
|
||||
|
||||
//}
|
||||
public string token { get; set; }
|
||||
|
||||
public Credentials(string version, string appName, string user, string salt, string token)
|
||||
{
|
||||
this.version = version;
|
||||
this.appName = appName;
|
||||
this.user = user;
|
||||
this.salt = salt;
|
||||
this.token = token;
|
||||
}
|
||||
}
|
||||
}
|
24
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Directory.cs
Normal file
24
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Directory.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[Serializable]
|
||||
public class Directory
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string id { get; set; }
|
||||
[XmlAttribute(AttributeName = "parent")]
|
||||
public string parent { get; set; }
|
||||
[XmlAttribute(AttributeName = "name")]
|
||||
public string name { get; set; }
|
||||
[XmlAttribute(AttributeName = "starred")]
|
||||
public string starred { get; set; }
|
||||
[XmlElement(ElementName = "child")]
|
||||
public Child[] child { get; set; }
|
||||
}
|
||||
}
|
67
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Entry.cs
Normal file
67
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Entry.cs
Normal file
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[Serializable]
|
||||
public class Entry
|
||||
{
|
||||
[XmlAttribute(AttributeName = "username")]
|
||||
public string username { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "minutesAgo")]
|
||||
public string minutesAgo { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "playerId")]
|
||||
public string playerId { get; set; }
|
||||
[XmlAttribute(AttributeName = "playerName")]
|
||||
public string playerName { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string id { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "parent")]
|
||||
public string parent { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "title")]
|
||||
public string title { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "isDir")]
|
||||
public string isDir { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "album")]
|
||||
public string album { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "artist")]
|
||||
public string artist { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "track")]
|
||||
public string track { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "year")]
|
||||
public string year { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "genre")]
|
||||
public string genre { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "coverArt")]
|
||||
public string coverArt { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "size")]
|
||||
public string size { get; set; }
|
||||
[XmlAttribute(AttributeName = "contentType")]
|
||||
public string contentType { get; set; }
|
||||
[XmlAttribute(AttributeName = "suffix")]
|
||||
public string suffix { get; set; }
|
||||
[XmlAttribute(AttributeName = "path")]
|
||||
public string path { get; set; }
|
||||
[XmlAttribute(AttributeName = "transcodedContentType")]
|
||||
public string transcodedContentType { get; set; }
|
||||
[XmlAttribute(AttributeName = "transcodedSuffix")]
|
||||
public string transcodedSuffix { get; set; }
|
||||
}
|
||||
}
|
86
RoadieLibrary/Models/ThirdPartyApi/Subsonic/ErrorCodes.cs
Normal file
86
RoadieLibrary/Models/ThirdPartyApi/Subsonic/ErrorCodes.cs
Normal file
|
@ -0,0 +1,86 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class ErrorXmlResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "error")]
|
||||
public error error { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class ErrorJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public ErrorJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
public class ErrorJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "error")]
|
||||
public error error { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public static class ErrorCodeHelper
|
||||
{
|
||||
public static error WrongUserNameOrPassword()
|
||||
{
|
||||
return ErrorCodeHelper.ErrorCodes().First(x => x.code == 40);
|
||||
}
|
||||
|
||||
public static error RequestedDataNotFound()
|
||||
{
|
||||
return ErrorCodeHelper.ErrorCodes().First(x => x.code == 70);
|
||||
}
|
||||
|
||||
public static error UserNotAuthorized()
|
||||
{
|
||||
return ErrorCodeHelper.ErrorCodes().First(x => x.code == 50);
|
||||
}
|
||||
|
||||
public static error GenericError()
|
||||
{
|
||||
return ErrorCodeHelper.ErrorCodes().First(x => x.code == 0);
|
||||
}
|
||||
|
||||
public static error RequiredParameterMissing()
|
||||
{
|
||||
return ErrorCodeHelper.ErrorCodes().First(x => x.code == 10);
|
||||
}
|
||||
|
||||
public static List<error> ErrorCodes()
|
||||
{
|
||||
return new List<error>
|
||||
{
|
||||
new error { code = 0, message = "A generic error." },
|
||||
new error { code = 10, message = "Required parameter is missing." },
|
||||
new error { code = 20, message = "Incompatible Subsonic REST protocol version. Client must upgrade." },
|
||||
new error { code = 30, message = "Incompatible Subsonic REST protocol version. Server must upgrade." },
|
||||
new error { code = 40, message = "Wrong username or password." },
|
||||
new error { code = 41, message = "Token authentication not supported for LDAP users." },
|
||||
new error { code = 50, message = "User is not authorized for the given operation." },
|
||||
new error { code = 60, message = "The trial period for the Subsonic server is over. Please upgrade to Subsonic Premium. Visit subsonic.org for details." },
|
||||
new error { code = 70, message = "The requested data was not found." }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class error
|
||||
{
|
||||
public int code { get; set; }
|
||||
public string message { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
56
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Genres.cs
Normal file
56
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Genres.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class GenresXMLResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "genres")]
|
||||
public genre[] genres { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class GenresJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public GenresJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class GenresJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "genres")]
|
||||
public Genres genres { get; set; }
|
||||
}
|
||||
|
||||
|
||||
[DataContract]
|
||||
public class Genres
|
||||
{
|
||||
[DataMember(Name = "genre")]
|
||||
[XmlElement(ElementName = "genre")]
|
||||
public genre[] genre { get; set; }
|
||||
}
|
||||
[DataContract]
|
||||
public class genre
|
||||
{
|
||||
[DataMember(Name = "songCount")]
|
||||
[XmlAttribute(AttributeName = "songCount")]
|
||||
public int songCount { get; set; }
|
||||
[DataMember(Name = "albumCount")]
|
||||
[XmlAttribute(AttributeName = "albumCount")]
|
||||
public int albumCount { get; set; }
|
||||
[DataMember(Name = "value")]
|
||||
[XmlText]
|
||||
public string value { get; set; }
|
||||
}
|
||||
}
|
94
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Indexes.cs
Normal file
94
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Indexes.cs
Normal file
|
@ -0,0 +1,94 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class IndexXMLResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "indexes")]
|
||||
public Indexes indexes { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class ArtistsXmlResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "artists")]
|
||||
public artists artists { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class IndexJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public IndexJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class IndexJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "indexes")]
|
||||
public Indexes indexes { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class ArtistsJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public ArtistsJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class ArtistsJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "artists")]
|
||||
public artists artists { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class artists
|
||||
{
|
||||
[DataMember(Name = "lastModified")]
|
||||
[XmlAttribute(AttributeName = "lastModified")]
|
||||
public string lastModified { get; set; }
|
||||
[DataMember(Name = "ignoredArticles")]
|
||||
[XmlAttribute(AttributeName = "ignoredArticles")]
|
||||
public string ignoredArticles { get; set; }
|
||||
[XmlElement(ElementName = "index")]
|
||||
[DataMember(Name = "index")]
|
||||
public Index[] index { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class Indexes
|
||||
{
|
||||
[DataMember(Name = "lastModified")]
|
||||
[XmlAttribute(AttributeName = "lastModified")]
|
||||
public string lastModified { get; set; }
|
||||
[DataMember(Name = "ignoredArticles")]
|
||||
[XmlAttribute(AttributeName = "ignoredArticles")]
|
||||
public string ignoredArticles { get; set; }
|
||||
[XmlElement(ElementName = "index")]
|
||||
[DataMember(Name = "index")]
|
||||
public Index[] index { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class Index
|
||||
{
|
||||
[DataMember(Name = "name")]
|
||||
[XmlAttribute(AttributeName = "name")]
|
||||
public string name { get; set; }
|
||||
[XmlElement(ElementName = "artist")]
|
||||
[DataMember(Name = "artist")]
|
||||
public artist[] artist { get; set; }
|
||||
}
|
||||
|
||||
}
|
37
RoadieLibrary/Models/ThirdPartyApi/Subsonic/License.cs
Normal file
37
RoadieLibrary/Models/ThirdPartyApi/Subsonic/License.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
public class License
|
||||
{
|
||||
[DataMember(Name = "valid")]
|
||||
[XmlAttribute(AttributeName = "valid")]
|
||||
public bool valid { get; set; }
|
||||
[DataMember(Name = "email")]
|
||||
[XmlAttribute(AttributeName = "email")]
|
||||
public string email { get; set; }
|
||||
[DataMember(Name = "key")]
|
||||
[XmlAttribute(AttributeName = "key")]
|
||||
public string key { get; set; }
|
||||
[DataMember(Name = "licenseExpires")]
|
||||
[XmlAttribute(AttributeName = "licenseExpires")]
|
||||
public string licenseExpires { get; set; }
|
||||
|
||||
public License(IRoadieSettings configuration)
|
||||
{
|
||||
this.valid = true;
|
||||
this.email = configuration.SmtpFromAddress;
|
||||
this.key = "C617BEA251B9E2C03DCF7289";
|
||||
this.licenseExpires = DateTime.UtcNow.AddYears(5).ToString("s");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class LicenseXmlResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "license")]
|
||||
public License license { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class LicenseJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public LicenseJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class LicenseJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "license")]
|
||||
public License license { get; set; }
|
||||
}
|
||||
}
|
40
RoadieLibrary/Models/ThirdPartyApi/Subsonic/LyricResponse.cs
Normal file
40
RoadieLibrary/Models/ThirdPartyApi/Subsonic/LyricResponse.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System.Runtime.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class LyricXMLResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "lyrics")]
|
||||
public Lyric lyrics { get; set; }
|
||||
}
|
||||
|
||||
public class LyricJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public LyricJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
public class LyricJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "lyrics")]
|
||||
public Lyric lyrics { get; set; }
|
||||
}
|
||||
|
||||
public class Lyric
|
||||
{
|
||||
[DataMember(Name = "artist")]
|
||||
[XmlAttribute(AttributeName = "artist")]
|
||||
public string artist { get; set; }
|
||||
|
||||
[DataMember(Name = "title")]
|
||||
[XmlAttribute(AttributeName = "title")]
|
||||
public string title { get; set; }
|
||||
|
||||
[DataMember(Name = "value")]
|
||||
[XmlTextAttribute()]
|
||||
public string value { get; set; }
|
||||
}
|
||||
}
|
110
RoadieLibrary/Models/ThirdPartyApi/Subsonic/MusicDirectories.cs
Normal file
110
RoadieLibrary/Models/ThirdPartyApi/Subsonic/MusicDirectories.cs
Normal file
|
@ -0,0 +1,110 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class ArtistDirectoryXmlResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "directory")]
|
||||
public artistAlbumDirectory directory { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class AlbumSongDirectoryXmlResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "directory")]
|
||||
public albumSongDirectory directory { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class ArtistDirectoryJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public ArtistDirectoryJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class AlbumDirectoryJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public AlbumDirectoryJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class ArtistDirectoryJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "directory")]
|
||||
public artistAlbumDirectory directory { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class AlbumDirectoryJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "directory")]
|
||||
public albumSongDirectory directory { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class directory
|
||||
{
|
||||
[DataMember(Name = "id")]
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string id { get; set; }
|
||||
[DataMember(Name = "name")]
|
||||
[XmlAttribute(AttributeName = "name")]
|
||||
public string name { get; set; }
|
||||
[DataMember(Name = "starred")]
|
||||
[XmlAttribute(AttributeName = "starred")]
|
||||
public string starred
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.starredDateTime.HasValue)
|
||||
{
|
||||
return this.starredDateTime.Value.ToString("s");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public DateTime? starredDateTime { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the Albums for an Artist
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class artistAlbumDirectory : directory
|
||||
{
|
||||
[DataMember(Name = "child")]
|
||||
[XmlElement(ElementName = "child")]
|
||||
public album[] child { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the songs for an Album
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class albumSongDirectory : directory
|
||||
{
|
||||
[DataMember(Name = "averageRating")]
|
||||
[XmlAttribute(AttributeName = "averageRating")]
|
||||
public decimal averageRating { get; set; }
|
||||
[DataMember(Name = "playCount")]
|
||||
[XmlAttribute(AttributeName = "playCount")]
|
||||
public int playCount { get; set; }
|
||||
[DataMember(Name = "child")]
|
||||
[XmlElement(ElementName = "child")]
|
||||
public song[] child { get; set; }
|
||||
}
|
||||
}
|
55
RoadieLibrary/Models/ThirdPartyApi/Subsonic/MusicFolders.cs
Normal file
55
RoadieLibrary/Models/ThirdPartyApi/Subsonic/MusicFolders.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.ServiceModel;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class MusicFoldersXmlResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "musicFolders")]
|
||||
public musicFolder[] musicFolders { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MusicFoldersJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public MusicFoldersJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class MusicFoldersJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "musicFolders")]
|
||||
public Musicfolders musicFolders { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class Musicfolders
|
||||
{
|
||||
[DataMember(Name = "musicFolder")]
|
||||
public musicFolder[] musicFolder { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class musicFolder
|
||||
{
|
||||
[DataMember(Name = "id")]
|
||||
[XmlAttribute]
|
||||
public int id { get; set; }
|
||||
[DataMember(Name = "name")]
|
||||
[XmlAttribute]
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
25
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Ping.cs
Normal file
25
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Ping.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class PingXmlResponse : BaseResponse
|
||||
{
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class PingJsonResponse
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public BaseResponse subsonicresponse { get; set; }
|
||||
}
|
||||
}
|
156
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Playlist.cs
Normal file
156
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Playlist.cs
Normal file
|
@ -0,0 +1,156 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class PlaylistsXMLResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "playlists")]
|
||||
public Playlists playlists { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class PlaylistXMLResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "playlist")]
|
||||
public Playlist playlist { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class PlaylistsJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public PlaylistsJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class PlaylistJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public PlaylistJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class PlaylistsJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "playlists")]
|
||||
public Playlists playlists { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class PlaylistJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "playlist")]
|
||||
public Playlist playlist { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class Playlists
|
||||
{
|
||||
[DataMember(Name = "playlist")]
|
||||
[XmlElement(ElementName = "playlist")]
|
||||
public Playlist[] playlist { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class Playlist
|
||||
{
|
||||
/// <summary>
|
||||
/// Database ID
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public int ID { get; set; }
|
||||
|
||||
[DataMember(Name = "id")]
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string id { get; set; }
|
||||
[DataMember(Name = "name")]
|
||||
[XmlAttribute(AttributeName = "name")]
|
||||
public string name { get; set; }
|
||||
[DataMember(Name = "comment")]
|
||||
[XmlAttribute(AttributeName = "comment")]
|
||||
public string comment { get; set; }
|
||||
[DataMember(Name = "owner")]
|
||||
[XmlAttribute(AttributeName = "owner")]
|
||||
public string owner { get; set; }
|
||||
[DataMember(Name = "isPublic")]
|
||||
[XmlAttribute(AttributeName = "public")]
|
||||
public bool isPublic { get; set; }
|
||||
[DataMember(Name = "songCount")]
|
||||
[XmlAttribute(AttributeName = "songCount")]
|
||||
public int songCount { get; set; }
|
||||
[DataMember(Name = "duration")]
|
||||
[XmlAttribute(AttributeName = "duration")]
|
||||
public int duration
|
||||
{
|
||||
get
|
||||
{
|
||||
var contentDurationTimeSpan = TimeSpan.FromMilliseconds((double) (durationMilliseconds));
|
||||
return (int) contentDurationTimeSpan.TotalSeconds;
|
||||
}
|
||||
}
|
||||
|
||||
public int durationMilliseconds { get; set; }
|
||||
[DataMember(Name = "created")]
|
||||
[XmlAttribute(AttributeName = "created")]
|
||||
public string created
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.createdDateTime.HasValue)
|
||||
{
|
||||
return this.createdDateTime.Value.ToString("s");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
public DateTime? createdDateTime { get; set; }
|
||||
[DataMember(Name = "changed")]
|
||||
[XmlAttribute(AttributeName = "changed")]
|
||||
public string changed
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.changedDateTime.HasValue)
|
||||
{
|
||||
return this.changedDateTime.Value.ToString("s");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
public DateTime? changedDateTime { get; set; }
|
||||
[DataMember(Name = "coverArt")]
|
||||
[XmlAttribute(AttributeName = "coverArt")]
|
||||
public string coverArt { get; set; }
|
||||
[DataMember(Name = "allowedUser")]
|
||||
[XmlElement(ElementName = "allowedUser")]
|
||||
public string[] allowedUser { get; set; }
|
||||
[DataMember(Name = "entry")]
|
||||
[XmlElement(ElementName = "entry")]
|
||||
public song[] entry { get; set; }
|
||||
|
||||
public Playlist()
|
||||
{
|
||||
this.allowedUser = new string[0];
|
||||
this.entry = new song[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
146
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Podcasts.cs
Normal file
146
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Podcasts.cs
Normal file
|
@ -0,0 +1,146 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.ServiceModel;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class PodcastsXmlResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "podcasts")]
|
||||
public Podcasts[] podcasts { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class PodcastsJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public PodcastsJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class PodcastsJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "podcasts")]
|
||||
public Podcasts[] podcasts { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class Podcasts
|
||||
{
|
||||
[XmlElement(ElementName = "channel")]
|
||||
public Channel[] channel { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class Channel
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string id { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "url")]
|
||||
public string url { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "title")]
|
||||
public string title { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "description")]
|
||||
public string description { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "coverArt")]
|
||||
public string coverArt { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "originalImageUrl")]
|
||||
public string originalImageUrl { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "status")]
|
||||
public string status { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "episode")]
|
||||
public Episode[] episode { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class Episode
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string id { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "streamId")]
|
||||
public string streamId { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "channelId")]
|
||||
public string channelId { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "title")]
|
||||
public string title { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "description")]
|
||||
public string description { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "publishDate")]
|
||||
public string publishDate { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "status")]
|
||||
public string status { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "parent")]
|
||||
public string parent { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "isDir")]
|
||||
public string isDir { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "album")]
|
||||
public string album { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "artist")]
|
||||
public string artist { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "year")]
|
||||
public string year { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "genre")]
|
||||
public string genre { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "coverArt")]
|
||||
public string coverArt { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "size")]
|
||||
public string size { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "contentType")]
|
||||
public string contentType { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "suffix")]
|
||||
public string suffix { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "duration")]
|
||||
public string duration { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "bitRate")]
|
||||
public string bitRate { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "isVideo")]
|
||||
public string isVideo { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "created")]
|
||||
public string created { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "artistId")]
|
||||
public string artistId { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "type")]
|
||||
public string type { get; set; }
|
||||
|
||||
[XmlAttribute(AttributeName = "path")]
|
||||
public string path { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class RandomSongsXmlResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "randomSongs")]
|
||||
public randomSongs randomSongs { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class RandomSongsJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public RandomSongsJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class RandomSongsJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "randomSongs")]
|
||||
public randomSongs randomSongs { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class randomSongs
|
||||
{
|
||||
[DataMember(Name = "song")]
|
||||
public song[] song { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class Search2XMLResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "searchResult2")]
|
||||
public searchResult2 searchResult2 { get; set; }
|
||||
}
|
||||
|
||||
|
||||
[DataContract]
|
||||
public class Search2JsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public searchResult2JsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class searchResult2JsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "searchResult2")]
|
||||
public searchResult2 searchResult2 { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class Search3XMLResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "searchResult3")]
|
||||
public searchResult2 searchResult3 { get; set; }
|
||||
}
|
||||
|
||||
|
||||
[DataContract]
|
||||
public class Search3JsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public searchResult3JsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class searchResult3JsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "searchResult3")]
|
||||
public searchResult2 searchResult3 { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class searchResult2
|
||||
{
|
||||
[DataMember(Name = "artist")]
|
||||
[XmlElement(ElementName = "artist")]
|
||||
public artist[] artist { get; set; }
|
||||
[DataMember(Name = "album")]
|
||||
[XmlElement(ElementName = "album")]
|
||||
public album[] album { get; set; }
|
||||
[DataMember(Name = "song")]
|
||||
[XmlElement(ElementName = "song")]
|
||||
public song[] song { get; set; }
|
||||
}
|
||||
}
|
18
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Shortcut.cs
Normal file
18
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Shortcut.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[Serializable]
|
||||
public class Shortcut
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string id { get; set; }
|
||||
[XmlAttribute(AttributeName = "name")]
|
||||
public string name { get; set; }
|
||||
}
|
||||
}
|
204
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Song.cs
Normal file
204
RoadieLibrary/Models/ThirdPartyApi/Subsonic/Song.cs
Normal file
|
@ -0,0 +1,204 @@
|
|||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
public class song
|
||||
{
|
||||
/// <summary>
|
||||
/// Database ID
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public int ID { get; set; }
|
||||
|
||||
[DataMember(Name = "id")]
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string id { get; set; }
|
||||
|
||||
[DataMember(Name = "parent")]
|
||||
[XmlAttribute(AttributeName = "parent")]
|
||||
public string parent { get; set; }
|
||||
|
||||
[DataMember(Name = "title")]
|
||||
[XmlAttribute(AttributeName = "title")]
|
||||
public string title { get; set; }
|
||||
|
||||
[DataMember(Name = "album")]
|
||||
[XmlAttribute(AttributeName = "album")]
|
||||
public string album { get; set; }
|
||||
|
||||
[DataMember(Name = "artist")]
|
||||
[XmlAttribute(AttributeName = "artist")]
|
||||
public string artist { get; set; }
|
||||
|
||||
[DataMember(Name = "isDir")]
|
||||
[XmlAttribute(AttributeName = "isDir")]
|
||||
public bool isDir { get; set; }
|
||||
|
||||
[DataMember(Name = "coverArt")]
|
||||
[XmlAttribute(AttributeName = "coverArt")]
|
||||
public string coverArt { get; set; }
|
||||
|
||||
[DataMember(Name = "created")]
|
||||
[XmlAttribute(AttributeName = "created")]
|
||||
public string created
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.createdDateTime.HasValue)
|
||||
{
|
||||
return this.createdDateTime.Value.ToString("s");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public DateTime? createdDateTime { get; set; }
|
||||
|
||||
[DataMember(Name = "starred")]
|
||||
[XmlAttribute(AttributeName = "starred")]
|
||||
public string starred
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.starredDateTime.HasValue)
|
||||
{
|
||||
return this.starredDateTime.Value.ToString("s");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShouldSerializestarred()
|
||||
{
|
||||
return this.starredDateTime.HasValue;
|
||||
}
|
||||
|
||||
[DataMember(Name = "duration")]
|
||||
[XmlAttribute(AttributeName = "duration")]
|
||||
public int duration
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.durationMilliseconds > 0)
|
||||
{
|
||||
var contentDurationTimeSpan = TimeSpan.FromMilliseconds((double) (this.durationMilliseconds ?? 0));
|
||||
return (int) contentDurationTimeSpan.TotalSeconds;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public int? durationMilliseconds { get; set; }
|
||||
|
||||
[DataMember(Name = "bitRate")]
|
||||
[XmlAttribute(AttributeName = "bitRate")]
|
||||
public int bitRate { get; set; }
|
||||
|
||||
[DataMember(Name = "track")]
|
||||
[XmlAttribute(AttributeName = "track")]
|
||||
public int track { get; set; }
|
||||
|
||||
[DataMember(Name = "albumMediaNumber")]
|
||||
[XmlIgnore]
|
||||
public short? albumMediaNumber { get; set; }
|
||||
|
||||
[DataMember(Name = "year")]
|
||||
[XmlAttribute(AttributeName = "year")]
|
||||
public int year
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.yearDateTime.HasValue)
|
||||
{
|
||||
return this.yearDateTime.Value.Year;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public DateTime? yearDateTime { get; set; }
|
||||
|
||||
[DataMember(Name = "genre")]
|
||||
[XmlAttribute(AttributeName = "genre")]
|
||||
public string genre { get; set; }
|
||||
|
||||
[DataMember(Name = "size")]
|
||||
[XmlAttribute(AttributeName = "size")]
|
||||
public int size { get; set; }
|
||||
|
||||
[DataMember(Name = "suffix")]
|
||||
[XmlAttribute(AttributeName = "suffix")]
|
||||
public string suffix { get; set; }
|
||||
|
||||
[DataMember(Name = "contentType")]
|
||||
[XmlAttribute(AttributeName = "contentType")]
|
||||
public string contentType { get; set; }
|
||||
|
||||
[DataMember(Name = "path")]
|
||||
[XmlAttribute(AttributeName = "path")]
|
||||
public string path { get; set; }
|
||||
|
||||
[DataMember(Name = "albumId")]
|
||||
[XmlAttribute(AttributeName = "albumId")]
|
||||
public string albumId { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public int albumID { get; set; }
|
||||
|
||||
[DataMember(Name = "artistId")]
|
||||
[XmlAttribute(AttributeName = "artistId")]
|
||||
public string artistId { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public int artistID { get; set; }
|
||||
|
||||
[DataMember(Name = "type")]
|
||||
[XmlAttribute(AttributeName = "type")]
|
||||
public string type { get; set; }
|
||||
|
||||
[DataMember(Name = "playCount")]
|
||||
[XmlAttribute(AttributeName = "playCount")]
|
||||
public int playCount { get; set; }
|
||||
|
||||
[DataMember(Name = "userRating")]
|
||||
[XmlAttribute(AttributeName = "userRating")]
|
||||
public short userRating { get; set; }
|
||||
|
||||
[DataMember(Name = "averageRating")]
|
||||
[XmlAttribute(AttributeName = "averageRating")]
|
||||
public short averageRating { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public DateTime? starredDateTime { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public bool isValid { get; set; }
|
||||
|
||||
public song()
|
||||
{
|
||||
this.type = "music";
|
||||
this.suffix = "mp3";
|
||||
this.bitRate = 320;
|
||||
this.contentType = "audio/mpeg";
|
||||
this.isDir = false;
|
||||
}
|
||||
}
|
||||
}
|
33
RoadieLibrary/Models/ThirdPartyApi/Subsonic/SongResponse.cs
Normal file
33
RoadieLibrary/Models/ThirdPartyApi/Subsonic/SongResponse.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[Serializable]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class SongXmlResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "song")]
|
||||
public song song { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class SongJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public SongJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
|
||||
[DataContract]
|
||||
public class SongJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "song")]
|
||||
public song song { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[Serializable]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class SongsByGenreXmlResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "songsByGenre")]
|
||||
public SongsByGenreResponse songsByGenre { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class SongsByGenreJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public SongsByGenreJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class SongsByGenreJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "songsByGenre")]
|
||||
[XmlElement(ElementName = "songsByGenre")]
|
||||
public SongsByGenreResponse songsByGenre { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class SongsByGenreResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "song")]
|
||||
[XmlElement(ElementName = "song")]
|
||||
public song[] song { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class StarredXMLResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "starred")]
|
||||
public starredResult starred { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class StarredJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public starredJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class starredJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "starred")]
|
||||
public starredResult starred { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class Starred2XMLResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "starred2")]
|
||||
public starredResult starred2 { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class Starred2JsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public starred2JsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class starred2JsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "starred2")]
|
||||
public starredResult starred2 { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class starredResult
|
||||
{
|
||||
[DataMember(Name = "artist")]
|
||||
[XmlElement(ElementName = "artist")]
|
||||
public artist[] artist { get; set; }
|
||||
[DataMember(Name = "album")]
|
||||
[XmlElement(ElementName = "album")]
|
||||
public album[] album { get; set; }
|
||||
[DataMember(Name = "song")]
|
||||
[XmlElement(ElementName = "song")]
|
||||
public song[] song { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
159
RoadieLibrary/Models/ThirdPartyApi/Subsonic/UserResponse.cs
Normal file
159
RoadieLibrary/Models/ThirdPartyApi/Subsonic/UserResponse.cs
Normal file
|
@ -0,0 +1,159 @@
|
|||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Roadie.Models.ThirdPartyApi.Subsonic
|
||||
{
|
||||
[DataContract]
|
||||
[XmlRoot(ElementName = "subsonic-response", Namespace = "http://subsonic.org/restapi")]
|
||||
public class UserXMLResponse : BaseResponse
|
||||
{
|
||||
[XmlElement(ElementName = "user")]
|
||||
public User user { get; set; }
|
||||
}
|
||||
|
||||
public class UserJsonResponseWrapper
|
||||
{
|
||||
[DataMember(Name = "subsonic-response")]
|
||||
public UserJsonResponse subsonicresponse { get; set; }
|
||||
}
|
||||
|
||||
public class UserJsonResponse : BaseResponse
|
||||
{
|
||||
[DataMember(Name = "user")]
|
||||
public User user { get; set; }
|
||||
}
|
||||
|
||||
public class User
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the user
|
||||
/// </summary>
|
||||
[DataMember(Name = "username")]
|
||||
[XmlAttribute(AttributeName = "username")]
|
||||
public string username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The email address of the user.
|
||||
/// </summary>
|
||||
[DataMember(Name = "email")]
|
||||
[XmlAttribute(AttributeName = "email")]
|
||||
public string email { get; set; }
|
||||
|
||||
[DataMember(Name = "scrobblingEnabled")]
|
||||
[XmlAttribute(AttributeName = "scrobblingEnabled")]
|
||||
public bool scrobblingEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the user is administrator.
|
||||
/// </summary>
|
||||
[DataMember(Name = "adminRole")]
|
||||
[XmlAttribute(AttributeName = "adminRole")]
|
||||
public bool adminRole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the user is allowed to change personal settings and password.
|
||||
/// </summary>
|
||||
[DataMember(Name = "settingsRole")]
|
||||
[XmlAttribute(AttributeName = "settingsRole")]
|
||||
public bool settingsRole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the user is allowed to download files.
|
||||
/// </summary>
|
||||
[DataMember(Name = "downloadRole")]
|
||||
[XmlAttribute(AttributeName = "downloadRole")]
|
||||
public bool downloadRole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the user is allowed to upload files.
|
||||
/// </summary>
|
||||
[DataMember(Name = "uploadRole")]
|
||||
[XmlAttribute(AttributeName = "uploadRole")]
|
||||
public bool uploadRole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the user is allowed to create and delete playlists.
|
||||
/// </summary>
|
||||
[DataMember(Name = "playlistRole")]
|
||||
[XmlAttribute(AttributeName = "playlistRole")]
|
||||
public bool playlistRole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the user is allowed to change cover art and tags.
|
||||
/// </summary>
|
||||
[DataMember(Name = "coverArtRole")]
|
||||
[XmlAttribute(AttributeName = "coverArtRole")]
|
||||
public bool coverArtRole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the user is allowed to create and edit comments and ratings.
|
||||
/// </summary>
|
||||
[DataMember(Name = "commentRole")]
|
||||
[XmlAttribute(AttributeName = "commentRole")]
|
||||
public bool commentRole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the user is allowed to administrate Podcasts.
|
||||
/// </summary>
|
||||
[DataMember(Name = "podcastRole")]
|
||||
[XmlAttribute(AttributeName = "podcastRole")]
|
||||
public bool podcastRole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the user is allowed to play files.
|
||||
/// </summary>
|
||||
[DataMember(Name = "streamRole")]
|
||||
[XmlAttribute(AttributeName = "streamRole")]
|
||||
public bool streamRole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the user is allowed to play files in jukebox mode.
|
||||
/// </summary>
|
||||
[DataMember(Name = "jukeboxRole")]
|
||||
[XmlAttribute(AttributeName = "jukeboxRole")]
|
||||
public bool jukeboxRole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the user is allowed to share files with anyone.
|
||||
/// </summary>
|
||||
[DataMember(Name = "shareRole")]
|
||||
[XmlAttribute(AttributeName = "shareRole")]
|
||||
public bool shareRole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the user is allowed to start video conversions.
|
||||
/// </summary>
|
||||
[DataMember(Name = "videoConversionRole")]
|
||||
[XmlAttribute(AttributeName = "videoConversionRole")]
|
||||
public bool videoConversionRole { get; set; }
|
||||
|
||||
[DataMember(Name = "avatarLastChanged")]
|
||||
[XmlAttribute(AttributeName = "avatarLastChanged")]
|
||||
public DateTime avatarLastChanged { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IDs of the music folders the user is allowed access to. Include the parameter once for each folder.
|
||||
/// </summary>
|
||||
[DataMember(Name = "musicFolderId")]
|
||||
[XmlAttribute(AttributeName = "musicFolderId")]
|
||||
public int[] musicFolderId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The maximum bit rate (in Kbps) for the user. Audio streams of higher bit rates are automatically downsampled to this bit rate. Legal values: 0 (no limit), 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320.
|
||||
/// </summary>
|
||||
[DataMember(Name = "maxBitRate")]
|
||||
[XmlAttribute(AttributeName = "maxBitRate")]
|
||||
public int? maxBitRate { get; set; }
|
||||
|
||||
public User()
|
||||
{
|
||||
this.settingsRole = true;
|
||||
this.playlistRole = true;
|
||||
this.commentRole = true;
|
||||
this.streamRole = true;
|
||||
this.shareRole = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentFTP" Version="19.2.2" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.8.9" />
|
||||
<PackageReference Include="Inflatable.Lastfm" Version="1.1.0.339" />
|
||||
<PackageReference Include="Mapster" Version="3.2.0" />
|
||||
|
@ -30,6 +31,8 @@
|
|||
<ItemGroup>
|
||||
<Folder Include="Factories\" />
|
||||
<Folder Include="FilePlugins\" />
|
||||
<Folder Include="Models\ThirdPartyApi\" />
|
||||
<Folder Include="Models\ThirdPartyApi\Subsonic\" />
|
||||
<Folder Include="Processors\" />
|
||||
<Folder Include="SearchEngines\MetaData\Audio\" />
|
||||
</ItemGroup>
|
||||
|
|
36
RoadieLibrary/Utility/EmailHelper.cs
Normal file
36
RoadieLibrary/Utility/EmailHelper.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using Roadie.Library.Configuration;
|
||||
using System.Net;
|
||||
using System.Net.Mail;
|
||||
using System.Net.Security;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
namespace Roadie.Library.Utility
|
||||
{
|
||||
public static class EmailHelper
|
||||
{
|
||||
public static bool SendEmail(IRoadieSettings configuration, string emailAddress, string subject, string body)
|
||||
{
|
||||
using (MailMessage mail = new MailMessage(configuration.SmtpFromAddress, emailAddress))
|
||||
{
|
||||
using (SmtpClient client = new SmtpClient())
|
||||
{
|
||||
client.Port = configuration.SmtpPort;
|
||||
client.EnableSsl = configuration.SmtpUseSSl;
|
||||
client.DeliveryMethod = SmtpDeliveryMethod.Network;
|
||||
client.UseDefaultCredentials = false;
|
||||
client.Credentials = new NetworkCredential(configuration.SmtpUsername, configuration.SmtpPassword);
|
||||
client.Host = configuration.SmtpHost;
|
||||
mail.Subject = subject;
|
||||
mail.IsBodyHtml = true;
|
||||
mail.Body = body;
|
||||
ServicePointManager.ServerCertificateValidationCallback = delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
|
||||
{
|
||||
return true;
|
||||
};
|
||||
client.Send(mail);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
47
RoadieLibrary/Utility/FtpHelper.cs
Normal file
47
RoadieLibrary/Utility/FtpHelper.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
using FluentFTP;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
|
||||
namespace Roadie.Library.Utility
|
||||
{
|
||||
public static class FtpHelper
|
||||
{
|
||||
public static int Download(string ftpHost, string ftpDirectory, NetworkCredential credentials, string localPath)
|
||||
{
|
||||
int result = 0;
|
||||
using (FtpClient client = new FtpClient(ftpHost))
|
||||
{
|
||||
client.Credentials = credentials;
|
||||
client.Connect();
|
||||
|
||||
var foundFiles = new List<string>();
|
||||
foreach (FtpListItem item in client.GetListing(ftpDirectory, FtpListOption.Recursive))
|
||||
{
|
||||
switch (item.Type)
|
||||
{
|
||||
case FtpFileSystemObjectType.File:
|
||||
foundFiles.Add(item.FullName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var file in foundFiles)
|
||||
{
|
||||
var filenameWithFolder = file.Replace(ftpDirectory, string.Empty);
|
||||
var fileFolder = Path.GetDirectoryName(filenameWithFolder);
|
||||
var filename = Path.GetFileName(file);
|
||||
|
||||
var localPathForFile = Path.Combine(localPath, fileFolder);
|
||||
var localFilename = Path.Combine(localPathForFile, filename);
|
||||
Directory.CreateDirectory(localPathForFile);
|
||||
client.DownloadFile(localFilename, file);
|
||||
result++;
|
||||
}
|
||||
|
||||
client.Disconnect();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue