mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-25 15:36:26 +00:00
First Implementation of SpotifyUri
Following JohnnyCrazy's directives.
This commit is contained in:
parent
a13aadc986
commit
1c5f6899eb
@ -13,5 +13,10 @@ namespace SpotifyAPI.Local.Models
|
|||||||
|
|
||||||
[JsonProperty("location")]
|
[JsonProperty("location")]
|
||||||
public TrackResourceLocation Location { get; set; }
|
public TrackResourceLocation Location { get; set; }
|
||||||
|
|
||||||
|
public SpotifyUri ParseUri()
|
||||||
|
{
|
||||||
|
return new SpotifyUri(this.Uri);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
23
SpotifyAPI/Local/Models/SpotifyUri.cs
Normal file
23
SpotifyAPI/Local/Models/SpotifyUri.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SpotifyAPI.Local.Models
|
||||||
|
{
|
||||||
|
public class SpotifyUri
|
||||||
|
{
|
||||||
|
public string Base { get; internal set; }
|
||||||
|
public string Type { get; internal set; }
|
||||||
|
public string Id { get; internal set; }
|
||||||
|
|
||||||
|
public SpotifyUri(string Uri)
|
||||||
|
{
|
||||||
|
string[] props = Uri.Split(':');
|
||||||
|
this.Base = props[0];
|
||||||
|
this.Type = props[1];
|
||||||
|
this.Id = props[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -157,10 +157,5 @@ namespace SpotifyAPI.Local.Models
|
|||||||
return wc.DownloadData(url);
|
return wc.DownloadData(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetId()
|
|
||||||
{
|
|
||||||
return this.TrackResource.Uri.Substring(14);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -56,6 +56,7 @@
|
|||||||
<Compile Include="Local\ExtendedWebClient.cs">
|
<Compile Include="Local\ExtendedWebClient.cs">
|
||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Local\Models\SpotifyUri.cs" />
|
||||||
<Compile Include="Local\VolumeMixerControl.cs" />
|
<Compile Include="Local\VolumeMixerControl.cs" />
|
||||||
<Compile Include="Web\IClient.cs" />
|
<Compile Include="Web\IClient.cs" />
|
||||||
<Compile Include="Local\Models\CFID.cs" />
|
<Compile Include="Local\Models\CFID.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user