-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e14c3a3
Showing
28 changed files
with
1,490 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrivateCloudMusic", "PrivateCloudMusic\PrivateCloudMusic.csproj", "{5FD280B3-FA56-411F-9540-9A2BAF730AE1}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{5FD280B3-FA56-411F-9540-9A2BAF730AE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{5FD280B3-FA56-411F-9540-9A2BAF730AE1}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{5FD280B3-FA56-411F-9540-9A2BAF730AE1}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{5FD280B3-FA56-411F-9540-9A2BAF730AE1}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.IO; | ||
using LiteDB; | ||
|
||
namespace Pcm.Entities | ||
{ | ||
public class Music | ||
{ | ||
[BsonId] | ||
public ObjectId MusicId { get; set; } | ||
|
||
public string Title { get; set; } | ||
public string Album { get; set; } | ||
public string[] Genres { get; set; } | ||
public string[] Performers { get; set; } | ||
|
||
public uint Track { get; set; } | ||
public uint TrackCount { get; set; } | ||
|
||
public string FileName => Path.GetFileName(FilePath); | ||
public string FilePath { get; set; } | ||
public int PlayCount { get; set; } | ||
public string MimeType { get; set; } | ||
public long Length { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using LiteDB; | ||
|
||
namespace Pcm.Entities | ||
{ | ||
public class Playlist | ||
{ | ||
public ObjectId Id { get; set; } | ||
|
||
public string Name { get; set; } | ||
|
||
[BsonRef("music")] | ||
public List<Music> Musics { get; set; } | ||
|
||
public DateTime CreatedAt { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.Threading.Tasks; | ||
using Pcm.Proto; | ||
using Pcm.Proxy; | ||
|
||
namespace Pcm.Handlers | ||
{ | ||
public class AlbumHandler | ||
{ | ||
public async Task<StatusCode> Get(Context ctx, Request req, Response resp) | ||
{ | ||
return await Task.FromResult(StatusCode.Ok); | ||
} | ||
|
||
public async Task<StatusCode> List(Context ctx, Request req, Response resp) | ||
{ | ||
return await Task.FromResult(StatusCode.Ok); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Threading.Tasks; | ||
using Pcm.Proto; | ||
using Pcm.Proxy; | ||
|
||
namespace Pcm.Handlers | ||
{ | ||
public class DefaultHandler | ||
{ | ||
public async Task<StatusCode> Default(Context ctx, Request req, Response resp) | ||
{ | ||
return await Task.FromResult(StatusCode.Ok); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Pcm.Handlers | ||
{ | ||
public class FolderHandler | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System.Threading.Tasks; | ||
using Pcm.Proto; | ||
using Pcm.Proxy; | ||
using Pcm.Services; | ||
|
||
namespace Pcm.Handlers | ||
{ | ||
public class MusicHandler | ||
{ | ||
public async Task<StatusCode> Get(Context ctx, Request req, Response resp) | ||
{ | ||
var music = MusicService.Instance.Get(req.Body.GetMusicBody.Id); | ||
if (music != null) | ||
{ | ||
resp.Body.GetMusicBody = new GetMusicResponseBody() | ||
{ | ||
Title = music.Title, | ||
Album = music.Album, | ||
Genres = { music.Genres }, | ||
Performers = { music.Performers }, | ||
Track = music.Track, | ||
TrackCount = music.TrackCount, | ||
FileName = music.FileName, | ||
PlayCount = music.PlayCount, | ||
Length = music.Length, | ||
MimeType = music.MimeType, | ||
CreatedAt = music.MusicId.Timestamp | ||
}; | ||
} | ||
|
||
return await Task.FromResult(StatusCode.Ok); | ||
} | ||
|
||
public async Task<StatusCode> List(Context ctx, Request req, Response resp) | ||
{ | ||
return await Task.FromResult(StatusCode.Ok); | ||
} | ||
|
||
public async Task<StatusCode> Delete(Context ctx, Request req, Response resp) | ||
{ | ||
return await Task.FromResult(StatusCode.Ok); | ||
} | ||
|
||
public async Task<StatusCode> Modify(Context ctx, Request req, Response resp) | ||
{ | ||
return await Task.FromResult(StatusCode.Ok); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System.Threading.Tasks; | ||
using Pcm.Proto; | ||
using Pcm.Proxy; | ||
|
||
namespace Pcm.Handlers | ||
{ | ||
public class PlaylistHandler | ||
{ | ||
public async Task<StatusCode> List(Context ctx, Request req, Response resp) | ||
{ | ||
return await Task.FromResult(StatusCode.Ok); | ||
} | ||
|
||
public async Task<StatusCode> Get(Context ctx, Request req, Response resp) | ||
{ | ||
return await Task.FromResult(StatusCode.Ok); | ||
} | ||
|
||
public async Task<StatusCode> Create(Context ctx, Request req, Response resp) | ||
{ | ||
return await Task.FromResult(StatusCode.Ok); | ||
} | ||
|
||
public async Task<StatusCode> Rename(Context ctx, Request req, Response resp) | ||
{ | ||
return await Task.FromResult(StatusCode.Ok); | ||
} | ||
|
||
public async Task<StatusCode> Add(Context ctx, Request req, Response resp) | ||
{ | ||
return await Task.FromResult(StatusCode.Ok); | ||
} | ||
|
||
public async Task<StatusCode> Remove(Context ctx, Request req, Response resp) | ||
{ | ||
return await Task.FromResult(StatusCode.Ok); | ||
} | ||
|
||
public async Task<StatusCode> Delete(Context ctx, Request req, Response resp) | ||
{ | ||
return await Task.FromResult(StatusCode.Ok); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.0</TargetFramework> | ||
<RootNamespace>Pcm</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Anemonis.AspNetCore.RequestDecompression" Version="1.5.1" /> | ||
<PackageReference Include="Google.Protobuf" Version="3.10.0-rc1" /> | ||
<PackageReference Include="Grpc" Version="2.24.0" /> | ||
<PackageReference Include="Grpc.Tools" Version="2.24.0" /> | ||
<PackageReference Include="LiteDB" Version="5.0.0-alpha2" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="3.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.TraceSource" Version="3.0.0" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3-beta1" /> | ||
<PackageReference Include="TagLibSharp" Version="2.2.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Remove="Protos\api.proto" /> | ||
<Protobuf Include="Proto\api.proto" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.Hosting; | ||
using Pcm.Services; | ||
using Pcm.Utils; | ||
|
||
namespace Pcm | ||
{ | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
ConfigManager.Config = new ConfigurationBuilder() | ||
.AddJsonFile("config.json", optional: true) //this is not needed, but could be useful | ||
.AddEnvironmentVariables() | ||
.AddCommandLine(args) | ||
.Build(); | ||
|
||
var m = MusicService.Instance.Add(@"/Users/xiaozijin/Downloads/03.オードリー.mp3"); | ||
|
||
|
||
|
||
CreateHostBuilder(args).Build().Run(); | ||
} | ||
|
||
public static IHostBuilder CreateHostBuilder(string[] args) => | ||
Host.CreateDefaultBuilder(args) | ||
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:27108", | ||
"sslPort": 44345 | ||
} | ||
}, | ||
"profiles": { | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"PrivateCloudMusic": { | ||
"commandName": "Project", | ||
"launchBrowser": false, | ||
"applicationUrl": "https://localhost:5001;http://localhost:5000", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.