Skip to content

Commit

Permalink
github fixes and faq updated
Browse files Browse the repository at this point in the history
  • Loading branch information
jwallet committed Oct 12, 2018
1 parent 28e4d22 commit f6fa69b
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 86 deletions.
4 changes: 3 additions & 1 deletion EspionSpotify/EspionSpotify.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@
<Compile Include="MediaTags\ILastFMAPI.cs" />
<Compile Include="MediaTags\IMP3Tags.cs" />
<Compile Include="MediaTags\MP3Tags.cs" />
<Compile Include="Models\GitHubRelease.cs" />
<Compile Include="Models\GitHub\Asset.cs" />
<Compile Include="Models\GitHub\Release.cs" />
<Compile Include="Models\GitHub\User.cs" />
<Compile Include="Models\LastFMTrack.cs" />
<Compile Include="IRecorder.cs" />
<Compile Include="Spotify\ISpotifyHandler.cs" />
Expand Down
28 changes: 18 additions & 10 deletions EspionSpotify/GitHub.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using EspionSpotify.Models;
using EspionSpotify.Models.GitHub;
using EspionSpotify.Properties;
using Newtonsoft.Json;
using System;
Expand All @@ -15,13 +15,15 @@ namespace EspionSpotify
{
internal static class GitHub
{
private static Regex _regex = new Regex(@"(\d+\.)(\d+\.)?(\d+\.)?(\*|\d+)");
private static Regex _regexVersion = new Regex(@"(\d+\.)(\d+\.)?(\d+\.)?(\*|\d+)");
private static Regex _regexTag = new Regex(@"[^0-9.]");
private const string _repoReleaseLink = "https://api.github.com/repos/jwallet/spy-spotify/releases/latest";

public static async void NewestVersion()
{
if (!Uri.TryCreate("https://api.github.com/repos/jwallet/spy-spotify/releases/latest", UriKind.Absolute, out var uri)) return;
if (!Uri.TryCreate(_repoReleaseLink, UriKind.Absolute, out var uri)) return;

ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
var request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = WebRequestMethods.Http.Get;
request.UserAgent = "Spytify";
Expand All @@ -40,17 +42,18 @@ public static async void NewestVersion()
}

var body = Encoding.UTF8.GetString(content.ToArray());
var release = JsonConvert.DeserializeObject<GitHubRelease>(body);
var release = JsonConvert.DeserializeObject<Release>(body);
var versionTag = ParseTagToVersionString(release.tag_name);

if (!_regex.IsMatch(release.tag_name)) return;
if (!_regexVersion.IsMatch(versionTag)) return;

var githubTagVersion = new Version(release.tag_name);
var githubTagVersion = new Version(versionTag);
var assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version;

if (githubTagVersion <= assemblyVersion) return;
if (LastVersionPrompted() == assemblyVersion) return;

var dialogTitle = $"{string.Format(FrmEspionSpotify.Rm.GetString($"msgNewVersionTitle"), githubTagVersion)}";
var dialogTitle = string.Format(FrmEspionSpotify.Rm.GetString($"msgNewVersionTitle"), githubTagVersion);
var dialogMessage = FrmEspionSpotify.Rm.GetString($"msgNewVersionContent");

if (!string.IsNullOrEmpty(release.body))
Expand Down Expand Up @@ -84,12 +87,17 @@ public static async void NewestVersion()
}
}

public static Version LastVersionPrompted()
private static Version LastVersionPrompted()
{
var lastVersionPromptedSaved = Settings.Default.LastVersionPrompted;
if (!_regex.IsMatch(lastVersionPromptedSaved)) return null;
if (!_regexVersion.IsMatch(lastVersionPromptedSaved)) return null;

return new Version(lastVersionPromptedSaved);
}

private static string ParseTagToVersionString(string tag)
{
return string.IsNullOrEmpty(tag) ? string.Empty : _regexTag.Replace(tag, string.Empty);
}
}
}
22 changes: 22 additions & 0 deletions EspionSpotify/Models/GitHub/Asset.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;

namespace EspionSpotify.Models.GitHub
{
[Serializable]
internal class Asset
{
public string url { get; set; }
public int id { get; set; }
public string node_id { get; set; }
public string name { get; set; }
public string lable { get; set; }
public User uploader { get; set; }
public string content_type { get; set; }
public string state { get; set; }
public int? size { get; set; }
public int? download_count { get; set; }
public DateTime? created_at { get; set; }
public DateTime? updated_at { get; set; }
public string browser_download_url { get; set; }
}
}
26 changes: 26 additions & 0 deletions EspionSpotify/Models/GitHub/Release.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;

