Skip to content

Commit

Permalink
update packages and fix minor bugs with onedrive and last.fm scrobbler
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodrr committed Jan 31, 2019
1 parent 0e2a691 commit e6db1c0
Show file tree
Hide file tree
Showing 18 changed files with 116 additions and 73 deletions.
2 changes: 1 addition & 1 deletion BreadPlayer.Common/BreadPlayer.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="2.6.0-dev-00923" />
<PackageReference Include="Serilog" Version="2.8.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
</ItemGroup>

Expand Down
16 changes: 8 additions & 8 deletions BreadPlayer.Core/Engines/BASSEngine/BASSPlayerEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public async Task Init(bool isMobile)
await Task.Run(() =>
{
Bass.UpdatePeriod = 230;
Bass.Start();
var ss = Bass.Start();

if (isMobile)
{
Expand All @@ -77,7 +77,7 @@ await Task.Run(() =>
else
Bass.Configure(Configuration.IncludeDefaultDevice, true);

Bass.Init();
var s = Bass.Init();
});
}

Expand Down Expand Up @@ -139,7 +139,7 @@ await Task.Run(async () =>
}
}
}
catch(Exception ex)
catch (Exception ex)
{
BLogger.E($"Transition failed.", ex);
await InitializeSwitch.NotificationManager.ShowStatusBarMessageAsync($"Failed to transtion. Reason: {Bass.LastError}");
Expand All @@ -156,7 +156,7 @@ public async Task<bool> LoadURLAsync(Mediafile mediafile, string uri)
{
if (string.IsNullOrEmpty(uri))
return false;
return await LoadMusicAsync(() =>
return await LoadMusicAsync(() =>
{
int metaSize = 1024 * 200; //1MB
MemoryStream metadataStream = new MemoryStream();
Expand Down Expand Up @@ -253,7 +253,7 @@ public async Task<bool> LoadLocalFileAsync(Mediafile mediaFile)
else
{
string error = "The file " + mediaFile?.OrginalFilename + " is either corrupt, incomplete or unavailable. \r\n\r\n Exception details: No data available.";
await InitializeSwitch.NotificationManager.ShowMessageAsync(error);
await InitializeSwitch.NotificationManager.ShowMessageAsync(error);
return false;
}
}
Expand All @@ -275,7 +275,7 @@ await Task.Run(() =>
PlayerState = PlayerState.Stopped;

LoadMusicAction(); //loads the respective stream
if(Length <= 1)
if (Length <= 1)
Length = Bass.ChannelBytes2Seconds(_handle, Bass.ChannelGetLength(_handle));
IsSeekable = Bass.ChannelGetLength(_handle) != -1;
Bass.FloatingPointDSP = true;
Expand Down Expand Up @@ -306,7 +306,7 @@ await Task.Run(() =>
return false;
}
}

/// <summary>
/// Pauses the audio playback.
/// </summary>
Expand Down Expand Up @@ -444,7 +444,7 @@ public Mediafile CurrentlyPlayingFile
{
get => _currentPlayingFile;
set => Set(ref _currentPlayingFile, value);
}
}

private Equalizer _fmodEqualizer;

Expand Down
8 changes: 4 additions & 4 deletions BreadPlayer.Core/project.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"supports": {},
"dependencies": {
"LiteDB": "4.0.0",
"LiteDB": "4.1.4",
"ManagedBass": "2.0.4",
"ManagedBass.Fx": "2.0.1",
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
"NETStandard.Library": "1.6.1",
"Newtonsoft.Json": "10.0.3",
"System.ValueTuple": "4.4.0"
"NETStandard.Library": "2.0.3",
"Newtonsoft.Json": "12.0.1",
"System.ValueTuple": "4.5.0"
},
"frameworks": {
"netstandard1.4": {}
Expand Down
6 changes: 3 additions & 3 deletions BreadPlayer.Database/BreadPlayer.Database.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
Expand All @@ -13,8 +13,8 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'" />

<ItemGroup>
<PackageReference Include="LiteDB" Version="4.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="LiteDB" Version="4.1.4" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BreadPlayer.Core\BreadPlayer.Core.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion BreadPlayer.Interfaces/BreadPlayer.Interfaces.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions BreadPlayer.Views.UWP/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTask
BLogger.E(string.Format("Task ({0}) terminating...", e.Exception.Source), e.Exception);
}

private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
{
BLogger.F("Something caused the app to crash! Sender: {sender}", e.Exception, sender);
}
Expand All @@ -95,7 +95,7 @@ private void InitializeTheme()
RequestedTheme = (ApplicationTheme)theme;
BLogger.I("Theme set: {theme}", theme);
}
}
}

