Skip to content

Commit

Permalink
Version 1.7.6
Browse files Browse the repository at this point in the history
Fixes in this release:
- More aggressive blocking (which includes podcasts as a side effect)
- Attempt default Spotify path if none found
  • Loading branch information
Xeroday committed Apr 23, 2020
1 parent ab690c3 commit a985319
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 12 deletions.
4 changes: 2 additions & 2 deletions EZBlocker/EZBlocker.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2042
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EZBlocker", "EZBlocker\EZBlocker.csproj", "{32C0D43C-E0F1-46D6-8661-EF5BE2566BA8}"
EndProject
Expand Down
16 changes: 14 additions & 2 deletions EZBlocker/EZBlocker/AudioUtils.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace EZBlocker
Expand All @@ -18,7 +17,7 @@ public static void SendPlayPause(IntPtr target)

public static void SendNextTrack(IntPtr target)
{
SendMessage(target, WM_APPCOMMAND, IntPtr.Zero, (IntPtr)MEDIA_PLAYPAUSE);
SendMessage(target, WM_APPCOMMAND, IntPtr.Zero, (IntPtr)MEDIA_NEXTTRACK);
}

public static bool? IsMuted(ISimpleAudioVolume v)
Expand Down Expand Up @@ -265,6 +264,19 @@ private interface IAudioMeterInformation
float GetPeakValue(out float pfPeak);
}

// Integrate with System Media Transport Controls
[Guid("99FA3FF4-1742-42A6-902E-087D41F965EC"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
private interface ISystemMediaTransportControls
{
int get_IsNextEnabled(out bool value);
}

[Guid("ddb0472d-c911-4a1f-86d9-dc3d71a95f5a"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
private interface ISystemMediaTransportControlsInterop
{
int GetForWindow(IntPtr appWindow, ref Guid iid, [MarshalAs(UnmanagedType.IUnknown)] out object mediaTransportControl);
}

// SendMessage for media controls
[DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);
Expand Down
21 changes: 21 additions & 0 deletions EZBlocker/EZBlocker/EZBlocker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="Costura, Version=1.6.2.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll</HintPath>
Expand Down Expand Up @@ -146,6 +156,17 @@
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<COMReference Include="stdole">
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.2.0.0\build\dotnet\Fody.targets" Condition="Exists('..\packages\Fody.2.0.0\build\dotnet\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
3 changes: 3 additions & 0 deletions EZBlocker/EZBlocker/EZBlockerMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ private void Main_Load(object sender, EventArgs e)
{
Properties.Settings.Default.SpotifyPath = spotifyPath;
Properties.Settings.Default.Save();
} else
{
spotifyPath = Environment.GetEnvironmentVariable("APPDATA") + @"\Spotify\spotify.exe";
}

// Start Spotify and give EZBlocker higher priority
Expand Down
4 changes: 2 additions & 2 deletions EZBlocker/EZBlocker/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.7.5.0")]
[assembly: AssemblyFileVersion("1.7.5.0")]
[assembly: AssemblyVersion("1.7.6.0")]
[assembly: AssemblyFileVersion("1.7.6.0")]
9 changes: 3 additions & 6 deletions EZBlocker/EZBlocker/SpotifyHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,10 @@ public bool IsPlaying()

public bool IsAdPlaying()
{
if (!WindowName.Equals("") && !WindowName.Equals("Drag") && IsPlaying())
if ((WindowName.Equals("Advertisement") || !WindowName.Contains(" - ")) && !WindowName.Equals("") && !WindowName.Equals("Drag") && IsPlaying())
{
if (WindowName.Equals("Advertisement") || WindowName.Equals("Spotify"))
{
Debug.WriteLine("Ad1: " + lastPeak.ToString() + " " + peak.ToString());
return true;
}
Debug.WriteLine("Ad: " + lastPeak.ToString() + " " + peak.ToString());
return true;
}
return false;
}
Expand Down

0 comments on commit a985319

Please sign in to comment.