Skip to content
This repository has been archived by the owner on Feb 5, 2021. It is now read-only.

Commit

Permalink
Added #32
Browse files Browse the repository at this point in the history
  • Loading branch information
BackInBash committed Dec 18, 2019
1 parent 02c51e9 commit 9f11590
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DeezerSync/DeezerSync.MusicProvider/SoundCloud.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public async Task<List<StandardPlaylist>> GetStandardPlaylists()
try
{
var userinfo = a.User;
track.Add(new StandardTitle { username = userinfo.Username, description = a.Description, duration = a.Duration / 1000, genre = a.Genre, labelname = a.LabelName ?? string.Empty, title = a.Title, id = (long)i.Id, url = a.PermalinkUrl.AbsoluteUri });
track.Add(new StandardTitle { username = userinfo.Username, description = a.Description, duration = a.Duration / 1000, genre = a.Genre, labelname = a.LabelName ?? string.Empty, title = a.Title, id = (long)a.Id, url = a.PermalinkUrl.ToString() });

}
catch (Exception e)
Expand Down
6 changes: 6 additions & 0 deletions DeezerSync/DeezerSync/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public partial class ConfigModel
public string Deezer_Secret;
public string Spotify_Username;
public string Spotify_Secret;
public string db_ip;
public string db_port;
}
class Config
{
Expand All @@ -22,6 +24,8 @@ class Config
public string deezer_secret { get; private set; }
public string spotify_profile { get; private set; }
public string spotify_secret { get; private set; }
public string db_ip { get; set; }
public string db_port { get; set; }

private string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "config.json");

Expand All @@ -48,6 +52,8 @@ private void Read()
deezer_secret = result.Deezer_Secret;
spotify_profile = result.Spotify_Username;
spotify_secret = result.Spotify_Secret;
db_ip = result.db_ip;
db_port = result.db_port;

}
catch (FileNotFoundException)
Expand Down
1 change: 1 addition & 0 deletions DeezerSync/DeezerSync/DeezerSync.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

<ItemGroup>
<ProjectReference Include="..\DeezerSync.Core\DeezerSync.Core.csproj" />
<ProjectReference Include="..\DeezerSync.DB\DeezerSync.DB.csproj" />
<ProjectReference Include="..\DeezerSync.DeezerAPI\DeezerSync.DeezerAPI.csproj" />
<ProjectReference Include="..\DeezerSync.MusicProvider\DeezerSync.MusicProvider.csproj" />
</ItemGroup>
Expand Down
14 changes: 14 additions & 0 deletions DeezerSync/DeezerSync/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ static async System.Threading.Tasks.Task Main(string[] args)
{
musicprovider_playlist = new MusicProvider.main(config.soundcloud_profile, config.spotify_profile, config.spotify_secret, config.soundcloud_clientid);
}
// Save to DB
if(!string.IsNullOrEmpty(config.db_port) && !string.IsNullOrEmpty(config.db_ip))
{
DB.Mongo db = new DB.Mongo(config.db_ip, config.db_port);

db.connect();
await db.dropDatabase("SoundCloud");
db.createDatabase("SoundCloud");

foreach (var i in musicprovider_playlist.Data)
{
await db.addPlaylist(i);
}
}
// Start Search
DeezerSync.Core.Search core = new DeezerSync.Core.Search(musicprovider_playlist.Data, await api.GetAllPlaylistsasync());
await core.Start();
Expand Down

0 comments on commit 9f11590

Please sign in to comment.