private void App_LeavingBackground(object sender, LeavingBackgroundEventArgs e)
{
Expand Down Expand Up @@ -163,7 +163,7 @@ private async void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
BLogger.I("App suspending. Saving state.");
await LockscreenHelper.ResetLockscreenImage();
await LockscreenHelper.ResetLockscreenImage();
CoreWindowLogic.SaveSettings();
CoreWindowLogic.DisposeObjects();
_sessionWatch?.Stop();
Expand Down Expand Up @@ -201,7 +201,7 @@ await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatch
var vm = Current.Resources["AlbumArtistVM"];
ThemeManager.SetThemeColor(SettingsHelper.GetLocalSetting<string>("NowPlayingPicture", null));


// Do not repeat app initialization when the Window already has content
if (rootFrame == null)
{
Expand Down
38 changes: 22 additions & 16 deletions BreadPlayer.Views.UWP/BreadPlayer.Views.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.14393.0</TargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Expand All @@ -29,8 +29,8 @@
<PackageCertificateKeyFile>BreadPlayer.Views.UWP_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup>
<PropertyGroup Condition="('$(UseTemporarySignCert)' != 'true')">
<PackageCertificateThumbprint>A6D00540C7DD8CB0718068B3485E394B3D94E96D</PackageCertificateThumbprint>
<PackageCertificateKeyFile>BreadPlayer_StoreKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>1A3213ADD2C8D2F881976AC2C45DBE52A3C3A205</PackageCertificateThumbprint>
<PackageCertificateKeyFile>BreadPlayer.Views.UWP_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -620,52 +620,58 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ksemenenko.ColorThief">
<Version>1.1.0.3</Version>
<Version>1.1.1.4</Version>
</PackageReference>
<PackageReference Include="Microsoft.Advertising.XAML">
<Version>10.1705.16001</Version>
<Version>10.1811.22001</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Analytics">
<Version>1.1.0</Version>
<Version>1.13.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Crashes">
<Version>1.1.0</Version>
<Version>1.13.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.0.1</Version>
<Version>6.1.9</Version>
</PackageReference>
<PackageReference Include="Microsoft.Services.Store.Engagement">
<Version>10.1710.25002</Version>
<Version>10.1810.16002</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Services">
<Version>5.0.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications">
<Version>2.1.0</Version>
<Version>5.0.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.Services">
<Version>2.1.0</Version>
<Version>5.0.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls">
<Version>2.1.0</Version>
<Version>5.0.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Xaml.Behaviors.Uwp.Managed">
<Version>2.0.0</Version>
</PackageReference>
<PackageReference Include="NETStandard.Library">
<Version>2.0.3</Version>
</PackageReference>
<PackageReference Include="PCLStorage">
<Version>1.0.2</Version>
</PackageReference>
<PackageReference Include="RateMyApp.UWP">
<Version>2.1.0</Version>
</PackageReference>
<PackageReference Include="SharpCifs.Std">
<Version>0.2.11</Version>
<Version>0.2.12</Version>
</PackageReference>
<PackageReference Include="System.ValueTuple">
<Version>4.4.0</Version>
<Version>4.5.0</Version>
</PackageReference>
<PackageReference Include="Telerik.UI.for.UniversalWindowsPlatform">
<Version>1.0.0.7</Version>
<Version>1.0.1.3</Version>
</PackageReference>
<PackageReference Include="Win2D.uwp">
<Version>1.21.0</Version>
<Version>1.20.0</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
Expand Down
Binary file modified BreadPlayer.Views.UWP/BreadPlayer.Views.UWP_TemporaryKey.pfx
Binary file not shown.
8 changes: 5 additions & 3 deletions BreadPlayer.Views.UWP/Extensions/OneDriveExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Toolkit.Uwp.Services.OneDrive;
using Microsoft.Graph;
using Microsoft.Toolkit.Services.OneDrive;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -11,8 +12,9 @@ public static class OneDriveExtensions
{
public static async Task<string> GetDownloadURL(this OneDriveStorageFile oneDriveFile)
{
var requestMessage = OneDriveService.Instance.Provider.Drive.Items[oneDriveFile.OneDriveItem.Id].Content.Request().GetHttpRequestMessage();
await OneDriveService.Instance.Provider.AuthenticationProvider.AuthenticateRequestAsync(requestMessage).AsAsyncAction().AsTask();
var _service = OneDriveService.Instance;
var requestMessage = ((IGraphServiceClient)_service.Provider.GraphProvider).Drive.Items[oneDriveFile.OneDriveItem.Id].Content.Request().GetHttpRequestMessage();
await _service.Provider.GraphProvider.AuthenticationProvider.AuthenticateRequestAsync(requestMessage).AsAsyncAction().AsTask();
string headerStr = "\r\n";
foreach (var header in requestMessage.Headers)
{
Expand Down
2 changes: 1 addition & 1 deletion BreadPlayer.Views.UWP/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" IgnorableNamespaces="uap mp uap3">
<Identity Name="22102thecodrr.BreadPlayer" Publisher="CN=C12EF191-B051-4B71-922F-A3597A07F49E" Version="2.7.9.0" />
<Identity Name="22102thecodrr.BreadPlayer" Publisher="CN=thecodrr" Version="2.7.9.0" />
<mp:PhoneIdentity PhoneProductId="f2586309-8386-46e9-9e86-c9b0a8a075b0" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>Bread Player</DisplayName>
Expand Down
13 changes: 8 additions & 5 deletions BreadPlayer.Views.UWP/ViewModels/FoldersViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
using BreadPlayer.Helpers;
using BreadPlayer.Interfaces;
using BreadPlayer.Messengers;
using Microsoft.Toolkit.Uwp.Services.OneDrive;
using Microsoft.Toolkit.Services.OneDrive;
using Microsoft.Toolkit.Services.Services.MicrosoftGraph;
using SharpCifs.Smb;
using System;
using System.Collections.Generic;
Expand All @@ -24,7 +25,6 @@
using Windows.Storage.Pickers;
using Windows.Storage.Search;
using Windows.UI.Xaml.Controls;
using static Microsoft.Toolkit.Uwp.Services.OneDrive.OneDriveEnums;

namespace BreadPlayer.ViewModels
{
Expand Down Expand Up @@ -507,7 +507,7 @@ private async Task BrowseOneDriveAsync(DiskItem item)
if (item.Cache == null)
{
#if DEBUG
if (OneDriveService.Instance.Initialize("000000004C1B185C", AccountProviderType.Msa, OneDriveScopes.OfflineAccess | OneDriveScopes.ReadWrite))
if (OneDriveService.Instance.Initialize("dc915f45-42b6-4835-b581-c5d0547d05b2", new string[] { MicrosoftGraphScope.FilesReadWriteAll }, null, "https://google.com/"))
#else
if (OneDriveService.Instance.Initialize("000000004C1B185C", AccountProviderType.Msa, OneDriveScopes.OfflineAccess | OneDriveScopes.ReadOnly | OneDriveScopes.WlSignin))
#endif
Expand All @@ -516,7 +516,8 @@ private async Task BrowseOneDriveAsync(DiskItem item)
{
throw new Exception("Unable to sign in");
}
var folder = await OneDriveService.Instance.RootFolderAsync();
var folder = await OneDriveService.Instance.RootFolderForMeAsync();
var s = await folder.GetItemsAsync(10);
StorageItems.AddRange(await GetOneDriveFolderItemsAsync(folder));
}
}
Expand All @@ -533,8 +534,10 @@ private async Task BrowseOneDriveAsync(DiskItem item)
}
private async Task<IEnumerable<DiskItem>> GetOneDriveFolderItemsAsync(OneDriveStorageFolder folder)
{
//if (folder.OneDriveItem.Folder.ChildCount <= 0)
// return null;
List<DiskItem> oneDriveStorageItems = new List<DiskItem>();
foreach (var item in await folder.GetItemsAsync(folder.OneDriveItem.Folder.ChildCount ?? short.MaxValue))
foreach (var item in await folder.GetItemsAsync(0, int.MaxValue))
{
if (!item.IsOneNote())
{
Expand Down
Loading

0 comments on commit e6db1c0

Please sign in to comment.