namespace EspionSpotify.Models.GitHub
{
[Serializable]
internal class Release
{
public string url { get; set; }
public string assets_url { get; set; }
public string upload_url { get; set; }
public string html_url { get; set; }
public int id { get; set; }
public string node_id { get; set; }
public string tag_name { get; set; }
public string target_commitish { get; set; }
public bool draft { get; set; }
public User author { get; set; }
public bool prerelease { get; set; }
public DateTime? created_at { get; set; }
public DateTime? published_at { get; set; }
public Asset[] assets { get; set; }
public string tarball_url { get; set; }
public string zipball_url { get; set; }
public string body { get; set; }
}
}
27 changes: 27 additions & 0 deletions EspionSpotify/Models/GitHub/User.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;

namespace EspionSpotify.Models.GitHub
{
[Serializable]
internal class User
{
public string login { get; set; }
public int id { get; set; }
public string node_id { get; set; }
public string avatar_url { get; set; }
public string gravatar_id { get; set; }
public string url { get; set; }
public string html_url { get; set; }
public string followers_url { get; set; }
public string following_url { get; set; }
public string gists_url { get; set; }
public string starred_url { get; set; }
public string subscriptions_url { get; set; }
public string organizations_url { get; set; }
public string repos_url { get; set; }
public string events_url { get; set; }
public string received_events_url { get; set; }
public string type { get; set; }
public bool site_admin { get; set; }
}
}
71 changes: 0 additions & 71 deletions EspionSpotify/Models/GitHubRelease.cs

This file was deleted.

2 changes: 1 addition & 1 deletion EspionSpotify/english.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion EspionSpotify/english.resx
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@
<comment>interface</comment>
</data>
<data name="lblBackgroundNoiceRecordedOnTrack" xml:space="preserve">
<value>Spytify disables most apps when the recording session starts. Make sure to mute in the "Volume Mixer" all applications running in a background process in your system tray that can emit a sound as well as all applications that you open while recording. Only Spotify and Spytify should not be muted.</value>
<value>First case, Spytify disables most apps when the recording session starts. Make sure to mute in the "Volume Mixer" all applications running in a background process in your system tray that can emit a sound as well as all applications that you open while recording. Only Spotify and Spytify should not be muted. Second case, you might experiment some cracking/popping sounds when playing a recorded file over the whole listening. These sounds are related to the quality (bitrate) being different from Spotify to Spytify. You need to make sure that the Spytify bitrate quality matches your Spotify app version. Spotify Free can't have the same quality as Spotify Premium. If you have Spotify Premium, you need to check the High Quality 320kbps chekbox in your Spotify settings to be able to use the highest recording quality in Spytify.</value>
<comment>interface</comment>
</data>
<data name="lblSpotifyTrackCut" xml:space="preserve">
Expand Down
2 changes: 1 addition & 1 deletion EspionSpotify/french.resx
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@
<comment>interface</comment>
</data>
<data name="lblBackgroundNoiceRecordedOnTrack" xml:space="preserve">
<value>Spytify désactive la plupart des applications quand la session d'enregistrement débute. Veuillez couper le son par le "Mélangeur de volume" des applications roulants dans un processus d'arrière-plan dans la barre d'état système pouvant émettre un son ainsi que tout autre application que vous utilisez durant la session d'enregistrement. Seulement Spotify et Spytify ne doivent pas être à muet.</value>
<value>Premier cas, Spytify désactive la plupart des applications quand la session d'enregistrement débute. Veuillez couper le son par le "Mélangeur de volume" des applications exécutées dans un processus d'arrière-plan dans la barre d'état système pouvant émettre un son ainsi que tout autre application que vous utilisez durant la session d'enregistrement. Seulement Spotify et Spytify ne doivent pas être à muet. Deuxième cas, il se peut qu'à l'écoute des fichiers audio vous entendiez des sons (pops et craquements) jouant à des périodes régulières tout au long de l'écoute. Ces sons sont principalement liéés au fait que vous avez paramétré une qualité (bitrate) différente de Spotify à Spytify. Vous devez vous assurer d'avoir mis la qualité correspondant à votre version de Spotify. Spotify Free ne peut avoir une qualité de Spotify Premium. Si vous avez Premium, vous devez cocher dans vos paramètres l'option "Haute Qualité 320kbps" pour bénéficier de l'enregistrement à 320kbps avec Spytify.</value>
<comment>interface</comment>
</data>
<data name="lblSpotifyTrackCut" xml:space="preserve">
Expand Down
2 changes: 1 addition & 1 deletion EspionSpotify/french1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f6fa69b

Please sign in to comment.