Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	foo_nowplayingv2/SDK
  • Loading branch information
tumugin committed Feb 24, 2018
2 parents 17771ca + 7d640ff commit 31f89eb
Show file tree
Hide file tree
Showing 376 changed files with 247 additions and 54,916 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "FluentWPF"]
path = FluentWPF
url = https://github.com/tumugin/FluentWPF.git
[submodule "foo_nowplayingv2/SDK"]
path = foo_nowplayingv2/SDK
url = https://github.com/tumugin/foobar2000_sdk.git
1 change: 1 addition & 0 deletions FluentWPF
Submodule FluentWPF added at 23b490
3 changes: 2 additions & 1 deletion MusicBeeNPPlugin/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public PluginInfo Initialise(IntPtr apiInterfacePtr)
about.TargetApplication = ""; // current only applies to artwork, lyrics or instant messenger name that appears in the provider drop down selector or target Instant Messenger
about.Type = PluginType.General;
about.VersionMajor = 1; // your plugin version
about.VersionMinor = 0;
about.VersionMinor = 2;
about.Revision = 1;
about.MinInterfaceVersion = MinInterfaceVersion;
about.MinApiRevision = MinApiRevision;
Expand Down Expand Up @@ -94,6 +94,7 @@ public void ReceiveNotification(string sourceFileUrl, NotificationType type)
sendmap.Add("albumart", mbApiInterface.NowPlaying_GetArtwork());
sendmap.Add("composer", mbApiInterface.NowPlaying_GetFileTag(MetaDataType.Composer));
sendmap.Add("year", mbApiInterface.NowPlaying_GetFileTag(MetaDataType.Year));
sendmap.Add("group", mbApiInterface.NowPlaying_GetFileTag(MetaDataType.Grouping));
var json = new JavaScriptSerializer() { MaxJsonLength = Int32.MaxValue }.Serialize(sendmap.ToDictionary(item => item.Key.ToString(), item => item.Value.ToString()));
Task.Run(() =>
{
Expand Down
4 changes: 2 additions & 2 deletions MusicBeeNPPlugin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます
// 以下のように '*' を使用します:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
8 changes: 7 additions & 1 deletion NowPlayingV2.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.26730.12
VisualStudioVersion = 15.0.27130.2027
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NowPlayingV2", "NowPlayingV2\NowPlayingV2.csproj", "{C566EADD-660D-44FF-A584-F7B9EAE6D2BB}"
EndProject
Expand All @@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NowPlayingV2UTest", "NowPla
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iTunesNPPlugin", "iTunesNPPlugin\iTunesNPPlugin.csproj", "{7CE43F7A-2BF9-4B89-B306-B8CA8F95D39F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentWPF", "FluentWPF\FluentWPF\FluentWPF.csproj", "{061B1DD9-815B-437F-8CD6-D20923BC0AF4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -33,6 +35,10 @@ Global
{7CE43F7A-2BF9-4B89-B306-B8CA8F95D39F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7CE43F7A-2BF9-4B89-B306-B8CA8F95D39F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7CE43F7A-2BF9-4B89-B306-B8CA8F95D39F}.Release|Any CPU.Build.0 = Release|Any CPU
{061B1DD9-815B-437F-8CD6-D20923BC0AF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{061B1DD9-815B-437F-8CD6-D20923BC0AF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{061B1DD9-815B-437F-8CD6-D20923BC0AF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{061B1DD9-815B-437F-8CD6-D20923BC0AF4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 1 addition & 0 deletions NowPlayingV2/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<!--Default UI Style-->
<ResourceDictionary Source="UI/Style/DefaultStyle.xaml"/>
<ResourceDictionary Source="UI/NotifyIcon/NotifyIconDic.xaml"/>
<ResourceDictionary Source="UI/Theme/acrylic/DisableAcrylic.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Expand Down
4 changes: 2 additions & 2 deletions NowPlayingV2/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
//Init Notify Icon
NotifyIconManager.NotifyIconSingleton.InitIcon();
//Start Pipe Listener
NowPlaying.PipeListener.MkStaticInstance();
//Start Auto Tweet
Expand All @@ -31,6 +29,8 @@ protected override void OnStartup(StartupEventArgs e)
Core.ConfigStore.StaticConfig.Theme.CurrentTheme.ApplyTheme();
UI.MainWindow.OpenSigletonWindow();
}
//Init Notify Icon
NotifyIconManager.NotifyIconSingleton.InitIcon();
//Check update
new UpdateChecker(NotifyIconManager.NotifyIconSingleton).CheckUpdateAsync();
//Start iTunes Plugin
Expand Down
45 changes: 45 additions & 0 deletions NowPlayingV2/NowPlaying/ManualTweet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NowPlayingV2.Core;

namespace NowPlayingV2.NowPlaying
{
public class ManualTweet
{
public static Task RunManualTweet()
{
return Task.Run(() =>
{
//check playing song
if (!(NowPlaying.PipeListener.staticpipelistener.LastPlayedSong?.Clone() is SongInfo songcache))
throw new Exception("何を再生されていなかったため、投稿できませんでした。");
//list up all accounts
if (!ConfigStore.StaticConfig.accountList.Any())
throw new Exception("アカウントが何も追加されていません。アカウントを追加してからこの操作を行ってください。");
if (!ConfigStore.StaticConfig.accountList.Any(itm => itm.Enabled))
throw new Exception("有効化されているアカウントが一つもありません。最低限一つのアカウントを有効化してください。");
ConfigStore.StaticConfig.accountList.Where(itm => itm.Enabled).ToList().ForEach(account =>
{
//make tweet string
var tweettext = Tsumugi.TweetConverter.SongInfoToString(ConfigStore.StaticConfig.TweetFormat,
songcache,
ConfigStore.StaticConfig.EnableAutoDeleteText140, account);
if (account.CountText(tweettext) > account.MaxTweetLength)
throw new Exception($"投稿可能な最大文字数({account.MaxTweetLength}文字)を超えたため、投稿出来ませんでした。");
//tweet
if (ConfigStore.StaticConfig.EnableTweetWithAlbumArt)
{
account.UpdateStatus(tweettext, songcache.AlbumArtBase64);
}
else
{
account.UpdateStatus(tweettext);
}
});
});
}
}
}
2 changes: 2 additions & 0 deletions NowPlayingV2/NowPlaying/SongInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class SongInfo : ICloneable
public string Composer { get; protected set; }
[JsonProperty("year")]
public string Year { get; protected set; }
[JsonProperty("group")]
public string Group { get; protected set; }

private Bitmap cachebitmap = null;

Expand Down
43 changes: 37 additions & 6 deletions NowPlayingV2/NowPlayingV2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -53,14 +55,17 @@
<ApplicationIcon>UI\NotifyIcon\nowplayingv2.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="CoreTweet, Version=0.8.1.394, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\CoreTweet.0.8.1.394\lib\net45\CoreTweet.dll</HintPath>
<Reference Include="ControlzEx, Version=3.0.2.4, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net462\ControlzEx.dll</HintPath>
</Reference>
<Reference Include="CoreTweet, Version=0.8.2.404, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\CoreTweet.0.8.2.404\lib\net45\CoreTweet.dll</HintPath>
</Reference>
<Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
</Reference>
<Reference Include="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath>
<Reference Include="MahApps.Metro, Version=1.6.0.362, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.6.0\lib\net45\MahApps.Metro.dll</HintPath>
</Reference>
<Reference Include="Mastonet, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Mastonet.1.2.0\lib\netstandard1.1\Mastonet.dll</HintPath>
Expand Down Expand Up @@ -162,7 +167,7 @@
<HintPath>..\packages\System.Text.RegularExpressions.4.3.0\lib\net463\System.Text.RegularExpressions.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net462\System.Windows.Interactivity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml" />
Expand All @@ -174,7 +179,7 @@
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
<HintPath>..\packages\System.Xml.ReaderWriter.4.3.1\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
Expand All @@ -194,6 +199,7 @@
<Compile Include="Matsuri\Princess.cs" />
<Compile Include="Matsuri\SeaSlug.cs" />
<Compile Include="NowPlaying\AutoTweet.cs" />
<Compile Include="NowPlaying\ManualTweet.cs" />
<Compile Include="Plugin\ITunesPlugin.cs" />
<Compile Include="Tsumugi\APIKey.cs" />
<Compile Include="Tsumugi\TweetConverter.cs" />
Expand Down Expand Up @@ -263,6 +269,18 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\Theme\acrylic\DisableAcrylic.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\Theme\acrylic\EnableAcrylic.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\Theme\acrylic_dark\acrylic_dark.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\Theme\dark\dark.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -333,10 +351,23 @@
<ItemGroup>
<Resource Include="UI\NotifyIcon\nowplayingv2.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FluentWPF\FluentWPF\FluentWPF.csproj">
<Project>{061b1dd9-815b-437f-8cd6-d20923bc0af4}</Project>
<Name>FluentWPF</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties Updater_4version_1json__JSONSchema="http://jsonapi.org/schema" />
</VisualStudio>
</ProjectExtensions>
<Import Project="..\packages\NETStandard.Library.2.0.1\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.1\build\netstandard2.0\NETStandard.Library.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>このプロジェクトは、このコンピューター上にない NuGet パッケージを参照しています。それらのパッケージをダウンロードするには、[NuGet パッケージの復元] を使用します。詳細については、http://go.microsoft.com/fwlink/?LinkID=322105 を参照してください。見つからないファイルは {0} です。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NETStandard.Library.2.0.1\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NETStandard.Library.2.0.1\build\netstandard2.0\NETStandard.Library.targets'))" />
</Target>
</Project>
4 changes: 2 additions & 2 deletions NowPlayingV2/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
1 change: 1 addition & 0 deletions NowPlayingV2/Tsumugi/TweetConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static string SongInfoToString(string pattern, SongInfo songinfo)
npstr = npstr.Replace("$Artist", songinfo.Artist);
npstr = npstr.Replace("$Composer", songinfo.Composer);
npstr = npstr.Replace("$Year", songinfo.Year);
npstr = npstr.Replace("$Group", songinfo.Group);
return npstr;
}

Expand Down
10 changes: 9 additions & 1 deletion NowPlayingV2/UI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:NowPlayingV2"
xmlns:fw="clr-namespace:SourceChord.FluentWPF;assembly=FluentWPF"
xmlns:UI="clr-namespace:NowPlayingV2.UI"
xmlns:CV="clr-namespace:NowPlayingV2.UI.View"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
fw:AcrylicWindow.Enabled="{DynamicResource UseAcrylic}"
fw:AcrylicWindow.ShowTitleBar="False"
fw:AcrylicWindow.TintColor="{DynamicResource WhiteColor}"
fw:AcrylicWindow.FallbackColor="{DynamicResource WhiteColor}"
fw:AcrylicWindow.TintOpacity="{DynamicResource AcrylicOpacity}"
fw:AcrylicWindow.NoiseOpacity="{DynamicResource AcrylicNoiseOpacity}"
Background="{DynamicResource WindowBackgroundBrush}"
GlowBrush="{DynamicResource AccentColorBrush}"
mc:Ignorable="d"
Title="なうぷれTunesV2" Height="486.207" Width="810.345" Loaded="Window_Loaded"
Expand Down Expand Up @@ -100,7 +108,7 @@
Text="{Binding TweetFormat, UpdateSourceTrigger=LostFocus}" />
<Label>
<TextBlock TextWrapping="WrapWithOverflow">
$Artist:アーティスト名 $AlbumArtist:アルバムアーティスト $Album:アルバム $Title:タイトル $PCount:再生回数 $Composer:作曲家 $Year:リリース年 改行:Enterキーで改行可能
$Artist:アーティスト名 $AlbumArtist:アルバムアーティスト $Album:アルバム $Title:タイトル $PCount:再生回数 $Composer:作曲家 $Year:リリース年 $Group:グループ 改行:Enterキーで改行可能
</TextBlock>
</Label>
<Label Content="プラグインの設定" FontSize="20" FontWeight="Bold" />
Expand Down
12 changes: 8 additions & 4 deletions NowPlayingV2/UI/NotifyIcon/NotifyIconDic.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@
x:Key="NPIcon">
<tb:TaskbarIcon.ContextMenu>
<ContextMenu>
<MenuItem x:Name="OnTweetDialog" Header="ツイート画面を表示する" />
<MenuItem x:Name="OnOpenSetting" Header="設定画面を開く" />
<MenuItem x:Name="OnAppExit" Header="なうぷれTunesV2を終了する" />
<MenuItem x:Name="OnTweetDialog" Header="ツイート画面を表示する(_T)" />
<MenuItem x:Name="OnTweetNow" Header="今すぐツイートする(_I)" />
<Separator/>
<MenuItem x:Name="IsAutoTweetEnabledMenuItem" IsCheckable="True" IsChecked="{Binding EnableAutoTweet}" Header="自動投稿を使用する(_J)"/>
<Separator/>
<MenuItem x:Name="OnOpenSetting" Header="設定画面を開く(_S)" />
<MenuItem x:Name="OnAppExit" Header="なうぷれTunesV2を終了する(_E)" />
<Separator x:Name="UpdateMenuSeparator" Visibility="Collapsed" />
<MenuItem x:Name="UpdateMenu" Header="アップデートのお知らせを開く" FontWeight="Bold" Visibility="Collapsed" />
<MenuItem x:Name="UpdateMenu" Header="アップデートのお知らせを開く(_U)" FontWeight="Bold" Visibility="Collapsed" />
</ContextMenu>
</tb:TaskbarIcon.ContextMenu>
</tb:TaskbarIcon>
Expand Down
28 changes: 18 additions & 10 deletions NowPlayingV2/UI/NotifyIcon/NotifyIconManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Windows;
using System.Windows.Controls;
using Hardcodet.Wpf.TaskbarNotification;
using NowPlayingV2.NowPlaying;

namespace NowPlayingV2.UI.NotifyIcon
{
Expand All @@ -19,19 +20,26 @@ public void InitIcon()
{
NPIcon = Application.Current.FindResource("NPIcon") as TaskbarIcon;
(LogicalTreeHelper.FindLogicalNode(NPIcon.ContextMenu, "OnOpenSetting") as MenuItem).Click +=
(sender, e) =>
{
UI.MainWindow.OpenSigletonWindow();
};
(sender, e) => { UI.MainWindow.OpenSigletonWindow(); };
(LogicalTreeHelper.FindLogicalNode(NPIcon.ContextMenu, "OnAppExit") as MenuItem).Click +=
(sender, e) =>
{
Application.Current.Shutdown();
};
(sender, e) => { Application.Current.Shutdown(); };
(LogicalTreeHelper.FindLogicalNode(NPIcon.ContextMenu, "OnTweetDialog") as MenuItem).Click +=
(sender, e) =>
(sender, e) => { (new TweetDialog()).Show(); };
(LogicalTreeHelper.FindLogicalNode(NPIcon.ContextMenu, "IsAutoTweetEnabledMenuItem") as MenuItem)
.DataContext = Core.ConfigStore.StaticConfig;
(LogicalTreeHelper.FindLogicalNode(NPIcon.ContextMenu, "OnTweetNow") as MenuItem).Click +=
async (sender, e) =>
{
(new TweetDialog()).Show();
try
{
await ManualTweet.RunManualTweet();
var song = NowPlaying.PipeListener.staticpipelistener.LastPlayedSong;
NPIcon.ShowBalloonTip("投稿完了", $"{song.Title}\n{song.Artist}\n{song.Album}", BalloonIcon.Info);
}
catch (Exception exception)
{
NPIcon.ShowBalloonTip("エラー", exception.Message, BalloonIcon.Info);
}
};
}

Expand Down
Loading

0 comments on commit 31f89eb

Please sign in to comment.