Skip to content

Commit

Permalink
fix way to get agqr server info
Browse files Browse the repository at this point in the history
  • Loading branch information
marihachi committed Jan 10, 2017
1 parent fe8cbfb commit 222d68b
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/Forms/Form1.Designer.cs

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

7 changes: 4 additions & 3 deletions src/Forms/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ private void UpdateForm()
private async void Form1_Load(object sender, EventArgs e)
{
Status("初期化しています...");
var asmInfo = Assembly.GetExecutingAssembly().GetName();
Text = string.Format(Text, asmInfo.Name, asmInfo.Version.ToString(3));

var title = Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute)) as AssemblyTitleAttribute;
Text = string.Format(Text, title.Title);

if (!File.Exists("rtmpdump.exe"))
{
Expand Down Expand Up @@ -258,7 +259,7 @@ private void issuesMainMenuItem_Click(object sender, EventArgs e)
private void versionMainMenuItem_Click(object sender, EventArgs e)
{
var asmInfo = Assembly.GetExecutingAssembly().GetName();
MessageBox.Show($"ver.{asmInfo.Version.ToString(3)}", $"{asmInfo.Name}のバージョン情報");
MessageBox.Show($"ver.{asmInfo.Version.ToString(4)}", $"{asmInfo.Name}のバージョン情報");
}

//
Expand Down
20 changes: 10 additions & 10 deletions src/Forms/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="agTimeReservationMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>573, 17</value>
</metadata>
<metadata name="agKeywordReservationMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>768, 18</value>
</metadata>
<metadata name="agProgramListViewMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>373, 17</value>
</metadata>
<metadata name="imageList1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>990, 18</value>
</metadata>
Expand All @@ -134,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACc
BAAAAk1TRnQBSQFMAwEBAAEoAQABKAEAARABAAEQAQAE/wEZAQAI/wFCAU0BNgcAATYDAAEoAwABQAMA
BAAAAk1TRnQBSQFMAwEBAAEwAQABMAEAARABAAEQAQAE/wEZAQAI/wFCAU0BNgcAATYDAAEoAwABQAMA
ARADAAEBAQABGAYAAQzYAAG3AaIBkwFjAUkBNQFjAUkBNQFjAUkBNQFjAUkBNQFjAUkBNQFjAUkBNQFj
AUkBNQFjAUkBNQFjAUkBNQFjAUkBNQFjAUkBNZwAAbcBogGTAfcB5QHcAbcBogGTAbcBogGTAbcBogGT
AbcBogGTAbcBogGTAbcBogGTAbcBogGTAbcBogGTAbcBogGTAWMBSQE1nAABtwGiAZMB+QHpAeIB+AHm
Expand All @@ -159,6 +150,15 @@
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>263, 17</value>
</metadata>
<metadata name="agTimeReservationMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>573, 17</value>
</metadata>
<metadata name="agKeywordReservationMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>768, 18</value>
</metadata>
<metadata name="agProgramListViewMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>373, 17</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
Expand Down
32 changes: 30 additions & 2 deletions src/Models/AgRecorder.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
using Stacker.Models.EventArgses;
using Codeplex.Data;
using Newtonsoft.Json;
using Stacker.Models.EventArgses;
using Stacker.Utilities;
using System;
using System.Diagnostics;
using System.IO;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;

namespace Stacker.Models
{
Expand Down Expand Up @@ -64,8 +69,31 @@ public void StartRecord(string filename, bool isVideo)
{
CreateOutputDirectory();

var doc = new XmlDocument();
doc.LoadXml(new HttpClient().GetAsync("http://www.uniqueradio.jp/agplayerf/getfmsListHD.php").Result.Content.ReadAsStringAsync().Result);
var jStr = JsonConvert.SerializeXmlNode(doc);
var j = DynamicJson.Parse(jStr);

string server = null;
string app = null;
string playpath = null;

foreach (var serverinfo in j.ag.serverlist.serverinfo)
{
if (string.IsNullOrEmpty(serverinfo.cryptography))
{
server = serverinfo.server;
app = serverinfo.app;
playpath = serverinfo.stream;
break;
}
}

if (server == null)
throw new ApplicationException("A&Gのストリーミングサーバー情報の取得に失敗しました。");

var process = ConsoleExecuter.StartOnConsole(
$"rtmpdump -v -r \"rtmpe://fms1.uniqueradio.jp/\" -a ?rtmp://fms-base2.mitene.ad.jp/agqr/ -y aandg22 | ffmpeg -y -i pipe:0 ./library/ag/temp_{Name}.{(isVideo ? "mp4" : "mp3")}");
$"rtmpdump -v -r \"{server}\" --app \"{app}\" --playpath {playpath} | ffmpeg -y -i pipe:0 ./library/ag/temp_{Name}.{(isVideo ? "mp4" : "mp3")}");

Filename = filename;
ConsoleProcess = process;
Expand Down
10 changes: 5 additions & 5 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("Stacker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("Stacker(α版)")]
[assembly: AssemblyDescription("A internet radio recording application")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Stacker")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyCopyright("Copyright © marihachi 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.4.0")]
[assembly: AssemblyFileVersion("0.0.4.0")]
[assembly: AssemblyVersion("0.0.4.1")]
[assembly: AssemblyFileVersion("0.0.4.1")]
2 changes: 1 addition & 1 deletion src/Utilities/ConsoleAppExecuter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static Process StartOnConsole(string command, int TimeoutMillisec = 0)
var p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.Arguments = $"/C {command}";
p.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
p.Start();

return p;
Expand Down

0 comments on commit 222d68b

Please sign in to comment.