Giter Club home page Giter Club logo

claudia's Introduction

Hi there 👋

Top Langs github stats

trophy

claudia's People

Contributors

asteriskx avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tumkit15

claudia's Issues

the designer shows the following error for all forms

The designer could not be shown for this file because none of the classes within 
it can be designed. The designer inspected the following classes in the file: 
LoginForm --- The base class 'System.Void' cannot be designed.

柔軟な型対応を行いたい

一部採用中...

		/// <summary>
		/// 
		/// </summary>
		/// <param name="track"></param>
		private void _NotifyTrackInfo<T>(T track) where T : SCFavoriteObjects
		{
			var os = Environment.OSVersion;
			this.notifyIcon.Icon = Properties.Resources.icon;

			if (os.Version.Major >= 6 && os.Version.Minor >= 2)
			{
				this.notifyIcon.BalloonTipTitle = $"Claudia NowPlaying\r\n";
				this.notifyIcon.BalloonTipText = $"{track.Title}\r\n{track.User.UserName}";
				Debug.WriteLine("トースト通知が表示されました。");
			}
			else
			{
				this.notifyIcon.BalloonTipTitle = $"Claudia NowPlaying";
				this.notifyIcon.BalloonTipText = $"{track.Title} - {track.User.UserName}\r\n";
				Debug.WriteLine("バルーン通知が表示されました。");
			}

			this.notifyIcon.ShowBalloonTip(3000);
		}

api-v2 対応

なぜ?

  • StreamingUrl : api-v1(提供されている現行の public API) では再生が出来なくなったため。
    • 2019/12 頃から仕様が変わってしまった模様。

冗長な処理を削る

Claudia/Claudia/MainForm.cs

Lines 482 to 503 in 9ad21d9

var length = this.SoundCloud.Playlists[tabIdx].Tracks.Length - 1;
if (trackIdx < length)
{
var nextTrack = this.SoundCloud.Playlists[tabIdx].Tracks[trackIdx + 1] ?? null;
this.NextAlbumArt.Image = Common.LoadImageFromUrl(nextTrack.ArtworkUrl) ?? Properties.Resources.none;
this.NextTrack.Text = nextTrack.Title ?? "-";
this.NextArtist.Text = nextTrack.User.UserName ?? "-";
this.CurrentPosition.Maximum = Common.GetCurrentTrackPositionToInt(track.Duration);
this._Commands.Play(this.SoundCloud, track);
this.PlayButton.Image = Properties.Resources.pause;
}
else
{
this.NextAlbumArt.Image = Properties.Resources.none;
this.NextTrack.Text = "-";
this.NextArtist.Text = "-";
this.CurrentPosition.Maximum = Common.GetCurrentTrackPositionToInt(track.Duration);
this._Commands.Play(this.SoundCloud, track);
this.PlayButton.Image = Properties.Resources.pause;
}

不要な Observer を削除する

/// <summary>
/// Claudia コマンド管理クラス
/// </summary>
public class ClaudiaCommands : Commands
{
#region Properties
/// <summary>
///
/// </summary>
private WindowsMediaPlayer _Wmp { get; set; }
private ClaudiaProperties _Properties { get; set; }
private ClaudiaObserver _Observer { get; set; }
#endregion Properties
#region Constructor
/// <summary>
///
/// </summary>
/// <param name="wmp"></param>
/// <param name="property"></param>
/// <param name="observer"></param>
public ClaudiaCommands(WindowsMediaPlayer wmp, ClaudiaProperties property, ClaudiaObserver observer)
{
this._Wmp = wmp;
this._Properties = property;
this._Observer = observer;
}

Twitter 投稿

  • 以下サンプル(動作確認済み。Twist を使用して投稿した場合。)
private async void Twitter_ButtonClick(object sender, EventArgs e)
{
	var track = this._SoundCloud.Likes[this._Count];

	var tw = new StringBuilder();
	tw.Append($"🎵 {track.Title}\r\n");
	tw.Append($"🎙 {track.User.UserName}\r\n");
	tw.Append("💿 Likes\r\n");
	tw.Append("#nowplaying #Claudia");

	var image = Common.LoadImageFromUrl(track.ArtworkUrl);
	await this._Twitter.UpdateWithTextAsync(tw.ToString());
}

NotifyIcon の扱いについて

  • Dispose を考慮すべきならば、using にて宣言すべきと判断した。

private NotifyIcon _Icon { get; set; } = new NotifyIcon { Visible = true, Icon = Properties.Resources.icon };
public NotifyMessage(T track)
{
var os = Environment.OSVersion;
if (track is SCFavoriteObjects)
{
var t = (SCFavoriteObjects)(object)track;
if (os.Version.Major >= 6 && os.Version.Minor >= 2)
{
this._Icon.BalloonTipTitle = $"Claudia NowPlaying\r\n";
this._Icon.BalloonTipText = $"{t.Title}\r\n{t.User.UserName}";
}
else
{
this._Icon.BalloonTipTitle = $"Claudia NowPlaying";
this._Icon.BalloonTipText = $"{t.Title} - {t.User.UserName}\r\n";
}
}
else if (track is Track)
{
var t = (Track)(object)track;
if (os.Version.Major >= 6 && os.Version.Minor >= 2)
{
this._Icon.BalloonTipTitle = $"Claudia NowPlaying\r\n";
this._Icon.BalloonTipText = $"{t.Title}\r\n{t.User.UserName}";
}
else
{
this._Icon.BalloonTipTitle = $"Claudia NowPlaying";
this._Icon.BalloonTipText = $"{t.Title} - {t.User.UserName}\r\n";
}
}

メモリ増加について

1曲再生するたびに 2MB ぐらい増加している状況。
GC が追いついていない???

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.