├── etc
├── default
│ ├── tuner.def
│ ├── epgwait.def
│ ├── log.db
│ ├── tvmaid-5.db
│ ├── genre1.def
│ ├── main.def
│ ├── pd.def
│ ├── hls.def
│ ├── genre2.def
│ ├── convert.def
│ └── genre.def
├── web-del.bat
├── web.bat
├── rplsinfo.exe
└── wwwroot
│ ├── favicon.ico
│ ├── maya
│ ├── nologo.jpg
│ ├── theme-blue.css
│ ├── theme-darkmagenta.css
│ ├── pagetab.tag.html
│ ├── genre-tvmaid.css
│ ├── genre-tvrock.css
│ ├── genre-tvtest.css
│ ├── parts.tag.html
│ ├── webapi.js
│ ├── main-menu.tag.html
│ ├── jslib.js
│ ├── index.html
│ └── log.tag.html
│ ├── material-icons
│ ├── MaterialIcons-Regular.ttf
│ ├── MaterialIcons-Regular.woff
│ ├── MaterialIcons-Regular.woff2
│ └── material-icons.css
│ └── lib
│ └── route.min.js
├── icon
├── lady.ico
├── timer.ico
└── high-heeled.ico
├── Tvmaid
├── lady.ico
├── app.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Gui
│ ├── ExitForm.cs
│ ├── SleepCountdown.cs
│ ├── ExitForm.Designer.cs
│ ├── MainForm.cs
│ ├── SleepCountdown.Designer.cs
│ ├── ExitForm.resx
│ └── SleepCountdown.resx
├── Log.cs
├── Data
│ ├── Tuner.cs
│ ├── Service.cs
│ ├── Record.cs
│ ├── Event.cs
│ └── AutoReserve.cs
├── Program.cs
├── Web
│ ├── WebApiBase.cs
│ └── WebServer.cs
├── Streaming
│ ├── VideoStreamReader.cs
│ ├── HlsPlaylist.cs
│ ├── Encoder.cs
│ └── WebPdStream.cs
├── TunerUpdater.cs
├── TvServer
│ ├── TvServer.cs
│ └── TvServerApi.cs
└── TsFileInfo.cs
├── lib
├── DynamicJson.dll
└── System.Data.SQLite.dll
├── Timekeeper
├── timer.ico
├── App.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Program.cs
├── Util.cs
└── Timekeeper.csproj
├── TvmaidPlugin
├── stdafx.h
├── stdafx.cpp
├── targetver.h
├── Exports.def
├── TVTestPlugin.h
├── TvmaidPlugin.h
├── TvmaidPluginBase.h
├── TvmaidPlugin.cpp
├── ReadMe.txt
├── TvmaidPlugin.vcxproj.filters
└── TvmaidPlugin.vcxproj
├── Maidbar
├── high-heeled.ico
├── App.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Program.cs
├── Util.cs
└── Maidbar.csproj
├── LICENSE.txt
├── readme.html
└── readme.md
/etc/default/tuner.def:
--------------------------------------------------------------------------------
1 |
2 | //チューナ設定
3 |
4 |
--------------------------------------------------------------------------------
/etc/default/epgwait.def:
--------------------------------------------------------------------------------
1 | default=60
2 | 4=180
3 | 6=180
4 | 7=180
5 |
--------------------------------------------------------------------------------
/etc/web-del.bat:
--------------------------------------------------------------------------------
1 | netsh http delete urlacl url=http://+:20001/
2 | pause
3 |
--------------------------------------------------------------------------------
/etc/web.bat:
--------------------------------------------------------------------------------
1 | netsh http add urlacl url=http://+:20001/ user=Everyone
2 | pause
3 |
--------------------------------------------------------------------------------
/icon/lady.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/icon/lady.ico
--------------------------------------------------------------------------------
/icon/timer.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/icon/timer.ico
--------------------------------------------------------------------------------
/Tvmaid/lady.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/Tvmaid/lady.ico
--------------------------------------------------------------------------------
/etc/rplsinfo.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/etc/rplsinfo.exe
--------------------------------------------------------------------------------
/etc/default/log.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/etc/default/log.db
--------------------------------------------------------------------------------
/lib/DynamicJson.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/lib/DynamicJson.dll
--------------------------------------------------------------------------------
/Timekeeper/timer.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/Timekeeper/timer.ico
--------------------------------------------------------------------------------
/TvmaidPlugin/stdafx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/TvmaidPlugin/stdafx.h
--------------------------------------------------------------------------------
/icon/high-heeled.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/icon/high-heeled.ico
--------------------------------------------------------------------------------
/Maidbar/high-heeled.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/Maidbar/high-heeled.ico
--------------------------------------------------------------------------------
/TvmaidPlugin/stdafx.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/TvmaidPlugin/stdafx.cpp
--------------------------------------------------------------------------------
/TvmaidPlugin/targetver.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/TvmaidPlugin/targetver.h
--------------------------------------------------------------------------------
/etc/default/tvmaid-5.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/etc/default/tvmaid-5.db
--------------------------------------------------------------------------------
/etc/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/etc/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/lib/System.Data.SQLite.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/lib/System.Data.SQLite.dll
--------------------------------------------------------------------------------
/TvmaidPlugin/Exports.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | TVTGetVersion
3 | TVTGetPluginInfo
4 | TVTInitialize
5 | TVTFinalize
6 |
--------------------------------------------------------------------------------
/TvmaidPlugin/TVTestPlugin.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/TvmaidPlugin/TVTestPlugin.h
--------------------------------------------------------------------------------
/TvmaidPlugin/TvmaidPlugin.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/TvmaidPlugin/TvmaidPlugin.h
--------------------------------------------------------------------------------
/etc/wwwroot/maya/nologo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/etc/wwwroot/maya/nologo.jpg
--------------------------------------------------------------------------------
/TvmaidPlugin/TvmaidPluginBase.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/TvmaidPlugin/TvmaidPluginBase.h
--------------------------------------------------------------------------------
/etc/wwwroot/material-icons/MaterialIcons-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/etc/wwwroot/material-icons/MaterialIcons-Regular.ttf
--------------------------------------------------------------------------------
/etc/wwwroot/material-icons/MaterialIcons-Regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/etc/wwwroot/material-icons/MaterialIcons-Regular.woff
--------------------------------------------------------------------------------
/etc/wwwroot/material-icons/MaterialIcons-Regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tsukumijima/TvmaidMAYA/master/etc/wwwroot/material-icons/MaterialIcons-Regular.woff2
--------------------------------------------------------------------------------
/Tvmaid/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/TvmaidPlugin/TvmaidPlugin.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 | #include "TvmaidPlugin.h"
4 |
5 | CTVTestPlugin* CreatePluginClass()
6 | {
7 | return new TvmaidPlugin();
8 | }
9 |
--------------------------------------------------------------------------------
/Maidbar/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Timekeeper/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/etc/default/genre1.def:
--------------------------------------------------------------------------------
1 | 0x0=ニュース/報道
2 | 0x1=スポーツ
3 | 0x2=情報/ワイドショー
4 | 0x3=ドラマ
5 | 0x4=音楽
6 | 0x5=バラエティ
7 | 0x6=映画
8 | 0x7=アニメ/特撮
9 | 0x8=ドキュメンタリー/教養
10 | 0x9=劇場/公演
11 | 0xA=趣味/教育
12 | 0xB=福祉
13 | 0xC=予備
14 | 0xD=予備
15 | 0xE=拡張
16 | 0xF=その他
17 |
--------------------------------------------------------------------------------
/etc/wwwroot/maya/theme-blue.css:
--------------------------------------------------------------------------------
1 |
2 | html,
3 | body
4 | {
5 | background-color: #0084e7;
6 | }
7 |
8 | .header-bar
9 | {
10 | background-color: #0084e7;
11 | }
12 |
13 | .video-content
14 | {
15 | background-color: black;
16 | }
17 |
--------------------------------------------------------------------------------
/etc/wwwroot/maya/theme-darkmagenta.css:
--------------------------------------------------------------------------------
1 |
2 | html,
3 | body
4 | {
5 | background-color: darkmagenta;
6 | }
7 |
8 | .header-bar
9 | {
10 | background-color: darkmagenta;
11 | }
12 |
13 | .video-content
14 | {
15 | background-color: black;
16 | }
17 |
--------------------------------------------------------------------------------
/Maidbar/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Timekeeper/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Tvmaid/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/etc/default/main.def:
--------------------------------------------------------------------------------
1 | tvtest=
2 | record.folder=
3 | record.margin.start=10
4 | record.margin.end=10
5 | record.file={title}-{start-yy}{start-MM}{start-dd}-{start-hh}{start-mm}.ts
6 | epg.hour=9
7 | url=http://+:20001/
8 | autosleep=off
9 | postprocess=
10 | epgurl=http://localhost:20001/maya/index.html
11 | epg.basic=4,6,7
12 | chat.niconico.mail=
13 | chat.niconico.password=
14 |
--------------------------------------------------------------------------------
/etc/default/pd.def:
--------------------------------------------------------------------------------
1 | encoder=ffmpeg.exe
2 | type=video/webm
3 | window=hide
4 |
5 | high=-i pipe: -vcodec libvpx -b 700k -quality realtime -s 1280x720 -r 30000/1001 -acodec libvorbis -ab 128k -f webm -
6 | middle=-i pipe: -vcodec libvpx -b 700k -quality realtime -s 1024x576 -r 30000/1001 -acodec libvorbis -ab 128k -f webm -
7 | low=-i pipe: -vcodec libvpx -b 700k -quality realtime -s 512x288 -r 30000/1001 -acodec libvorbis -ab 128k -f webm -
8 |
--------------------------------------------------------------------------------
/Maidbar/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace Tvmaid
5 | {
6 | static class Program
7 | {
8 | ///
9 | /// アプリケーションのメイン エントリ ポイントです。
10 | ///
11 | [STAThread]
12 | static void Main()
13 | {
14 | Application.EnableVisualStyles();
15 | Application.SetCompatibleTextRenderingDefault(false);
16 | Application.Run(new MainForm());
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Timekeeper/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace Tvmaid
5 | {
6 | static class Program
7 | {
8 | ///
9 | /// アプリケーションのメイン エントリ ポイントです。
10 | ///
11 | [STAThread]
12 | static void Main()
13 | {
14 | Application.EnableVisualStyles();
15 | Application.SetCompatibleTextRenderingDefault(false);
16 | Application.Run(new MainForm());
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Tvmaid/Gui/ExitForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace Tvmaid
5 | {
6 | public partial class ExitForm : Form
7 | {
8 | public ExitForm(int timeout)
9 | {
10 | InitializeComponent();
11 |
12 | this.progressBar.Maximum = timeout;
13 | }
14 |
15 | private void timer_Tick(object sender, EventArgs e)
16 | {
17 | if (progressBar.Maximum > progressBar.Value + 1)
18 | this.progressBar.Value++;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/etc/default/hls.def:
--------------------------------------------------------------------------------
1 | encoder=ffmpeg.exe
2 | window=hide
3 |
4 | high=-i pipe: -f hls -hls_time 2 -hls_list_size 1 -hls_segment_filename {segment-id}-%d.ts -vcodec libx264 -quality realtime -s 1280x720 -vb 512k -r 30 -g 60 -flags +loop-global_header -acodec aac -ar 48000 -ab 192k -ac 2 -
5 | middle=-i pipe: -f hls -hls_time 2 -hls_list_size 1 -hls_segment_filename {segment-id}-%d.ts -vcodec libx264 -quality realtime -s 1024x576 -vb 512k -r 30 -g 60 -flags +loop-global_header -acodec aac -ar 48000 -ab 192k -ac 2 -
6 | low=-i pipe: -f hls -hls_time 2 -hls_list_size 1 -hls_segment_filename {segment-id}-%d.ts -vcodec libx264 -quality realtime -s 512x288 -vb 512k -r 30 -g 60 -flags +loop-global_header -acodec aac -ar 48000 -ab 192k -ac 2 -
7 |
--------------------------------------------------------------------------------
/etc/wwwroot/maya/pagetab.tag.html:
--------------------------------------------------------------------------------
1 |
27 |
--------------------------------------------------------------------------------
/Tvmaid/Gui/SleepCountdown.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace Tvmaid
5 | {
6 | public partial class SleepCountdown : Form
7 | {
8 | int count = 60;
9 |
10 | public SleepCountdown(DateTime wakeTime)
11 | {
12 | InitializeComponent();
13 |
14 | wakeTimeLable.Text = "復帰予定 " + wakeTime.ToString("MM/dd HH:mm");
15 | }
16 |
17 | private void timer_Tick(object sender, EventArgs e)
18 | {
19 | countLabel.Text = "スリープまで {0} 秒".Formatex(count);
20 | progressBar.Value = progressBar.Maximum - count;
21 |
22 | if (count == 0)
23 | {
24 | this.DialogResult = DialogResult.OK;
25 | timer.Stop();
26 | }
27 | else count--;
28 | }
29 |
30 | private void sleepButton_Click(object sender, EventArgs e)
31 | {
32 | this.DialogResult = DialogResult.OK;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/etc/wwwroot/maya/genre-tvmaid.css:
--------------------------------------------------------------------------------
1 |
2 | .news
3 | {
4 | background-color: white;
5 | }
6 |
7 | .sports
8 | {
9 | background-color: white;
10 | }
11 |
12 | .infomation
13 | {
14 | background-color: white;
15 | }
16 |
17 | .dorama
18 | {
19 | background-color: lightcyan;
20 | }
21 |
22 | .music
23 | {
24 | background-color: white;
25 | }
26 |
27 | .variety
28 | {
29 | background-color: lightyellow;
30 | }
31 |
32 | .movie
33 | {
34 | background-color: lightgreen;
35 | }
36 |
37 | .anime
38 | {
39 | background-color: mistyrose;
40 | }
41 |
42 | .documentary
43 | {
44 | background-color: white;
45 | }
46 |
47 | .performance
48 | {
49 | background-color: white;
50 | }
51 |
52 | .education
53 | {
54 | background-color: white;
55 | }
56 |
57 | .welfare
58 | {
59 | background-color: white;
60 | }
61 |
62 | .genre-etc
63 | {
64 | background-color: white;
65 | }
66 |
67 | .genre-none
68 | {
69 | background-color: white;
70 | }
71 |
--------------------------------------------------------------------------------
/etc/wwwroot/maya/genre-tvrock.css:
--------------------------------------------------------------------------------
1 |
2 | .news
3 | {
4 | background-color: #d4ffc8;
5 | }
6 |
7 | .sports
8 | {
9 | background-color: #ffccef;
10 | }
11 |
12 | .infomation
13 | {
14 | background-color: #f0f0f0;
15 | }
16 |
17 | .dorama
18 | {
19 | background-color: #ffbbbb;
20 | }
21 |
22 | .music
23 | {
24 | background-color: #b6f2ff;
25 | }
26 |
27 | .variety
28 | {
29 | background-color: #faffb0;
30 | }
31 |
32 | .movie
33 | {
34 | background-color: #ccfcf4;
35 | }
36 |
37 | .anime
38 | {
39 | background-color: #dcddff;
40 | }
41 |
42 | .documentary
43 | {
44 | background-color: #f0f0f0;
45 | }
46 |
47 | .performance
48 | {
49 | background-color: #f0f0f0;
50 | }
51 |
52 | .education
53 | {
54 | background-color: #f0f0f0;
55 | }
56 |
57 | .welfare
58 | {
59 | background-color: #f0f0f0;
60 | }
61 |
62 | .genre-etc
63 | {
64 | background-color: #f0f0f0;
65 | }
66 |
67 | .genre-none
68 | {
69 | background-color: #f0f0f0;
70 | }
71 |
--------------------------------------------------------------------------------
/Maidbar/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // このコードはツールによって生成されました。
4 | // ランタイム バージョン:4.0.30319.42000
5 | //
6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | // コードが再生成されるときに損失したりします。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Tvmaid.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Tvmaid/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // このコードはツールによって生成されました。
4 | // ランタイム バージョン:4.0.30319.42000
5 | //
6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | // コードが再生成されるときに損失したりします。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Tvmaid.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Timekeeper/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // このコードはツールによって生成されました。
4 | // ランタイム バージョン:4.0.30319.42000
5 | //
6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | // コードが再生成されるときに損失したりします。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Tvmaid.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 tvmaid project
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/etc/wwwroot/material-icons/material-icons.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'Material Icons';
3 | font-style: normal;
4 | font-weight: 400;
5 | src: url(MaterialIcons-Regular.eot); /* For IE6-8 */
6 | src: local('Material Icons'),
7 | local('MaterialIcons-Regular'),
8 | url(MaterialIcons-Regular.woff2) format('woff2'),
9 | url(MaterialIcons-Regular.woff) format('woff'),
10 | url(MaterialIcons-Regular.ttf) format('truetype');
11 | }
12 |
13 | .material-icons {
14 | font-family: 'Material Icons';
15 | font-weight: normal;
16 | font-style: normal;
17 | font-size: 24px; /* Preferred icon size */
18 | display: inline-block;
19 | /* この指定があるとずれる */
20 | /* line-height: 1; */
21 | text-transform: none;
22 | letter-spacing: normal;
23 | word-wrap: normal;
24 | white-space: nowrap;
25 | direction: ltr;
26 |
27 | /* Support for all WebKit browsers. */
28 | -webkit-font-smoothing: antialiased;
29 | /* Support for Safari and Chrome. */
30 | text-rendering: optimizeLegibility;
31 |
32 | /* Support for Firefox. */
33 | -moz-osx-font-smoothing: grayscale;
34 |
35 | /* Support for IE. */
36 | font-feature-settings: 'liga';
37 | }
38 |
--------------------------------------------------------------------------------
/etc/wwwroot/maya/genre-tvtest.css:
--------------------------------------------------------------------------------
1 |
2 | .news
3 | {
4 | background-color: rgb(255, 255, 224);
5 | }
6 |
7 | .sports
8 | {
9 | background-color: rgb(224, 224, 255);
10 | }
11 |
12 | .infomation
13 | {
14 | background-color: rgb(255, 224, 240);
15 | }
16 |
17 | .dorama
18 | {
19 | background-color: rgb(255, 224, 224);
20 | }
21 |
22 | .music
23 | {
24 | background-color: rgb(224, 255, 224);
25 | }
26 |
27 | .variety
28 | {
29 | background-color: rgb(224, 255, 255);
30 | }
31 |
32 | .movie
33 | {
34 | background-color: rgb(255, 240, 224);
35 | }
36 |
37 | .anime
38 | {
39 | background-color: rgb(255, 224, 255);
40 | }
41 |
42 | .documentary
43 | {
44 | background-color: rgb(255, 255, 224);
45 | }
46 |
47 | .performance
48 | {
49 | background-color: rgb(255, 240, 224);
50 | }
51 |
52 | .education
53 | {
54 | background-color: rgb(224, 240, 255);
55 | }
56 |
57 | .welfare
58 | {
59 | background-color: rgb(224, 240, 255);
60 | }
61 |
62 | .genre-etc
63 | {
64 | background-color: rgb(240, 240, 240);
65 | }
66 |
67 | .genre-none
68 | {
69 | background-color: rgb(240, 240, 240);
70 | }
71 |
--------------------------------------------------------------------------------
/Maidbar/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
6 | // アセンブリに関連付けられている情報を変更するには、
7 | // これらの属性値を変更してください。
8 | [assembly: AssemblyTitle("Maidbar")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Maidbar")]
13 | [assembly: AssemblyCopyright("(C) 2018 tvmaid project")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
18 | // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
19 | // その型の ComVisible 属性を true に設定してください。
20 | [assembly: ComVisible(false)]
21 |
22 | // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
23 | [assembly: Guid("1d08774b-ccb7-4ac8-8871-76d111b0d13b")]
24 |
25 | // アセンブリのバージョン情報は次の 4 つの値で構成されています:
26 | //
27 | // メジャー バージョン
28 | // マイナー バージョン
29 | // ビルド番号
30 | // Revision
31 | //
32 | // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
33 | // 既定値にすることができます:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Timekeeper/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
6 | // アセンブリに関連付けられている情報を変更するには、
7 | // これらの属性値を変更してください。
8 | [assembly: AssemblyTitle("Timekeeper")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Timekeeper")]
13 | [assembly: AssemblyCopyright("(C) 2018 tvmaid project")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
18 | // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
19 | // その型の ComVisible 属性を true に設定してください。
20 | [assembly: ComVisible(false)]
21 |
22 | // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
23 | [assembly: Guid("c5fd8e92-676d-41f7-b30e-2b4797408d08")]
24 |
25 | // アセンブリのバージョン情報は次の 4 つの値で構成されています:
26 | //
27 | // メジャー バージョン
28 | // マイナー バージョン
29 | // ビルド番号
30 | // Revision
31 | //
32 | // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
33 | // 既定値にすることができます:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Tvmaid/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
6 | // アセンブリに関連付けられている情報を変更するには、
7 | // これらの属性値を変更してください。
8 | [assembly: AssemblyTitle("Tvmaid MAYA")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Tvmaid MAYA")]
13 | [assembly: AssemblyCopyright("(C) 2018 tvmaid project")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
18 | // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
19 | // その型の ComVisible 属性を true に設定してください。
20 | [assembly: ComVisible(false)]
21 |
22 | // 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です
23 | [assembly: Guid("4dd212c7-0189-45bc-bed1-9fcee63e63aa")]
24 |
25 | // アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
33 | // 既定値にすることができます:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Tvmaid/Log.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Tvmaid
5 | {
6 | static class Log
7 | {
8 | static Ldb ldb;
9 |
10 | public static void Open()
11 | {
12 | ldb = new Ldb(true);
13 | }
14 |
15 | public static void Close()
16 | {
17 | ldb.Dispose();
18 | }
19 |
20 | public static void EpgUpdate(string text)
21 | {
22 | Write(text, 4);
23 | }
24 |
25 | public static void Error(string text)
26 | {
27 | Write(text, 3);
28 | }
29 |
30 | public static void Alert(string text)
31 | {
32 | Write(text, 2);
33 | }
34 |
35 | public static void Info(string text)
36 | {
37 | Write(text, 1);
38 | }
39 |
40 | public static void Debug(string text)
41 | {
42 | Write(text, 0);
43 | }
44 |
45 | static void Write(string text, int type)
46 | {
47 | lock (ldb)
48 | {
49 | ldb.Sql = "insert into log values ({0}, {1}, '{2}')".Formatex(DateTime.Now.Ticks, type, Ldb.SqlEncode(text));
50 | ldb.Execute();
51 | }
52 | }
53 | }
54 |
55 | public class Ldb : Database
56 | {
57 | protected override string Path
58 | {
59 | get { return "log.db"; }
60 | }
61 |
62 | public Ldb() { }
63 |
64 | public Ldb(bool open) : base(open) { }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/TvmaidPlugin/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ========================================================================
2 | ダイナミック リンク ライブラリ: TvmaidPlugin プロジェクトの概要
3 | ========================================================================
4 |
5 | この TvmaidPlugin DLL は、AppWizard により作成されました。
6 |
7 | このファイルには、TvmaidPlugin アプリケーションを構成する各ファイルの内容の概要が含まれています。
8 |
9 |
10 | TvmaidPlugin.vcxproj
11 | これは、アプリケーション ウィザードを使用して生成された VC++ プロジェクトのメイン プロジェクト ファイルです。ファイルを生成した Visual C++ のバージョンに関する情報と、アプリケーション ウィザードで選択されたプラットフォーム、構成、およびプロジェクト機能に関する情報が含まれています。
12 |
13 | TvmaidPlugin.vcxproj.filters
14 | これは、アプリケーション ウィザードで生成された VC++ プロジェクトのフィルター ファイルです。このファイルには、プロジェクト内のファイルとフィルターとの間の関連付けに関する情報が含まれています。この関連付けは、特定のノードで同様の拡張子を持つファイルのグループ化を示すために IDE で使用されます (たとえば、".cpp" ファイルは "ソース ファイル" フィルターに関連付けられています)。
15 |
16 | TvmaidPlugin.cpp
17 | これは、メインの DLL ソース ファイルです。
18 |
19 | この DLL の作成時には、シンボルがエクスポートされません。その結果、ビルド時に .lib ファイルが生成されません。このプロジェクトを他のプロジェクトの依存関係に追加する場合は、コードを追加して DLL からシンボルをエクスポートし、エクスポート ライブラリが生成されるようにするか、またはプロジェクトの [プロパティ ページ] ダイアログ ボックスにある [リンカー] フォルダーの [全般] プロパティ ページで、"インポート ライブラリの無視" プロパティを [はい] に設定します。
20 |
21 | /////////////////////////////////////////////////////////////////////////////
22 | その他の標準ファイル :
23 |
24 | StdAfx.h, StdAfx.cpp
25 | これらのファイルは、TvmaidPlugin.pch という名前のプリコンパイル済みヘッダー (PCH) ファイルと、StdAfx.obj という名前のプリコンパイル済みの型ファイルをビルドするために使用されます。
26 |
27 | /////////////////////////////////////////////////////////////////////////////
28 | その他のメモ :
29 |
30 | AppWizard では "TODO:" コメントを使用して、ユーザーが追加またはカスタマイズする必要のあるソース コードを示します。
31 |
32 | /////////////////////////////////////////////////////////////////////////////
33 |
--------------------------------------------------------------------------------
/TvmaidPlugin/TvmaidPlugin.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | ヘッダー ファイル
23 |
24 |
25 | ヘッダー ファイル
26 |
27 |
28 | ヘッダー ファイル
29 |
30 |
31 | ソース ファイル
32 |
33 |
34 | ソース ファイル
35 |
36 |
37 |
38 |
39 | ソース ファイル
40 |
41 |
42 | ソース ファイル
43 |
44 |
45 |
46 |
47 | ソース ファイル
48 |
49 |
50 |
--------------------------------------------------------------------------------
/etc/default/genre2.def:
--------------------------------------------------------------------------------
1 | 0x00=定時・総合
2 | 0x01=天気
3 | 0x02=特集・ドキュメント
4 | 0x03=政治・国会
5 | 0x04=経済・市況
6 | 0x05=海外・国際
7 | 0x06=解説
8 | 0x07=討論・会談
9 | 0x08=報道特番
10 | 0x09=ローカル・地域
11 | 0x0A=交通
12 | 0x0F=その他
13 |
14 | 0x10=スポーツニュース
15 | 0x11=野球
16 | 0x12=サッカー
17 | 0x13=ゴルフ
18 | 0x14=その他の球技
19 | 0x15=相撲・格闘技
20 | 0x16=オリンピック・国際大会
21 | 0x17=マラソン・陸上・水泳
22 | 0x18=モータースポーツ
23 | 0x18=マリン・ウィンタースポーツ
24 | 0x19=競馬・公営競技
25 | 0x1F=その他
26 |
27 | 0x20=芸能・ワイドショー
28 | 0x21=ファッション
29 | 0x22=暮らし・住まい
30 | 0x23=健康・医療
31 | 0x24=ショッピング・通販
32 | 0x25=グルメ・料理
33 | 0x26=イベント
34 | 0x27=番組紹介・お知らせ
35 | 0x2F=その他
36 |
37 | 0x30=国内ドラマ
38 | 0x31=海外ドラマ
39 | 0x32=時代劇
40 | 0x3F=その他
41 |
42 | 0x40=国内ロック・ポップス
43 | 0x41=海外ロック・ポップス
44 | 0x42=クラシック・オペラ
45 | 0x43=ジャズ・フュージョン
46 | 0x44=歌謡曲・演歌
47 | 0x45=ライブ・コンサート
48 | 0x46=ランキング・リクエスト
49 | 0x47=カラオケ・のど自慢
50 | 0x48=民謡・邦楽
51 | 0x49=童謡・キッズ
52 | 0x4A=民族音楽・ワールドミュージック
53 | 0x4F=その他
54 |
55 | 0x50=クイズ
56 | 0x51=ゲーム
57 | 0x52=トークバラエティ
58 | 0x53=お笑い・コメディ
59 | 0x54=音楽バラエティ
60 | 0x55=旅バラエティ
61 | 0x56=料理バラエティ
62 | 0x5F=その他
63 |
64 | 0x60=洋画
65 | 0x61=邦画
66 | 0x62=アニメ
67 | 0x6F=その他
68 |
69 | 0x70=国内アニメ
70 | 0x71=海外アニメ
71 | 0x72=特撮
72 | 0x7F=その他
73 |
74 | 0x80=社会・時事
75 | 0x81=歴史・紀行
76 | 0x82=自然・動物・環境
77 | 0x83=宇宙・科学・医学
78 | 0x84=カルチャー・伝統文化
79 | 0x85=文学・文芸
80 | 0x86=スポーツ
81 | 0x87=ドキュメンタリー全般
82 | 0x88=インタビュー・討論
83 | 0x8F=その他
84 |
85 | 0x90=現代劇・新劇
86 | 0x91=ミュージカル
87 | 0x92=ダンス・バレエ
88 | 0x93=落語・演芸
89 | 0x94=歌舞伎・古典
90 | 0x9F=その他
91 |
92 | 0xA0=旅・釣り・アウトドア
93 | 0xA1=園芸・ペット・手芸
94 | 0xA2=音楽・美術・工芸
95 | 0xA3=囲碁・将棋
96 | 0xA4=麻雀・パチンコ
97 | 0xA5=車・オートバイ
98 | 0xA6=コンピュータ・TVゲーム
99 | 0xA7=会話・語学
100 | 0xA8=幼児・小学生
101 | 0xA9=中学生・高校生
102 | 0xAA=大学生・受験
103 | 0xAB=生涯教育・資格
104 | 0xAC=教育問題
105 | 0xAF=その他
106 |
107 | 0xB0=高齢者
108 | 0xB1=障害者
109 | 0xB2=社会福祉
110 | 0xB3=ボランティア
111 | 0xB4=手話
112 | 0xB5=文字(字幕)
113 | 0xB6=音声解説
114 | 0xBF=その他
115 |
--------------------------------------------------------------------------------
/etc/wwwroot/maya/parts.tag.html:
--------------------------------------------------------------------------------
1 |
35 |
36 |
80 |
--------------------------------------------------------------------------------
/etc/default/convert.def:
--------------------------------------------------------------------------------
1 | 0=0
2 | 1=1
3 | 2=2
4 | 3=3
5 | 4=4
6 | 5=5
7 | 6=6
8 | 7=7
9 | 8=8
10 | 9=9
11 |
12 | ①=(1)
13 | ②=(2)
14 | ③=(3)
15 | ④=(4)
16 | ⑤=(5)
17 | ⑥=(6)
18 | ⑦=(7)
19 | ⑧=(8)
20 | ⑨=(9)
21 | ⑩=(10)
22 | ⑪=(11)
23 | ⑫=(12)
24 | ⑬=(13)
25 | ⑭=(14)
26 | ⑮=(15)
27 | ⑯=(16)
28 | ⑰=(17)
29 | ⑱=(18)
30 | ⑲=(19)
31 | ⑳=(20)
32 |
33 | A=A
34 | B=B
35 | C=C
36 | D=D
37 | E=E
38 | F=F
39 | G=G
40 | H=H
41 | I=I
42 | J=J
43 | K=K
44 | L=L
45 | M=M
46 | N=N
47 | O=O
48 | P=P
49 | Q=Q
50 | R=R
51 | S=S
52 | T=T
53 | U=U
54 | V=V
55 | W=W
56 | X=X
57 | Y=Y
58 | Z=Z
59 |
60 | a=a
61 | b=b
62 | c=c
63 | d=d
64 | e=e
65 | f=f
66 | g=g
67 | h=h
68 | i=i
69 | j=j
70 | k=k
71 | l=l
72 | m=m
73 | n=n
74 | o=o
75 | p=p
76 | q=q
77 | r=r
78 | s=s
79 | t=t
80 | u=u
81 | v=v
82 | w=w
83 | x=x
84 | y=y
85 | z=z
86 |
87 | ア=ア
88 | イ=イ
89 | ウ=ウ
90 | エ=エ
91 | オ=オ
92 | カ=カ
93 | キ=キ
94 | ク=ク
95 | ケ=ケ
96 | コ=コ
97 | サ=サ
98 | シ=シ
99 | ス=ス
100 | セ=セ
101 | ソ=ソ
102 | タ=タ
103 | チ=チ
104 | ツ=ツ
105 | テ=テ
106 | ト=ト
107 | ナ=ナ
108 | ニ=ニ
109 | ヌ=ヌ
110 | ネ=ネ
111 | ノ=ノ
112 | ハ=ハ
113 | ヒ=ヒ
114 | フ=フ
115 | ヘ=ヘ
116 | ホ=ホ
117 | マ=マ
118 | ミ=ミ
119 | ム=ム
120 | メ=メ
121 | モ=モ
122 | ヤ=ヤ
123 | ユ=ユ
124 | ヨ=ヨ
125 | ラ=ラ
126 | リ=リ
127 | ル=ル
128 | レ=レ
129 | ロ=ロ
130 | ワ=ワ
131 | ヲ=ヲ
132 | ン=ン
133 |
134 | ガ=ガ
135 | ギ=ギ
136 | グ=グ
137 | ゲ=ゲ
138 | ゴ=ゴ
139 | ザ=ザ
140 | ジ=ジ
141 | ズ=ズ
142 | ゼ=ゼ
143 | ゾ=ゾ
144 | ダ=ダ
145 | ヂ=ヂ
146 | ヅ=ヅ
147 | デ=デ
148 | ド=ド
149 | バ=バ
150 | ビ=ビ
151 | ブ=ブ
152 | ベ=ベ
153 | ボ=ボ
154 | パ=パ
155 | ピ=ピ
156 | プ=プ
157 | ペ=ペ
158 | ポ=ポ
159 |
160 | ァ=ァ
161 | ィ=ィ
162 | ゥ=ゥ
163 | ェ=ェ
164 | ォ=ォ
165 | ッ=ッ
166 | ャ=ャ
167 | ュ=ュ
168 | ョ=ョ
169 |
170 | .=.
171 | [=[
172 | ]=]
173 | =
174 | ”="
175 | ¥=\
176 | ’='
177 | !=!
178 | #=#
179 | $=$
180 | %=%
181 | &=&
182 | (=(
183 | )=)
184 | ===
185 | |=|
186 | ^=^
187 | @=@
188 | ;=;
189 | :=:
190 | `=`
191 | {={
192 | }=}
193 | <=<
194 | >=>
195 | ?=?
196 | _=_
197 | +=+
198 | -=-
199 | *=*
200 | /=/
201 | ―=ー
202 | ,=,
203 |
--------------------------------------------------------------------------------
/etc/wwwroot/maya/webapi.js:
--------------------------------------------------------------------------------
1 | "use strict"
2 |
3 | var Webapi = {
4 |
5 | exec: function (func, arg, callback)
6 | {
7 | $.ajaxSetup({ cache: false }) //edge対策
8 |
9 | $.getJSON("/webapi/" + func, arg, callback)
10 | .fail(function ()
11 | {
12 | Dialog.alert("通信に失敗しました。デバイスの通信環境やTvmaidが起動中かどうか確認してください。")
13 | })
14 | },
15 |
16 | getTable: function (sql, callback)
17 | {
18 | this.exec("GetTable", { sql: sql }, callback)
19 | },
20 |
21 | //SQL文で、文字列を指定する場合のエスケープ
22 | sqlEncode: function (text)
23 | {
24 | return text.split("'").join("''")
25 | },
26 |
27 | //SQLのlike文のエスケープ
28 | //like文を使う場合は「escape '^'」を追加してください
29 | sqlLikeEncode: function (text)
30 | {
31 | text = this.sqlEncode(text)
32 |
33 | text = text.split("^").join("^^")
34 | text = text.split("_").join("^_")
35 | text = text.split("%").join("^%")
36 |
37 | return text;
38 | },
39 |
40 | //DateTimeをXDateに変換
41 | convertXDate: function (time)
42 | {
43 | time = time / 10000 - 62135596800000 //ナノ秒をミリ秒にして、1970年分引く
44 | var timezone = (new Date()).getTimezoneOffset() * 60 * 1000 //タイムゾーン
45 | return new XDate(time + timezone)
46 | },
47 |
48 | //XDateをDateTimeに変換
49 | convertDateTime: function (xdate)
50 | {
51 | var timezone = (new Date()).getTimezoneOffset() * 60 * 1000
52 | return (xdate.getTime() - timezone + 62135596800000) * 10000
53 | }
54 | }
55 |
56 | var ReserveState = {
57 |
58 | isEnable: function (status)
59 | {
60 | return (status & 1) > 0;
61 | },
62 |
63 | isEventMode: function (status)
64 | {
65 | return (status & 2) > 0;
66 | },
67 |
68 | isTunerLock: function (status)
69 | {
70 | return (status & 4) > 0;
71 | },
72 |
73 | isOverlay: function (status)
74 | {
75 | return (status & 32) > 0;
76 | },
77 |
78 | isRecording: function (status)
79 | {
80 | return (status & 64) > 0;
81 | },
82 |
83 | isRecordEnd: function (status)
84 | {
85 | return (status & 128) > 0;
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/Tvmaid/Data/Tuner.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Tvmaid
4 | {
5 | //チューナ
6 | class Tuner
7 | {
8 | public int Id;
9 | public string Name;
10 | public string DriverPath;
11 | public int DriverIndex;
12 |
13 | public string Driver
14 | {
15 | get
16 | {
17 | return System.IO.Path.GetFileName(DriverPath);
18 | }
19 | }
20 |
21 | public string DriverId
22 | {
23 | get
24 | {
25 | return "{0}/{1}".Formatex(Driver, DriverIndex);
26 | }
27 | }
28 |
29 | public Tuner(string name, string driverPath)
30 | {
31 | Id = -1;
32 | Name = name;
33 | DriverPath = driverPath;
34 | DriverIndex = 0;
35 | }
36 |
37 | public Tuner(DbTable t)
38 | {
39 | Init(t);
40 | }
41 |
42 | void Init(DbTable t)
43 | {
44 | Id = t.GetInt("id");
45 | Name = t.GetStr("name");
46 | DriverPath = t.GetStr("driver_path");
47 | DriverIndex = t.GetInt("driver_index");
48 | }
49 |
50 | public Tuner(Tvdb tvdb, string name)
51 | {
52 | tvdb.Sql = @"select * from tuner where name = '{0}'".Formatex(Tvdb.SqlEncode(name));
53 | using (var t = tvdb.GetTable())
54 | {
55 | if (t.Read())
56 | Init(t);
57 | else
58 | throw new Exception("チューナがありません。" + name);
59 | }
60 | }
61 |
62 | public void Add(Tvdb tvdb)
63 | {
64 | try
65 | {
66 | tvdb.BeginTrans();
67 |
68 | if (Id == -1)
69 | Id = tvdb.GetNextId("tuner");
70 |
71 | tvdb.Sql = "select count(id) from tuner where driver = '" + Tvdb.SqlEncode(Driver) + "'";
72 | var index = tvdb.GetData();
73 | DriverIndex = (int)(long)index;
74 |
75 | tvdb.Sql = "insert into tuner values({0}, '{1}', '{2}', '{3}', {4});".Formatex(
76 | Id,
77 | Tvdb.SqlEncode(Name),
78 | Tvdb.SqlEncode(DriverPath),
79 | Tvdb.SqlEncode(Driver),
80 | DriverIndex
81 | );
82 |
83 | tvdb.Execute();
84 | }
85 | finally
86 | {
87 | tvdb.Commit();
88 | }
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/readme.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Tvmaid MAYA
6 |
7 |
8 |
9 | Tvmaid MAYA
10 | Tvmaid MAYAは、Windows用録画予約プログラムです。
11 | TVTestを使用して、番組表の取得、録画を行います。
12 |
13 | このプログラムは実験用で、暗号化されたデータを扱う機能はありません。
14 |
15 | ライセンス
16 | MITライセンスで公開します。
17 | This software is released under the MIT License, see LICENSE.txt.
18 |
19 | 他作者の著作物のライセンス
20 | 以下の著作物が組み込まれています。
21 | System.Data.SQLite
22 | https://system.data.sqlite.org/index.html/doc/trunk/www/index.wiki
23 | Public domain.
24 | DynamicJson
25 | created and maintained by neuecc <ils@neue.cc>
26 | https://dynamicjson.codeplex.com/
27 | licensed under Microsoft Public License(Ms-PL)
28 | jQuery
29 | Copyright 2013 jQuery Foundation and other contributors
30 | https://jquery.com/
31 | The MIT License
32 | http://opensource.org/licenses/mit-license.php
33 | XDate
34 | http://arshaw.com/xdate/
35 | Dual-licensed under MIT or GPL
36 | https://github.com/arshaw/xdate/blob/master/MIT-LICENSE.txt
37 | Riot.js
38 | http://riotjs.com/ja/
39 | MIT License
40 | https://opensource.org/licenses/mit-license.php
41 | hls.js
42 | Copyright (c) 2017 Dailymotion (http://www.dailymotion.com)
43 | https://github.com/video-dev/hls.js
44 | Apache 2.0 License
45 | https://github.com/video-dev/hls.js/blob/master/LICENSE
46 | rplsinfo.exe
47 | http://saysaysay.net/rplstool/rplsinfo
48 | http://saysaysay.net/rplstool/rplsinfo#redistribution
49 |
50 | アプリケーションアイコン
51 | ICOON MONO
52 | TopeconHeroes
53 | http://icooon-mono.com/
54 | http://icooon-mono.com/license
55 | Webアイコン
56 | Material icons
57 | https://material.io/icons/
58 | Apache 2.0 License
59 | Phonon Framework
60 | CSSファイルを一部コピーして利用しています。
61 | The MIT License
62 | https://github.com/quark-dev/Phonon-Framework/blob/master/LICENSE
63 | niconico-ch.txt
64 | NicoJKのjkch.sh.txtをコピーして利用しています。
65 | https://github.com/xtne6f/NicoJK/releases
66 | TVTestPlugin.h
67 | デジタル放送総合技術研究開発機構
68 | https://github.com/DBCTRADO/TVTest
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/Tvmaid/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace Tvmaid
5 | {
6 | static class Program
7 | {
8 | public static string Name = "Tvmaid";
9 | public static string Version = "MAYA リリース 30";
10 |
11 | public static bool IsTunerUpdate = false;
12 | public static bool IsReboot = false;
13 |
14 | ///
15 | /// アプリケーションのメイン エントリ ポイントです。
16 | ///
17 | [STAThread]
18 | static void Main(string[] args)
19 | {
20 | System.Threading.ThreadPool.SetMinThreads(64, 64);
21 |
22 | Application.EnableVisualStyles();
23 | Application.SetCompatibleTextRenderingDefault(false);
24 | Application.Run(Init());
25 |
26 | PostProcess();
27 | }
28 |
29 | static void PostProcess()
30 | {
31 | try
32 | {
33 | if (IsTunerUpdate)
34 | {
35 | AppDefine.Load();
36 | Util.CopyPlugin();
37 | TunerUpdater.Update();
38 | }
39 | }
40 | catch (Exception ex)
41 | {
42 | MessageBox.Show("チューナの更新に失敗しました。[詳細]" + ex.Message, Program.Name);
43 | }
44 |
45 | Log.Close();
46 |
47 | try
48 | {
49 | if (IsReboot)
50 | {
51 | var p = new System.Diagnostics.Process();
52 | p.StartInfo.FileName = Application.ExecutablePath;
53 | p.Start();
54 | p.WaitForInputIdle();
55 | }
56 | }
57 | catch (Exception ex)
58 | {
59 | MessageBox.Show("再起動に失敗しました。[詳細]" + ex.Message, Program.Name);
60 | }
61 | }
62 |
63 | static Form Init()
64 | {
65 | try
66 | {
67 | Util.CopyUserFile();
68 | Log.Open();
69 | Log.Info("{0} {1} を開始します。".Formatex(Program.Name, Program.Version));
70 | }
71 | catch (Exception ex)
72 | {
73 | MessageBox.Show("初期化に失敗しました。" + ex.Message);
74 | throw;
75 | }
76 |
77 | try
78 | {
79 | AppDefine.Load();
80 | AppDefine.Main.Check();
81 | Util.CopyPlugin();
82 | return new MainForm();
83 | }
84 | catch(Exception ex)
85 | {
86 | MessageBox.Show("起動に失敗しました。" + ex.Message, "Tvmaid");
87 | return new SetupForm();
88 | }
89 | }
90 | }
91 | }
92 |
93 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 |
2 | # Tvmaid MAYA
3 |
4 | 
5 |
6 | このリポジトリは、http://nana2.sarashi.com/tvmaid-maya/ にて公開されている、Tvmaid MAYA のソースコードのミラーです。
7 | 開発が事実上停止していること、ソースコードが zip アーカイブでしか公開されておらず GitHub などには公開されていないことから、このミラーを作成しました。
8 |
9 | ソースコードは [TvmaidMAYA-2700-code.zip](http://nana2.sarashi.com/tvmaid-maya/dev/TvmaidMAYA-2700-code.zip) に [TvmaidMAYA-3000-code-diff.zip](http://nana2.sarashi.com/tvmaid-maya/dev/TvmaidMAYA-3000-code-diff.zip) の差分を適用したものです。
10 | Visual Studio 2019 でもビルドできるようにしたこと以外の変更は行っていません。
11 |
12 | 以下のドキュメントは、ソースコードに同梱されていた readme.html を Markdown 形式に書き直したものです。
13 | Tvmaid の開発者の方に感謝します。
14 |
15 | -----
16 |
17 | ## Tvmaid MAYA
18 |
19 | Tvmaid MAYAは、Windows用録画予約プログラムです。
20 | TVTestを使用して、番組表の取得、録画を行います。
21 |
22 | このプログラムは実験用で、暗号化されたデータを扱う機能はありません。
23 |
24 | ## ライセンス
25 |
26 | MITライセンスで公開します。
27 | This software is released under the MIT License, see LICENSE.txt.
28 |
29 |
30 | ## 他作者の著作物のライセンス
31 |
32 | 以下の著作物が組み込まれています。
33 |
34 | ### System.Data.SQLite
35 |
36 | https://system.data.sqlite.org/index.html/doc/trunk/www/index.wiki
37 | Public domain.
38 |
39 | ### DynamicJson
40 |
41 | created and maintained by neuecc <ils@neue.cc>
42 | https://dynamicjson.codeplex.com/
43 | licensed under Microsoft Public License(Ms-PL)
44 |
45 | ### jQuery
46 |
47 | Copyright 2013 jQuery Foundation and other contributors
48 | https://jquery.com/
49 | The MIT License
50 | http://opensource.org/licenses/mit-license.php
51 |
52 | ### XDate
53 | http://arshaw.com/xdate/
54 | Dual-licensed under MIT or GPL
55 | https://github.com/arshaw/xdate/blob/master/MIT-LICENSE.txt
56 |
57 | ### Riot.js
58 | http://riotjs.com/ja/
59 | MIT License
60 | https://opensource.org/licenses/mit-license.php
61 |
62 | ### hls.js
63 | Copyright (c) 2017 Dailymotion (http://www.dailymotion.com)
64 | https://github.com/video-dev/hls.js
65 | Apache 2.0 License
66 | https://github.com/video-dev/hls.js/blob/master/LICENSE
67 |
68 | ### rplsinfo.exe
69 | http://saysaysay.net/rplstool/rplsinfo
70 | http://saysaysay.net/rplstool/rplsinfo#redistribution
71 |
72 | ### アプリケーションアイコン
73 |
74 | ICOON MONO
75 | TopeconHeroes
76 | http://icooon-mono.com/
77 | http://icooon-mono.com/license
78 |
79 | ### Webアイコン
80 |
81 | Material icons
82 | https://material.io/icons/
83 | Apache 2.0 License
84 |
85 | ### Phonon Framework
86 |
87 | CSSファイルを一部コピーして利用しています。
88 | The MIT License
89 | https://github.com/quark-dev/Phonon-Framework/blob/master/LICENSE
90 |
91 | ### niconico-ch.txt
92 |
93 | NicoJKのjkch.sh.txtをコピーして利用しています。
94 | https://github.com/xtne6f/NicoJK/releases
95 |
96 | ### TVTestPlugin.h
97 |
98 | デジタル放送総合技術研究開発機構
99 | https://github.com/DBCTRADO/TVTest
100 |
--------------------------------------------------------------------------------
/Tvmaid/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // このコードはツールによって生成されました。
4 | // ランタイム バージョン:4.0.30319.42000
5 | //
6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | // コードが再生成されるときに損失したりします。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Tvmaid.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。
17 | ///
18 | // このクラスは StronglyTypedResourceBuilder クラスが ResGen
19 | // または Visual Studio のようなツールを使用して自動生成されました。
20 | // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に
21 | // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tvmaid.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 厳密に型指定されたこのリソース クラスを使用して、すべての検索リソースに対し、
51 | /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Maidbar/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // このコードはツールによって生成されました。
4 | // ランタイム バージョン:4.0.30319.42000
5 | //
6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | // コードが再生成されるときに損失したりします。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Tvmaid.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。
17 | ///
18 | // このクラスは StronglyTypedResourceBuilder クラスが ResGen
19 | // または Visual Studio のようなツールを使用して自動生成されました。
20 | // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に
21 | // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Maidbar.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 厳密に型指定されたこのリソース クラスを使用して、すべての検索リソースに対し、
51 | /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Timekeeper/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // このコードはツールによって生成されました。
4 | // ランタイム バージョン:4.0.30319.42000
5 | //
6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | // コードが再生成されるときに損失したりします。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Tvmaid.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。
17 | ///
18 | // このクラスは StronglyTypedResourceBuilder クラスが ResGen
19 | // または Visual Studio のようなツールを使用して自動生成されました。
20 | // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に
21 | // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timekeeper.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 厳密に型指定されたこのリソース クラスを使用して、すべての検索リソースに対し、
51 | /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Tvmaid/Web/WebApiBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using System.Reflection;
4 |
5 | namespace Tvmaid
6 | {
7 | abstract class WebApiBase : WebTask
8 | {
9 | protected WebApiData ret = new WebApiData();
10 |
11 | protected WebApiBase(HttpListenerContext con) : base(con) { }
12 |
13 | public override void Run()
14 | {
15 | var uri = con.Request.Url.AbsolutePath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
16 | Execute(uri[1]);
17 | }
18 |
19 | //メソッドを検索して呼び出す
20 | void Execute(string func)
21 | {
22 | try
23 | {
24 | //メソッド呼び出し
25 | this.GetType().InvokeMember(
26 | func,
27 | BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance,
28 | null,
29 | this,
30 | null);
31 | }
32 | catch (TargetInvocationException tie)
33 | {
34 | //呼び出した関数で例外が発生したとき
35 | //Exceptionだと、InvokeMemberのエラーしか取得できない
36 | ret.SetCode(1, tie.InnerException.Message);
37 | }
38 | catch (MissingMethodException)
39 | {
40 | ret.SetCode(1, "指定されたWeb Apiはありません。" + func);
41 | }
42 | catch (Exception ex)
43 | {
44 | Log.Error(ex.Message);
45 | ret.SetCode(1, ex.Message);
46 | }
47 |
48 | try
49 | {
50 | //クロスドメインを許可
51 | con.Response.Headers["Access-Control-Allow-Origin"] = "*";
52 |
53 | //JSON変換
54 | var json = Codeplex.Data.DynamicJson.Serialize(ret);
55 | var data = System.Text.Encoding.UTF8.GetBytes(json);
56 |
57 | con.Response.SendChunked = false;
58 | con.Response.ContentLength64 = data.Length;
59 | con.Response.ContentType = "application/json";
60 | con.Response.StatusCode = (int)HttpStatusCode.OK;
61 | con.Response.OutputStream.Write(data, 0, data.Length);
62 | }
63 | catch (Exception ex)
64 | {
65 | Log.Error(ex.Message);
66 | }
67 | }
68 | }
69 |
70 | //jsonに変換してクライアントへ返す
71 | class WebApiData
72 | {
73 | public int code { get; set; } //リターンコード。0:成功、1:失敗
74 | public string message { get; set; }
75 | public object data1 { get; set; }
76 |
77 | public WebApiData()
78 | {
79 | SetCode(0, "");
80 | }
81 |
82 | public void SetCode(int code, string message)
83 | {
84 | this.code = code;
85 | this.message = message;
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/Tvmaid/Data/Service.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 |
4 | namespace Tvmaid
5 | {
6 | //サービス
7 | class Service
8 | {
9 | public int Id = -1;
10 | public string Driver;
11 | public int Nid;
12 | public int Tsid;
13 | public int Sid;
14 | public string Name;
15 |
16 | public bool EpgBasic = false; //番組表更新時にnid単位で取得するかどうかのフラグ
17 |
18 | public Service() { }
19 |
20 | public Service(DbTable t)
21 | {
22 | Init(t);
23 | }
24 |
25 | void Init(DbTable t)
26 | {
27 | Id = t.GetInt("id");
28 | Driver = t.GetStr("driver");
29 | Fsid = t.GetLong("fsid");
30 | Name = t.GetStr("name");
31 | }
32 |
33 | public long Fsid
34 | {
35 | get
36 | {
37 | return ((long)Nid << 32) + (Tsid << 16) + Sid;
38 | }
39 | set
40 | {
41 | Nid = (int)(value >> 32 & 0xffff);
42 | Tsid = (int)(value >> 16 & 0xffff);
43 | Sid = (int)(value & 0xffff);
44 | }
45 | }
46 |
47 | public Service(Tvdb tvdb, long fsid)
48 | {
49 | tvdb.Sql = @"select * from service where fsid = {0}".Formatex(fsid);
50 | using (var t = tvdb.GetTable())
51 | {
52 | if (t.Read())
53 | Init(t);
54 | else
55 | throw new Exception("サービスが見つかりません。" + fsid);
56 | }
57 | }
58 |
59 | public Service(Tvdb tvdb, int id)
60 | {
61 | tvdb.Sql = "select * from service where id = " + id;
62 | using (var t = tvdb.GetTable())
63 | {
64 | if (t.Read())
65 | Init(t);
66 | else
67 | throw new Exception("サービスが見つかりません。");
68 | }
69 | }
70 |
71 | public void Add(Tvdb tvdb)
72 | {
73 | try
74 | {
75 | tvdb.BeginTrans();
76 |
77 | if (Id == -1)
78 | Id = tvdb.GetNextId("service");
79 |
80 | tvdb.Sql = @"insert into service values({0}, '{1}', {2}, '{3}');".Formatex(
81 | Id,
82 | Tvdb.SqlEncode(Driver),
83 | Fsid,
84 | Tvdb.SqlEncode(AppDefine.TextConverter.Convert(Name))
85 | );
86 |
87 | tvdb.Execute();
88 | }
89 | finally
90 | {
91 | tvdb.Commit();
92 | }
93 | }
94 |
95 | public override string ToString()
96 | {
97 | return Name;
98 | }
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/etc/wwwroot/maya/main-menu.tag.html:
--------------------------------------------------------------------------------
1 | var MainMenu = {}
2 |
3 |
90 |
--------------------------------------------------------------------------------
/etc/default/genre.def:
--------------------------------------------------------------------------------
1 | 0x00=ニュース/報道/定時・総合
2 | 0x01=ニュース/報道/天気
3 | 0x02=ニュース/報道/特集・ドキュメント
4 | 0x03=ニュース/報道/政治・国会
5 | 0x04=ニュース/報道/経済・市況
6 | 0x05=ニュース/報道/海外・国際
7 | 0x06=ニュース/報道/解説
8 | 0x07=ニュース/報道/討論・会談
9 | 0x08=ニュース/報道/報道特番
10 | 0x09=ニュース/報道/ローカル・地域
11 | 0x0A=ニュース/報道/交通
12 | 0x0F=ニュース/報道/その他
13 |
14 | 0x10=スポーツ/スポーツニュース
15 | 0x11=スポーツ/野球
16 | 0x12=スポーツ/サッカー
17 | 0x13=スポーツ/ゴルフ
18 | 0x14=スポーツ/その他の球技
19 | 0x15=スポーツ/相撲・格闘技
20 | 0x16=スポーツ/オリンピック・国際大会
21 | 0x17=スポーツ/マラソン・陸上・水泳
22 | 0x18=スポーツ/モータースポーツ
23 | 0x19=スポーツ/マリン・ウィンタースポーツ
24 | 0x1A=スポーツ/競馬・公営競技
25 | 0x1F=スポーツ/その他
26 |
27 | 0x20=情報/ワイドショー/芸能・ワイドショー
28 | 0x21=情報/ワイドショー/ファッション
29 | 0x22=情報/ワイドショー/暮らし・住まい
30 | 0x23=情報/ワイドショー/健康・医療
31 | 0x24=情報/ワイドショー/ショッピング・通販
32 | 0x25=情報/ワイドショー/グルメ・料理
33 | 0x26=情報/ワイドショー/イベント
34 | 0x27=情報/ワイドショー/番組紹介・お知らせ
35 | 0x2F=情報/ワイドショー/その他
36 |
37 | 0x30=ドラマ/国内ドラマ
38 | 0x31=ドラマ/海外ドラマ
39 | 0x32=ドラマ/時代劇
40 | 0x3F=ドラマ/その他
41 |
42 | 0x40=音楽/国内ロック・ポップス
43 | 0x41=音楽/海外ロック・ポップス
44 | 0x42=音楽/クラシック・オペラ
45 | 0x43=音楽/ジャズ・フュージョン
46 | 0x44=音楽/歌謡曲・演歌
47 | 0x45=音楽/ライブ・コンサート
48 | 0x46=音楽/ランキング・リクエスト
49 | 0x47=音楽/カラオケ・のど自慢
50 | 0x48=音楽/民謡・邦楽
51 | 0x49=音楽/童謡・キッズ
52 | 0x4A=音楽/民族音楽・ワールドミュージック
53 | 0x4F=音楽/その他
54 |
55 | 0x50=バラエティ/クイズ
56 | 0x51=バラエティ/ゲーム
57 | 0x52=バラエティ/トークバラエティ
58 | 0x53=バラエティ/お笑い・コメディ
59 | 0x54=バラエティ/音楽バラエティ
60 | 0x55=バラエティ/旅バラエティ
61 | 0x56=バラエティ/料理バラエティ
62 | 0x5F=バラエティ/その他
63 |
64 | 0x60=映画/洋画
65 | 0x61=映画/邦画
66 | 0x62=映画/アニメ
67 | 0x6F=映画/その他
68 |
69 | 0x70=アニメ/特撮/国内アニメ
70 | 0x71=アニメ/特撮/海外アニメ
71 | 0x72=アニメ/特撮/特撮
72 | 0x7F=アニメ/特撮/その他
73 |
74 | 0x80=ドキュメンタリー/教養/社会・時事
75 | 0x81=ドキュメンタリー/教養/歴史・紀行
76 | 0x82=ドキュメンタリー/教養/自然・動物/環境
77 | 0x83=ドキュメンタリー/教養/宇宙・科学/医学
78 | 0x84=ドキュメンタリー/教養/カルチャー・伝統文化
79 | 0x85=ドキュメンタリー/教養/文学・文芸
80 | 0x86=ドキュメンタリー/教養/スポーツ
81 | 0x87=ドキュメンタリー/教養/ドキュメンタリー全般
82 | 0x88=ドキュメンタリー/教養/インタビュー・討論
83 | 0x8F=ドキュメンタリー/教養/その他
84 |
85 | 0x90=劇場/公演/現代劇・新劇
86 | 0x91=劇場/公演/ミュージカル
87 | 0x92=劇場/公演/ダンス・バレエ
88 | 0x93=劇場/公演/落語・演芸
89 | 0x94=劇場/公演/歌舞伎・古典
90 | 0x9F=劇場/公演/その他
91 |
92 | 0xA0=趣味/教育/旅・釣り・アウトドア
93 | 0xA1=趣味/教育/園芸・ペット・手芸
94 | 0xA2=趣味/教育/音楽・美術・工芸
95 | 0xA3=趣味/教育/囲碁・将棋
96 | 0xA4=趣味/教育/麻雀・パチンコ
97 | 0xA5=趣味/教育/車・オートバイ
98 | 0xA6=趣味/教育/コンピュータ・TVゲーム
99 | 0xA7=趣味/教育/会話・語学
100 | 0xA8=趣味/教育/幼児・小学生
101 | 0xA9=趣味/教育/中学生・高校生
102 | 0xAA=趣味/教育/大学生・受験
103 | 0xAB=趣味/教育/生涯教育・資格
104 | 0xAC=趣味/教育/教育問題
105 | 0xAF=趣味/教育/その他
106 |
107 | 0xB0=福祉/高齢者
108 | 0xB1=福祉/障害者
109 | 0xB2=福祉/社会福祉
110 | 0xB3=福祉/ボランティア
111 | 0xB4=福祉/手話
112 | 0xB5=福祉/文字(字幕)
113 | 0xB6=福祉/音声解説
114 | 0xBF=福祉/その他
115 |
116 | 0xC0=スポーツ(CS)/テニス
117 | 0xC1=スポーツ(CS)/バスケットボール
118 | 0xC2=スポーツ(CS)/ラグビー
119 | 0xC3=スポーツ(CS)/アメリカンフットボール
120 | 0xC4=スポーツ(CS)/ボクシング
121 | 0xC5=スポーツ(CS)/プロレス
122 | 0xCF=スポーツ(CS)/その他
123 |
124 | 0xD0=映画(CS)/アクション
125 | 0xD1=映画(CS)/SF/ファンタジー
126 | 0xD2=映画(CS)/お笑い/コメディー
127 | 0xD3=映画(CS)/サスペンス/ミステリー
128 | 0xD4=映画(CS)/恋愛/ロマンス
129 | 0xD5=映画(CS)/ホラー/スリラー
130 | 0xD6=映画(CS)/ウエスタン
131 | 0xD7=映画(CS)/ドラマ/社会派ドラマ
132 | 0xD8=映画(CS)/アニメーション
133 | 0xD9=映画(CS)/ドキュメンタリー
134 | 0xDA=映画(CS)/アドベンチャー/冒険
135 | 0xDB=映画(CS)/ミュージカル/音楽洋画
136 | 0xDC=映画(CS)/ホームドラマ
137 | 0xDD=映画(CS)/青春/学園/アイドル
138 | 0xDE=映画(CS)/任侠/時代劇
139 | 0xDF=映画(CS)/その他
140 |
141 | 0xF0=中止の可能性あり
142 | 0xF1=延長の可能性あり
143 | 0xF2=中断の可能性あり
144 | 0xF3=同一シリーズの別話数放送の可能性あり
145 | 0xF4=編成未定枠
146 | 0xF5=繰り上げの可能性あり
147 | 0xFA=中断ニュースあり
148 | 0xFB=関連する臨時サービスあり
149 |
--------------------------------------------------------------------------------
/etc/wwwroot/maya/jslib.js:
--------------------------------------------------------------------------------
1 | "use strict"
2 |
3 | //javascript汎用関数
4 |
5 | //文字列フォーマット
6 | //@author phi
7 | //
8 | //添字引数版
9 | //var str = "{0} : {1} + {2} = {3}".format("足し算", 8, 0.5, 8+0.5);
10 | //
11 | //オブジェクト版
12 | //str = "名前 : {name}, 年齢 : {age}".format( { "name":"山田", "age":128 } );
13 | //
14 | if (String.prototype.format == undefined)
15 | {
16 | String.prototype.format = function(arg)
17 | {
18 | // 置換ファンク
19 | var rep_fn = undefined;
20 |
21 | // オブジェクトの場合
22 | if (typeof arg == "object")
23 | {
24 | rep_fn = function(m, k) { return arg[k]; }
25 | }
26 | // 複数引数だった場合
27 | else
28 | {
29 | var args = arguments;
30 | rep_fn = function(m, k) { return args[ parseInt(k) ]; }
31 | }
32 |
33 | return this.replace( /\{(\w+)\}/g, rep_fn );
34 | }
35 | }
36 |
37 | //htmlエスケープ
38 | String.prototype.escapeHTML = function()
39 | {
40 | return this.replace(/&/g, '&')
41 | .replace(//g, '>')
43 | .replace(/"/g, '"')
44 | .replace(/'/g, ''');
45 | }
46 |
47 | //htmlエスケープを戻す
48 | String.prototype.unescapeHTML = function()
49 | {
50 | var div = document.createElement("div");
51 | div.innerHTML = this.replace(//g,">")
53 | .replace(/ /g, " ")
54 | .replace(/\r/g, "
")
55 | .replace(/\n/g, "
");
56 | return div.textContent || div.innerText;
57 | }
58 |
59 | //改行が含まれているテキスト
60 | String.prototype.htmlText = function ()
61 | {
62 | return this.escapeHTML().replace(/\r?\n/g, " ");
63 | }
64 |
65 | String.prototype.htmlText2 = function ()
66 | {
67 | return this.escapeHTML().replace(/\n/g, " ");
68 | }
69 |
70 | Array.prototype.find = function (callback)
71 | {
72 | for (var i = 0; i < this.length; i++)
73 | {
74 | if (callback(this[i]))
75 | return this[i]
76 | }
77 | }
78 |
79 | function debounce(fn, wait)
80 | {
81 | var timer
82 |
83 | return function ()
84 | {
85 | clearTimeout(timer)
86 |
87 | timer = setTimeout(function ()
88 | {
89 | fn()
90 | }, wait)
91 | }
92 | }
93 |
94 | function setFullscreen(el, obj)
95 | {
96 | if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement)
97 | {
98 | if (el.requestFullscreen)
99 | el.requestFullscreen();
100 | else if (el.msRequestFullscreen)
101 | el.msRequestFullscreen();
102 | else if (el.mozRequestFullScreen)
103 | el.mozRequestFullScreen();
104 | else if (el.webkitRequestFullscreen)
105 | el.webkitRequestFullscreen();
106 | }
107 | else
108 | {
109 | if (document.exitFullscreen)
110 | document.exitFullscreen();
111 | else if (document.msExitFullscreen)
112 | document.msExitFullscreen();
113 | else if (document.mozCancelFullScreen)
114 | document.mozCancelFullScreen();
115 | else if (document.webkitExitFullscreen)
116 | document.webkitExitFullscreen();
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/Tvmaid/Gui/ExitForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Tvmaid
2 | {
3 | partial class ExitForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.components = new System.ComponentModel.Container();
32 | this.label1 = new System.Windows.Forms.Label();
33 | this.progressBar = new System.Windows.Forms.ProgressBar();
34 | this.timer = new System.Windows.Forms.Timer(this.components);
35 | this.SuspendLayout();
36 | //
37 | // label1
38 | //
39 | this.label1.AutoSize = true;
40 | this.label1.Location = new System.Drawing.Point(27, 25);
41 | this.label1.Name = "label1";
42 | this.label1.Size = new System.Drawing.Size(113, 19);
43 | this.label1.TabIndex = 0;
44 | this.label1.Text = "終了しています...";
45 | //
46 | // progressBar
47 | //
48 | this.progressBar.Location = new System.Drawing.Point(31, 65);
49 | this.progressBar.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
50 | this.progressBar.Name = "progressBar";
51 | this.progressBar.Size = new System.Drawing.Size(402, 12);
52 | this.progressBar.TabIndex = 1;
53 | //
54 | // timer
55 | //
56 | this.timer.Enabled = true;
57 | this.timer.Interval = 1000;
58 | this.timer.Tick += new System.EventHandler(this.timer_Tick);
59 | //
60 | // ExitForm
61 | //
62 | this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 19F);
63 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
64 | this.ClientSize = new System.Drawing.Size(464, 109);
65 | this.ControlBox = false;
66 | this.Controls.Add(this.progressBar);
67 | this.Controls.Add(this.label1);
68 | this.Font = new System.Drawing.Font("Meiryo UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
69 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
70 | this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
71 | this.Name = "ExitForm";
72 | this.ShowInTaskbar = false;
73 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
74 | this.Text = "Tvmaid";
75 | this.ResumeLayout(false);
76 | this.PerformLayout();
77 |
78 | }
79 |
80 | #endregion
81 |
82 | private System.Windows.Forms.Label label1;
83 | private System.Windows.Forms.ProgressBar progressBar;
84 | private System.Windows.Forms.Timer timer;
85 | }
86 | }
--------------------------------------------------------------------------------
/etc/wwwroot/lib/route.min.js:
--------------------------------------------------------------------------------
1 | var route=function(){"use strict";var e=function(e){e=e||{};var t={},r=Array.prototype.slice;Object.defineProperties(e,{on:{value:function(r,n){if(typeof n=="function"){(t[r]=t[r]||[]).push(n)}return e},enumerable:false,writable:false,configurable:false},off:{value:function(r,n){if(r=="*"&&!n){t={}}else{if(n){var i=t[r];for(var a=0,f;f=i&&i[a];++a){if(f==n){i.splice(a--,1)}}}else{delete t[r]}}return e},enumerable:false,writable:false,configurable:false},one:{value:function(t,r){function n(){e.off(t,n);r.apply(e,arguments)}return e.on(t,n)},enumerable:false,writable:false,configurable:false},trigger:{value:function(n){var i=arguments;var a=arguments.length-1,f=new Array(a),u,o,c;for(c=0;c
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | Tvmaid MAYA
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
37 |
39 |
40 |
42 |
44 |
46 |
48 |
50 |
52 |
54 |
56 |
57 |
59 |
61 |
63 |
65 |
67 |
69 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
114 |
115 |
--------------------------------------------------------------------------------
/Maidbar/Util.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace Tvmaid
7 | {
8 | //拡張メソッド
9 | static class StringExtension
10 | {
11 | public static string Formatex(this string format, params object[] values)
12 | {
13 | return string.Format(format, values);
14 | }
15 |
16 | public static bool CompareNC(this string str1, string str2)
17 | {
18 | return string.Compare(str1, str2, true) == 0;
19 | }
20 |
21 | public static int ToInt(this string s)
22 | {
23 | return int.Parse(s);
24 | }
25 |
26 | public static long ToLong(this string s)
27 | {
28 | return long.Parse(s);
29 | }
30 |
31 | public static DateTime ToDateTime(this string s)
32 | {
33 | return DateTime.Parse(s);
34 | }
35 | }
36 |
37 | //関数
38 | public static class Util
39 | {
40 | //実行ファイルのフォルダ
41 | public static string GetBasePath()
42 | {
43 | return Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
44 | }
45 |
46 | public static string GetBasePath(string file)
47 | {
48 | return Path.Combine(GetBasePath(), file);
49 | }
50 | }
51 |
52 | //キー=値のファイル
53 | public class PairList : List>
54 | {
55 | string path;
56 |
57 | public PairList(string path)
58 | {
59 | this.path = path;
60 | }
61 |
62 | public int GetInt(string key)
63 | {
64 | return this[key].ToInt();
65 | }
66 |
67 | public float GetFloat(string key)
68 | {
69 | return (float)Convert.ToDouble(this[key]);
70 | }
71 |
72 | public string this[string key]
73 | {
74 | set
75 | {
76 | for (var i = 0; i < this.Count; i++)
77 | {
78 | if (this[i].Key == key)
79 | {
80 | this[i] = new KeyValuePair(key, value);
81 | return;
82 | }
83 | }
84 | this.Add(new KeyValuePair(key, value));
85 | }
86 | get
87 | {
88 | foreach (var pair in this)
89 | if (pair.Key == key) return pair.Value;
90 |
91 | return null;
92 | }
93 | }
94 |
95 | public void Save()
96 | {
97 | using (var sw = new StreamWriter(path, false, Encoding.GetEncoding("utf-8")))
98 | {
99 | foreach (var pair in this)
100 | sw.WriteLine(pair.Key + "=" + pair.Value);
101 | }
102 | }
103 |
104 | public void Load()
105 | {
106 | using (var sr = new StreamReader(path, Encoding.GetEncoding("utf-8")))
107 | {
108 | var text = sr.ReadToEnd();
109 | string[] lines = text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
110 |
111 | foreach (string line in lines)
112 | {
113 | //コメント行
114 | if (line.Length >= 2 && line.StartsWith("//")) { continue; }
115 |
116 | int sepa = line.IndexOf('=');
117 | if (sepa == -1) continue;
118 |
119 | var key = line.Substring(0, sepa);
120 | var val = "";
121 |
122 | if (sepa + 1 < line.Length)
123 | val = line.Substring(sepa + 1);
124 |
125 | this[key] = val;
126 | }
127 | }
128 | }
129 |
130 | public bool IsDefined(string key)
131 | {
132 | foreach (var pair in this)
133 | if (pair.Key == key) return true;
134 |
135 | return false;
136 | }
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/Timekeeper/Util.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace Tvmaid
7 | {
8 | //拡張メソッド
9 | static class StringExtension
10 | {
11 | public static string Formatex(this string format, params object[] values)
12 | {
13 | return string.Format(format, values);
14 | }
15 |
16 | public static bool CompareNC(this string str1, string str2)
17 | {
18 | return string.Compare(str1, str2, true) == 0;
19 | }
20 |
21 | public static int ToInt(this string s)
22 | {
23 | return int.Parse(s);
24 | }
25 |
26 | public static long ToLong(this string s)
27 | {
28 | return long.Parse(s);
29 | }
30 |
31 | public static DateTime ToDateTime(this string s)
32 | {
33 | return DateTime.Parse(s);
34 | }
35 | }
36 |
37 | //関数
38 | public static class Util
39 | {
40 | //実行ファイルのフォルダ
41 | public static string GetBasePath()
42 | {
43 | return Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
44 | }
45 |
46 | public static string GetBasePath(string file)
47 | {
48 | return Path.Combine(GetBasePath(), file);
49 | }
50 | }
51 |
52 | //キー=値のファイル
53 | public class PairList : List>
54 | {
55 | string path;
56 |
57 | public PairList(string path)
58 | {
59 | this.path = path;
60 | }
61 |
62 | public int GetInt(string key)
63 | {
64 | return this[key].ToInt();
65 | }
66 |
67 | public float GetFloat(string key)
68 | {
69 | return (float)Convert.ToDouble(this[key]);
70 | }
71 |
72 | public string this[string key]
73 | {
74 | set
75 | {
76 | for (var i = 0; i < this.Count; i++)
77 | {
78 | if (this[i].Key == key)
79 | {
80 | this[i] = new KeyValuePair(key, value);
81 | return;
82 | }
83 | }
84 | this.Add(new KeyValuePair(key, value));
85 | }
86 | get
87 | {
88 | foreach (var pair in this)
89 | if (pair.Key == key) return pair.Value;
90 |
91 | return null;
92 | }
93 | }
94 |
95 | public void Save()
96 | {
97 | using (var sw = new StreamWriter(path, false, Encoding.GetEncoding("utf-8")))
98 | {
99 | foreach (var pair in this)
100 | sw.WriteLine(pair.Key + "=" + pair.Value);
101 | }
102 | }
103 |
104 | public void Load()
105 | {
106 | using (var sr = new StreamReader(path, Encoding.GetEncoding("utf-8")))
107 | {
108 | var text = sr.ReadToEnd();
109 | string[] lines = text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
110 |
111 | foreach (string line in lines)
112 | {
113 | //コメント行
114 | if (line.Length >= 2 && line.StartsWith("//")) { continue; }
115 |
116 | int sepa = line.IndexOf('=');
117 | if (sepa == -1) continue;
118 |
119 | var key = line.Substring(0, sepa);
120 | var val = "";
121 |
122 | if (sepa + 1 < line.Length)
123 | val = line.Substring(sepa + 1);
124 |
125 | this[key] = val;
126 | }
127 | }
128 | }
129 |
130 | public bool IsDefined(string key)
131 | {
132 | foreach (var pair in this)
133 | if (pair.Key == key) return true;
134 |
135 | return false;
136 | }
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/Tvmaid/Gui/MainForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using System.Windows.Forms;
4 |
5 | namespace Tvmaid
6 | {
7 | public partial class MainForm : Form
8 | {
9 | SleepMan sleepMan = new SleepMan();
10 | Task backTask;
11 |
12 | public MainForm()
13 | {
14 | InitializeComponent();
15 |
16 | backTask = Task.Factory.StartNew(() =>
17 | {
18 | RecTimer.Run();
19 | WebServer.Run();
20 | HlsStream.ClearSegment();
21 | });
22 | }
23 |
24 | protected override void WndProc(ref Message m)
25 | {
26 | base.WndProc(ref m);
27 |
28 | const int WM_POWERBROADCAST = 0x0218; //電源に関するメッセージ
29 | const int PBT_APMSUSPEND = 0x0004; //スリープに入る
30 | const int PBT_APMRESUMEAUTOMATIC = 0x0012; //復帰した
31 |
32 | if (WM_POWERBROADCAST == m.Msg)
33 | {
34 | switch (m.WParam.ToInt32())
35 | {
36 | case PBT_APMRESUMEAUTOMATIC: sleepMan.OnResume(); break;
37 | case PBT_APMSUSPEND: sleepMan.OnSuspend(); break;
38 | }
39 | }
40 | }
41 |
42 | private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
43 | {
44 | sleepMan.Dispose();
45 |
46 | WebServer.Stop();
47 | RecTimer.Stop();
48 | HlsStream.StopAll();
49 |
50 | //スレッド終了待ち
51 | var timeout = 30;
52 |
53 | var form = new ExitForm(timeout);
54 |
55 | Task.Factory.StartNew(() =>
56 | {
57 | if (backTask != null)
58 | backTask.Wait(timeout * 1000);
59 |
60 | System.Diagnostics.Debug.WriteLine("backTask Exit: ");
61 | })
62 | .ContinueWith(_ =>
63 | {
64 | form.Close();
65 |
66 | Log.Info("{0} {1} を終了します。".Formatex(Program.Name, Program.Version));
67 |
68 | System.Diagnostics.Debug.WriteLine("MainForm Exit: ");
69 |
70 | }, TaskScheduler.FromCurrentSynchronizationContext());
71 |
72 | form.ShowDialog();
73 | }
74 |
75 | private void exitMenuItem_Click(object sender, EventArgs e)
76 | {
77 | var ret = MessageBox.Show("終了していいですか?", Program.Name, MessageBoxButtons.OKCancel);
78 |
79 | if (ret == DialogResult.OK)
80 | Close();
81 | }
82 |
83 | private void updateTunerMenuItem_Click(object sender, EventArgs e)
84 | {
85 | var msg = "チューナ更新していいですか?\n続行すると、更新処理をしてTvmaidを再起動します。";
86 | var res = MessageBox.Show(msg, Program.Name, MessageBoxButtons.OKCancel);
87 |
88 | if (res == DialogResult.OK)
89 | {
90 | Program.IsTunerUpdate = true;
91 | Program.IsReboot = true;
92 | Close();
93 | }
94 | }
95 |
96 | private void stopEpgMenuItem_Click(object sender, EventArgs e)
97 | {
98 | RecTimer.CancelUpdateEpg();
99 | }
100 |
101 | private void startEpgMenuItem_Click(object sender, EventArgs e)
102 | {
103 | RecTimer.UpdateEpg();
104 | }
105 |
106 | private void sleepMenuItem_Click(object sender, EventArgs e)
107 | {
108 | sleepMan.SetSleep();
109 | }
110 |
111 | private void openEpgMenuItem_Click(object sender, EventArgs e)
112 | {
113 | try
114 | {
115 | System.Diagnostics.Process.Start(AppDefine.Main.Data["epgurl"]);
116 | }
117 | catch (Exception ex)
118 | {
119 | Log.Error("番組表を開けませんでした。[詳細] " + ex.Message);
120 | Log.Debug(ex.StackTrace);
121 | }
122 | }
123 |
124 | private void setupMenuItem_Click(object sender, EventArgs e)
125 | {
126 | var setup = new SetupForm();
127 | var ret = setup.ShowDialog(this);
128 |
129 | if (ret == DialogResult.Yes)
130 | Close();
131 | }
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/Tvmaid/Data/Event.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Tvmaid
5 | {
6 | //番組
7 | class Event
8 | {
9 | public int Id = -1;
10 | public long Fsid;
11 | public int Eid;
12 | public DateTime Start;
13 | public int Duration;
14 | public string Title;
15 | public string Desc;
16 | public string LongDesc;
17 | public long Genre;
18 | public bool Pay;
19 |
20 | public DateTime End
21 | {
22 | get
23 | {
24 | return new DateTime(Start.Ticks + ((long)Duration * 10 * 1000 * 1000));
25 | }
26 | }
27 |
28 | public string GenreText
29 | {
30 | get
31 | {
32 | return AppDefine.GenreConverter.GetText(Genre);
33 | }
34 | }
35 |
36 | public int Week
37 | {
38 | get { return (int)Start.DayOfWeek; }
39 | }
40 |
41 | public Event() { }
42 |
43 | public Event(DbTable t)
44 | {
45 | Init(t);
46 | }
47 |
48 | void Init(DbTable t)
49 | {
50 | Id = t.GetInt("id");
51 | Fsid = t.GetLong("fsid");
52 | Eid = t.GetInt("eid");
53 | Start = new DateTime(t.GetLong("start"));
54 | Duration = t.GetInt("duration");
55 | Title = t.GetStr("title");
56 | Desc = t.GetStr("desc");
57 | LongDesc = t.GetStr("longdesc");
58 | Genre = t.GetLong("genre");
59 | }
60 |
61 | public Event(Tvdb tvdb, long fsid, int eid)
62 | {
63 | tvdb.Sql = "select * from event where fsid = {0} and eid = {1}".Formatex(fsid, eid);
64 | using (var t = tvdb.GetTable())
65 | {
66 | if (t.Read())
67 | Init(t);
68 | else
69 | throw new Exception("番組が見つかりません。");
70 | }
71 | }
72 |
73 | public Event(Tvdb tvdb, int id)
74 | {
75 | tvdb.Sql = "select * from event where id = " + id;
76 | using (var t = tvdb.GetTable())
77 | {
78 | if (t.Read())
79 | Init(t);
80 | else
81 | throw new Exception("番組が見つかりません。");
82 | }
83 | }
84 |
85 | void Remove(Tvdb tvdb)
86 | {
87 | RemoveById(tvdb, Id);
88 | }
89 |
90 | static void RemoveById(Tvdb tvdb, int id)
91 | {
92 | tvdb.Sql = "delete from event where id = " + id;
93 | tvdb.Execute();
94 | }
95 |
96 | public void Add(Tvdb tvdb)
97 | {
98 | try
99 | {
100 | tvdb.BeginTrans();
101 |
102 | if (Id == -1)
103 | Id = tvdb.GetNextId("event"); //IDは常に増加させること
104 | else
105 | Remove(tvdb);
106 |
107 | var conv = AppDefine.TextConverter;
108 |
109 | tvdb.Sql = @"insert into event values(
110 | {0}, {1}, {2},
111 | {3}, {4}, {5},
112 | '{6}', '{7}', '{8}', {9}, {10},
113 | {11}, '{12}');".Formatex(
114 | Id,
115 | Fsid,
116 | Eid,
117 |
118 | Start.Ticks,
119 | End.Ticks,
120 | Duration,
121 |
122 | Tvdb.SqlEncode(conv.Convert(Title)),
123 | Tvdb.SqlEncode(conv.Convert(Desc)),
124 | Tvdb.SqlEncode(conv.Convert(LongDesc)),
125 | Genre,
126 | Pay ? 1: 0,
127 |
128 | Week,
129 | GenreText
130 | );
131 | tvdb.Execute();
132 | }
133 | finally
134 | {
135 | tvdb.Commit();
136 | }
137 | }
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/Tvmaid/Streaming/VideoStreamReader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Threading;
5 |
6 | namespace Tvmaid
7 | {
8 | //ライブと録画の読み込みを共通化する
9 | abstract class VideoStreamReader : IDisposable
10 | {
11 | protected int ready = 0;
12 |
13 | public abstract int Read(byte[] buf);
14 | public abstract void Dispose();
15 | public bool Ready { get { return ready > 0; } }
16 | }
17 |
18 | class LiveStreamReader : VideoStreamReader
19 | {
20 | TvServer server;
21 | LiveStream stream;
22 |
23 | public LiveStreamReader(string tunerName, long fsid)
24 | {
25 | Tuner tuner;
26 | Service service;
27 |
28 | try
29 | {
30 | using (var tvdb = new Tvdb(true))
31 | {
32 | tuner = new Tuner(tvdb, tunerName);
33 | service = new Service(tvdb, fsid);
34 | }
35 |
36 | server = new TvServer(tuner);
37 | server.Open(false);
38 | server.AddRef();
39 | server.SetService(service);
40 |
41 | stream = new LiveStream("/tvmaid/shared/stream/" + tuner.DriverId, fsid);
42 |
43 | Interlocked.Increment(ref ready);
44 | }
45 | catch
46 | {
47 | Dispose();
48 | throw;
49 | }
50 | }
51 |
52 | public override int Read(byte[] buf)
53 | {
54 | if (server.IsOpen() == false)
55 | throw new Exception("TVTestが終了しました。");
56 |
57 | var watch = new Stopwatch();
58 | watch.Start();
59 | const int timeout = 20 * 1000; //最大待ち時間
60 |
61 | while (true)
62 | {
63 | var count = stream.Read(buf);
64 | if (count > 0)
65 | return count;
66 | else if (watch.ElapsedMilliseconds > timeout)
67 | return 0;
68 | else
69 | Thread.Sleep(50);
70 | }
71 | }
72 |
73 | public override void Dispose()
74 | {
75 | Interlocked.Decrement(ref ready);
76 |
77 | try
78 | {
79 | if (stream != null)
80 | stream.Dispose();
81 |
82 | Thread.Sleep(2 * 1000); //終了を遅らせる(すぐに次のリクエストがあるとTVTextが終了中になるため)
83 |
84 | if (server != null)
85 | {
86 | server.RemoveRef();
87 | server.Close();
88 | }
89 | }
90 | catch { }
91 | }
92 | }
93 |
94 | class RecordStreamReader : VideoStreamReader
95 | {
96 | FileStream stream;
97 | double duration;
98 |
99 | public RecordStreamReader(int id, int start)
100 | {
101 | Record rec;
102 |
103 | using (var tvdb = new Tvdb(true))
104 | rec = new Record(tvdb, id);
105 |
106 | var path = Path.Combine(AppDefine.Main.Data["record.folder"], rec.File);
107 |
108 | if (File.Exists(path) == false)
109 | throw new Exception("指定されたIDの録画ファイルはありません。");
110 |
111 | duration = (rec.End - rec.Start).TotalSeconds;
112 |
113 | if (start < 0 || start > duration)
114 | throw new Exception("record streamで無効な開始時間が指定されました。");
115 |
116 | stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
117 |
118 | var pos = (long)Math.Floor(stream.Length / duration) * start;
119 | pos -= (pos % 188);
120 |
121 | stream.Seek(pos, SeekOrigin.Begin);
122 |
123 | Interlocked.Increment(ref ready);
124 | }
125 |
126 | public override int Read(byte[] buf)
127 | {
128 | return stream.Read(buf, 0, buf.Length);
129 | }
130 |
131 | public override void Dispose()
132 | {
133 | Interlocked.Decrement(ref ready);
134 |
135 | try
136 | {
137 | stream.Dispose();
138 | }
139 | catch { }
140 | }
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/Tvmaid/TunerUpdater.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Windows.Forms;
4 |
5 | namespace Tvmaid
6 | {
7 | static class TunerUpdater
8 | {
9 | public static void Update()
10 | {
11 | using (var tvdb = new Tvdb(true))
12 | {
13 | Log.Info("チューナを更新しています...");
14 | UpdateTuner(tvdb); //チューナ更新(DB更新)
15 |
16 | Log.Info("サービスを更新しています...");
17 | bool overlap = UpdateService(tvdb);
18 |
19 | Log.Info("余分なデータを削除しています...");
20 | Cleanup(tvdb);
21 |
22 | if (overlap)
23 | MessageBox.Show("サービスが重複しています。\nこのままでも使用できますが、TVTestのチャンネルスキャンで同じ放送局を1つを残して他は無効(チェックを外す)にすることをおすすめします。", Program.Name);
24 | }
25 |
26 | Log.Info("チューナ更新が完了しました。");
27 | }
28 |
29 | static void Cleanup(Tvdb tvdb)
30 | {
31 | tvdb.BeginTrans();
32 |
33 | try
34 | {
35 | //以前から残っている番組で、新しくなったサービスにないものは削除する
36 | tvdb.Sql = "delete from event where fsid not in (select fsid from service group by fsid)";
37 | tvdb.Execute();
38 |
39 | //同ユーザ番組表
40 | tvdb.Sql = "delete from user_epg where fsid not in (select fsid from service group by fsid)";
41 | tvdb.Execute();
42 |
43 | //同予約
44 | tvdb.Sql = "delete from reserve where fsid not in (select fsid from service group by fsid)";
45 | tvdb.Execute();
46 |
47 | //予約でチューナがないものは削除
48 | tvdb.Sql = "delete from reserve where tuner not in (select name from tuner)";
49 | tvdb.Execute();
50 | }
51 | finally
52 | {
53 | tvdb.Commit();
54 | }
55 | }
56 |
57 | //チューナ更新
58 | static void UpdateTuner(Tvdb tvdb)
59 | {
60 | var def = new PairList(Util.GetUserPath("tuner.def"));
61 | def.Load();
62 |
63 | tvdb.Sql = "delete from tuner";
64 | tvdb.Execute();
65 |
66 | foreach (var pair in def)
67 | {
68 | var tuner = new Tuner(pair.Key, pair.Value);
69 | tuner.Add(tvdb);
70 | }
71 | }
72 |
73 | //サービス更新
74 | //戻り値: サービスの重複があるかどうか
75 | static bool UpdateService(Tvdb tvdb)
76 | {
77 | tvdb.Sql = "delete from service";
78 | tvdb.Execute();
79 |
80 | var tuners = new List();
81 | tvdb.Sql = "select * from tuner group by driver ";
82 |
83 | using (var table = tvdb.GetTable())
84 | while (table.Read())
85 | tuners.Add(new Tuner(table));
86 |
87 | bool overlap = false;
88 |
89 | foreach (Tuner tuner in tuners)
90 | {
91 | TvServer server = null;
92 |
93 | try
94 | {
95 | server = new TvServer(tuner);
96 | server.Open();
97 | overlap = GetServices(server, tvdb); //サービスをTVTestから読み込み
98 | }
99 | finally
100 | {
101 | if (server != null)
102 | server.Close();
103 | }
104 | }
105 |
106 | return overlap;
107 | }
108 |
109 | //サービスリスト更新
110 | static bool GetServices(TvServer server, Tvdb tvdb)
111 | {
112 | var list = server.GetServices();
113 | bool overlap = false;
114 |
115 | foreach (var service in list)
116 | {
117 | //fsidが0の場合は不正とみなして無視する
118 | //CATVがないのにBonDriverのChSet.txtでCATVが有効になっていると、このデータが返ってくる
119 | if (service.Fsid == 0) continue;
120 |
121 | tvdb.Sql = "select id from service where driver = '{0}' and fsid = {1}".Formatex(Tvdb.SqlEncode(service.Driver), service.Fsid);
122 | var id = tvdb.GetData();
123 | if (id == null)
124 | service.Add(tvdb);
125 | else
126 | overlap = true;
127 | }
128 |
129 | return overlap;
130 | }
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/Tvmaid/Streaming/HlsPlaylist.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Tvmaid
5 | {
6 | //HLSプレイリスト基本クラス
7 | abstract class HlsPlaylist
8 | {
9 | protected class HlsSegment
10 | {
11 | public string Name;
12 | public double Duration;
13 | }
14 |
15 | protected List segments = new List();
16 | protected double length = 0; //全体の長さ
17 |
18 | HlsSegment next = null; //読み込み中のセグメント情報
19 |
20 | public abstract string GetList();
21 |
22 | //start: リストに書き込む最初の位置
23 | //max: リスト最大数
24 | //sequence: #EXT-X-MEDIA-SEQUENCE
25 | public string GetList(int start, int max, int sequence)
26 | {
27 | var header = "#EXTM3U\n"
28 | + "#EXT-X-VERSION:3\n"
29 | + "#EXT-X-ALLOW-CACHE:NO\n"
30 | + "#EXT-X-MEDIA-SEQUENCE:{0}\n".Formatex(sequence);
31 |
32 | var list = "";
33 | var maxDuration = 0.0;
34 |
35 | for (var i = start; i < segments.Count && i < start + max; i++)
36 | {
37 | list += "#EXTINF:{0:0.000000},\n/hls/{1}\n".Formatex(segments[i].Duration, segments[i].Name);
38 | maxDuration = segments[i].Duration > maxDuration ? segments[i].Duration : maxDuration;
39 | }
40 |
41 | header += "#EXT-X-TARGETDURATION:{0}\n".Formatex(Math.Ceiling(maxDuration));
42 |
43 | return header + list;
44 | }
45 |
46 | public int Count
47 | {
48 | get
49 | {
50 | lock (segments)
51 | return segments.Count;
52 | }
53 | }
54 |
55 | public void GetSegmentNames(Action action)
56 | {
57 | lock (segments)
58 | {
59 | foreach (var seg in segments)
60 | action(seg.Name);
61 | }
62 | }
63 |
64 | //プレイリストを1行ずつ読み込み
65 | public void Load(string line)
66 | {
67 | if (next == null && line.StartsWith("#EXTINF:"))
68 | {
69 | next = new HlsSegment();
70 |
71 | try
72 | {
73 | next.Duration = line.Replace("#EXTINF:", "").Replace(",", "").ToDouble();
74 | }
75 | catch
76 | {
77 | next = null;
78 | }
79 | }
80 | else if (next != null)
81 | {
82 | next.Name = line;
83 |
84 | lock (segments)
85 | {
86 | segments.Add(next);
87 | length += next.Duration;
88 | }
89 |
90 | next = null;
91 | }
92 | }
93 | }
94 |
95 | class HlsLivePlaylist : HlsPlaylist
96 | {
97 | public override string GetList()
98 | {
99 | lock (segments)
100 | {
101 | const int max = 30; //60秒保持する
102 | var start = segments.Count <= max ? 0 : segments.Count - max;
103 |
104 | return GetList(start, segments.Count, start);
105 | }
106 | }
107 | }
108 |
109 | class HlsRecordPlaylist : HlsPlaylist
110 | {
111 | bool reset = true;
112 | int start = 0;
113 | int count = 3;
114 |
115 | public bool Seekable(int pos)
116 | {
117 | return pos < length;
118 | }
119 |
120 | public void Seek(int pos)
121 | {
122 | var time = 0.0;
123 |
124 | for (var i = 0; i < segments.Count; i++)
125 | {
126 | time += segments[i].Duration;
127 | if (time > pos)
128 | {
129 | start = i == 0 ? 0 : (i - 1);
130 | break;
131 | }
132 | }
133 | reset = true;
134 | }
135 |
136 | public override string GetList()
137 | {
138 | lock (segments)
139 | {
140 | if (reset)
141 | count = 3;
142 | else
143 | count = count <= segments.Count ? count + 3 : segments.Count;
144 |
145 | reset = false;
146 |
147 | return GetList(start, count, 0);
148 | }
149 | }
150 | }
151 | }
152 |
--------------------------------------------------------------------------------
/Maidbar/Maidbar.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {1D08774B-CCB7-4AC8-8871-76D111B0D13B}
8 | WinExe
9 | Properties
10 | Maidbar
11 | Maidbar
12 | v4.6
13 | 512
14 | true
15 |
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | ..\bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | ..\bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 | high-heeled.ico
38 |
39 |
40 |
41 | ..\lib\DynamicJson.dll
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | Form
61 |
62 |
63 | MainForm.cs
64 |
65 |
66 |
67 | ResXFileCodeGenerator
68 | Resources.Designer.cs
69 | Designer
70 |
71 |
72 | True
73 | Resources.resx
74 | True
75 |
76 |
77 | MainForm.cs
78 |
79 |
80 | SettingsSingleFileGenerator
81 | Settings.Designer.cs
82 |
83 |
84 | True
85 | Settings.settings
86 | True
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
103 |
--------------------------------------------------------------------------------
/Timekeeper/Timekeeper.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {C5FD8E92-676D-41F7-B30E-2B4797408D08}
8 | WinExe
9 | Properties
10 | Timekeeper
11 | Timekeeper
12 | v4.6
13 | 512
14 | true
15 |
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | ..\bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | ..\bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 | timer.ico
38 |
39 |
40 |
41 | ..\lib\DynamicJson.dll
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | Form
61 |
62 |
63 | MainForm.cs
64 |
65 |
66 |
67 | ResXFileCodeGenerator
68 | Resources.Designer.cs
69 | Designer
70 |
71 |
72 | True
73 | Resources.resx
74 | True
75 |
76 |
77 | MainForm.cs
78 | Designer
79 |
80 |
81 | SettingsSingleFileGenerator
82 | Settings.Designer.cs
83 |
84 |
85 | True
86 | Settings.settings
87 | True
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
104 |
--------------------------------------------------------------------------------
/Tvmaid/Web/WebServer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using System.Threading.Tasks;
4 |
5 | namespace Tvmaid
6 | {
7 | class WebServer
8 | {
9 | HttpListener listener = new HttpListener();
10 | bool stop = false;
11 |
12 | static WebServer server;
13 |
14 | public static void Run()
15 | {
16 | Task.Factory.StartNew(() =>
17 | {
18 | server = new WebServer();
19 | server.Start();
20 |
21 | System.Diagnostics.Debug.WriteLine("WebServer Exit");
22 |
23 | }, TaskCreationOptions.AttachedToParent);
24 | }
25 |
26 | public static void Stop()
27 | {
28 | if (server != null) server.Dispose();
29 | }
30 |
31 | WebServer() {}
32 |
33 | public void Start()
34 | {
35 | var prefix = AppDefine.Main.Data["url"];
36 | if (prefix == null) prefix = "http://+:20001/";
37 |
38 | Log.Info("URL: " + prefix);
39 |
40 | try
41 | {
42 | listener.Prefixes.Add(prefix);
43 | listener.Start();
44 | }
45 | catch (Exception ex)
46 | {
47 | var msg = "Webサーバの初期化に失敗しました。この状態では、ブラウザからアクセスできません。アプリケーションを終了してください。[詳細] " + ex.Message;
48 | Log.Error(msg);
49 | Log.Debug(ex.StackTrace);
50 |
51 | System.Windows.Forms.MessageBox.Show(msg, Program.Name);
52 | return;
53 | }
54 |
55 | while (stop == false)
56 | {
57 | try
58 | {
59 | var context = listener.GetContext();
60 | Task.Factory.StartNew(() =>
61 | {
62 | OnRequest(context);
63 | }, TaskCreationOptions.AttachedToParent);
64 | }
65 | catch (HttpListenerException he)
66 | {
67 | //終了時に出るエラーを回避
68 | if (he.ErrorCode == 995) return;
69 | }
70 | catch (Exception ex)
71 | {
72 | Log.Error(ex.Message);
73 | Log.Debug(ex.StackTrace);
74 | }
75 | }
76 | }
77 |
78 | public void Dispose()
79 | {
80 | listener.Close();
81 | stop = true;
82 | }
83 |
84 | void OnRequest(HttpListenerContext con)
85 | {
86 | try
87 | {
88 | System.Diagnostics.Debug.WriteLine("web request... " + con.Request.Url.AbsolutePath);
89 |
90 | if (con.Request.HttpMethod != "GET" && con.Request.HttpMethod != "HEAD")
91 | {
92 | con.Response.StatusCode = (int)HttpStatusCode.MethodNotAllowed;
93 | con.Response.ContentLength64 = 0;
94 | con.Response.OutputStream.Close();
95 | return;
96 | }
97 |
98 | var uri = con.Request.Url.AbsolutePath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
99 | WebTask task;
100 |
101 | if (uri.Length == 0)
102 | uri = new string[] { "" };
103 |
104 | switch (uri[0])
105 | {
106 | case "webapi":
107 | task = new WebApi(con);
108 | break;
109 | case "live-stream":
110 | task = new WebPdLiveStream(con);
111 | break;
112 | case "record-stream":
113 | task = new WebPdRecordStream(con);
114 | break;
115 | case "hls-playlist":
116 | task = new WebHlsPlaylist(con);
117 | break;
118 | case "hls":
119 | task = new WebHlsSegment(con);
120 | break;
121 | case "logo":
122 | task = new WebLogo(con);
123 | break;
124 | default:
125 | task = new WebFile(con);
126 | break;
127 | }
128 |
129 | task.Run();
130 | }
131 | catch (Exception ex)
132 | {
133 | try
134 | {
135 | con.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
136 | con.Response.ContentLength64 = 0;
137 | con.Response.OutputStream.Close();
138 | }
139 | catch { }
140 |
141 | Log.Error(ex.Message);
142 | Log.Debug(ex.StackTrace);
143 | }
144 | }
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/Tvmaid/TvServer/TvServer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Threading;
5 |
6 | namespace Tvmaid
7 | {
8 | class TvServer: TvServerApi
9 | {
10 | const int timeout = 30 * 1000;
11 |
12 | //参照カウンタ
13 | static RefCounter refCounter = new RefCounter();
14 |
15 | public TvServer(Tuner tuner) : base (tuner) { }
16 |
17 | public new void Open(bool show = false)
18 | {
19 | using (new MutexEx("/tvmaid/mutex/tvserver/start/" + tuner.DriverId, timeout))
20 | {
21 | if (IsOpen())
22 | return;
23 |
24 | base.Open(show);
25 |
26 | //TVTestのウインドウがアイドルになっても、プラグインの初期化が終わっているとは限らない
27 | //プラグインの通信用ウインドウが作成されるのを待つ
28 | var interval = 100;
29 |
30 | for (int i = 0; i < timeout / interval; i++)
31 | {
32 | if (IsOpen())
33 | return;
34 | else
35 | Thread.Sleep(interval);
36 | }
37 |
38 | throw new Exception("TVTestの初期化が時間内に終了しませんでした。[原因]TVTestが初期化中にエラーになったか、PCの負荷が高過ぎる等が考えられます。");
39 | }
40 | }
41 |
42 | public new void Close()
43 | {
44 | if (IsOpen() == false)
45 | return;
46 |
47 | //参照カウント確認
48 | if (refCounter.Count(tuner.Name) > 0 || IsRecording)
49 | return;
50 |
51 | using (new MutexEx("/tvmaid/mutex/tvserver/start/" + tuner.DriverId, timeout))
52 | {
53 | if (IsOpen())
54 | {
55 | try
56 | {
57 | base.Close();
58 | }
59 | catch { }
60 | }
61 |
62 | //閉じるのを待つ
63 | //待たないと、すぐに次の予約があるとき録画が失敗する
64 | var interval = 100;
65 |
66 | for (int i = 0; i < timeout / interval; i++)
67 | {
68 | if (IsOpen() == false)
69 | return;
70 | else
71 | Thread.Sleep(interval);
72 | }
73 |
74 | Log.Error("TVTestが時間内に終了しませんでした。");
75 | }
76 | }
77 |
78 | public void AddRef()
79 | {
80 | refCounter.Inc(tuner.Name);
81 | }
82 |
83 | public void RemoveRef()
84 | {
85 | refCounter.Dec(tuner.Name);
86 | }
87 |
88 | //状態を取得
89 | public new State GetState()
90 | {
91 | try
92 | {
93 | if (IsOpen())
94 | return (State)base.GetState();
95 | else
96 | return State.Stoped;
97 | }
98 | catch
99 | {
100 | return State.Unknown;
101 | }
102 | }
103 |
104 | //サービス切り替え
105 | public new void SetService(Service service)
106 | {
107 | try
108 | {
109 | if (IsRecording)
110 | return;
111 |
112 | base.SetService(service);
113 | }
114 | catch (TvServerExceotion ex)
115 | {
116 | if (ex.Code == (int)ErrorCode.SetService)
117 | {
118 | //リトライ
119 | Thread.Sleep(1000);
120 | base.SetService(service);
121 | }
122 | else
123 | throw;
124 | }
125 | }
126 |
127 | public bool IsRecording
128 | {
129 | get
130 | {
131 | var state = GetState();
132 | return (state == State.Recoding || state == State.RecPaused);
133 | }
134 | }
135 | }
136 |
137 | //参照カウンタ
138 | class RefCounter
139 | {
140 | Dictionary counter = new Dictionary();
141 |
142 | public void Inc(string name)
143 | {
144 | lock (counter)
145 | {
146 | if (counter.ContainsKey(name) == false)
147 | counter.Add(name, 1);
148 | else
149 | counter[name]++;
150 | }
151 | Debug.WriteLine("TvServer ref count {0}: {1}".Formatex(name, counter[name]));
152 | }
153 |
154 | public void Dec(string name)
155 | {
156 | lock (counter)
157 | {
158 | if (counter.ContainsKey(name) == false)
159 | return;
160 | else
161 | counter[name]--;
162 | }
163 | Debug.WriteLine("TvServer ref count {0}: {1}".Formatex(name, counter[name]));
164 | }
165 |
166 | public int Count(string name)
167 | {
168 | lock (counter)
169 | {
170 | if (counter.ContainsKey(name))
171 | return counter[name];
172 | else
173 | return 0;
174 | }
175 | }
176 | }
177 | }
178 |
--------------------------------------------------------------------------------
/etc/wwwroot/maya/log.tag.html:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 | { line.icon }
13 |
14 |
15 |
{ line.day }
16 |
{ line.time }
17 |
18 |
{ line.text }
19 |
20 |
21 |
22 |
23 |
24 |
25 |
54 |
55 |
173 |
--------------------------------------------------------------------------------
/Tvmaid/Streaming/Encoder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Threading;
5 | using System.Threading.Tasks;
6 |
7 | namespace Tvmaid
8 | {
9 | //エンコーダ基本クラス
10 | abstract class Encoder : IDisposable
11 | {
12 | Process process = new Process();
13 | BinaryReader reader;
14 | BinaryWriter writer;
15 | int ready = 0;
16 | Stopwatch readerWatch = new Stopwatch();
17 | Stopwatch writerWatch = new Stopwatch();
18 |
19 | protected void Open(string encoder, string option, bool window, string workDir)
20 | {
21 | var p = new Process();
22 | p.StartInfo.WorkingDirectory = workDir;
23 | p.StartInfo.FileName = encoder;
24 | p.StartInfo.Arguments = option;
25 | p.StartInfo.UseShellExecute = false;
26 | p.StartInfo.CreateNoWindow = window;
27 | p.StartInfo.RedirectStandardInput = true;
28 | p.StartInfo.RedirectStandardOutput = true;
29 |
30 | p.Start();
31 | process = p;
32 |
33 | reader = new BinaryReader(p.StandardOutput.BaseStream);
34 | writer = new BinaryWriter(p.StandardInput.BaseStream);
35 | Interlocked.Increment(ref ready);
36 |
37 | //エンコーダの変換が止まってないか監視するスレッド
38 | Task.Factory.StartNew(() =>
39 | {
40 | const int timecout = 30 * 1000;
41 |
42 | readerWatch.Start();
43 | writerWatch.Start();
44 |
45 | while (ready > 0)
46 | {
47 | if ((writer != null && writerWatch.ElapsedMilliseconds > timecout) || readerWatch.ElapsedMilliseconds > timecout)
48 | {
49 | Log.Debug("エンコーダの応答がないため停止します。");
50 | Dispose();
51 | break;
52 | }
53 | Thread.Sleep(500);
54 | }
55 | }, TaskCreationOptions.AttachedToParent);
56 | }
57 |
58 | void ErrorCheck()
59 | {
60 | if (Ready == false)
61 | throw new Exception("エンコーダの準備ができていません。");
62 | }
63 |
64 | public void Write(byte[] buf, int count)
65 | {
66 | ErrorCheck();
67 | writerWatch.Restart();
68 | writer.Write(buf, 0, count);
69 | }
70 |
71 | public void Read()
72 | {
73 | ErrorCheck();
74 | readerWatch.Restart();
75 | }
76 |
77 | public byte[] Read(int size)
78 | {
79 | ErrorCheck();
80 | readerWatch.Restart();
81 | return reader.ReadBytes(size);
82 | }
83 |
84 | public string ReadLine()
85 | {
86 | ErrorCheck();
87 | readerWatch.Restart();
88 | return process.StandardOutput.ReadLine();
89 | }
90 |
91 | //書き込み終了
92 | public void EndWrite()
93 | {
94 | if (writer != null) writer.Close();
95 | writer = null;
96 | }
97 |
98 | public void Dispose()
99 | {
100 | Interlocked.Decrement(ref ready);
101 |
102 | try
103 | {
104 | if (reader != null) reader.Close();
105 | if (writer != null) writer.Close();
106 | if (process != null) process.Dispose();
107 | }
108 | catch { }
109 | }
110 |
111 | public bool Ready { get { return ready > 0; } }
112 | }
113 |
114 | class PdEncoder : Encoder
115 | {
116 | public string MediaType;
117 |
118 | public void Open(string mode)
119 | {
120 | var define = new PairList(Util.GetUserPath("pd.def"));
121 | define.Load();
122 |
123 | var encoder = Util.GetBasePath(define["encoder"]);
124 |
125 | if (File.Exists(encoder) == false)
126 | throw new Exception("エンコーダがありません。" + encoder);
127 |
128 | if (define.IsDefined(mode) == false)
129 | throw new Exception("指定された変換モードはありません。" + mode);
130 |
131 | MediaType = define["type"];
132 |
133 | Open(encoder, define[mode], define["window"] == "hide", null);
134 | }
135 | }
136 |
137 | class HlsEncoder : Encoder
138 | {
139 | static int unique = 0; //セグメントファイル名をユニークにするための番号
140 |
141 | public void Open(string mode)
142 | {
143 | var define = new PairList(Util.GetUserPath("hls.def"));
144 | define.Load();
145 |
146 | var encoder = Util.GetBasePath(define["encoder"]);
147 |
148 | if (File.Exists(encoder) == false)
149 | throw new Exception("エンコーダがありません。" + encoder);
150 |
151 | if (define.IsDefined(mode) == false)
152 | throw new Exception("指定された変換モードはありません。" + mode);
153 |
154 | var option = define[mode].Replace("{segment-id}", unique.ToString());
155 | Interlocked.Increment(ref unique);
156 |
157 | var workDir = Util.GetTempPath();
158 |
159 | if (Directory.Exists(workDir) == false)
160 | Directory.CreateDirectory(workDir);
161 |
162 | Open(encoder, option, define["window"] == "hide", workDir);
163 | }
164 | }
165 | }
166 |
--------------------------------------------------------------------------------
/TvmaidPlugin/TvmaidPlugin.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {F4818D7D-2EE2-4FD7-9633-6C3AAE5DBB66}
15 | Win32Proj
16 | TvmaidPlugin
17 | 10.0
18 |
19 |
20 |
21 | DynamicLibrary
22 | true
23 | v142
24 | Unicode
25 |
26 |
27 | DynamicLibrary
28 | false
29 | v142
30 | true
31 | Unicode
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | true
45 | .tvtp
46 | ..\bin\debug\
47 | ..\bin\$(Configuration)\obj\
48 |
49 |
50 | false
51 | .tvtp
52 | ..\bin\$(Configuration)\obj\
53 | ..\bin\release\
54 |
55 |
56 |
57 | Use
58 | Level3
59 | Disabled
60 | WIN32;_DEBUG;_WINDOWS;_USRDLL;TVMAIDPLUGIN_EXPORTS;%(PreprocessorDefinitions)
61 | MultiThreadedDebugDLL
62 |
63 |
64 | Windows
65 | true
66 | Exports.def
67 |
68 |
69 |
70 |
71 | Level3
72 | Use
73 | MaxSpeed
74 | true
75 | true
76 | WIN32;NDEBUG;_WINDOWS;_USRDLL;TVMAIDPLUGIN_EXPORTS;%(PreprocessorDefinitions)
77 | MultiThreaded
78 |
79 |
80 | Windows
81 | true
82 | true
83 | true
84 | Exports.def
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 | Create
100 | Create
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/Tvmaid/Streaming/WebPdStream.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Net;
5 | using System.Threading;
6 | using System.Threading.Tasks;
7 |
8 | namespace Tvmaid
9 | {
10 | //PDストリーミング基本クラス
11 | abstract class WebPdStream : WebTask
12 | {
13 | protected VideoStreamReader reader;
14 | PdEncoder encoder;
15 |
16 | public WebPdStream(HttpListenerContext con) : base(con) { }
17 |
18 | public override void Run() { }
19 |
20 | protected void Encode(string mode)
21 | {
22 | try
23 | {
24 | encoder = new PdEncoder();
25 | encoder.Open(mode);
26 | con.Response.ContentType = encoder.MediaType;
27 | }
28 | catch (Exception ex)
29 | {
30 | Debug.WriteLine("エンコーダが起動できません... " + ex.Message);
31 | Log.Error(ex.Message);
32 | Dispose();
33 | return;
34 | }
35 |
36 | var stop = false;
37 | var tasks = new Task[2];
38 |
39 | //エンコーダへデータを送信
40 | tasks[0] = Task.Factory.StartNew(() =>
41 | {
42 | try
43 | {
44 | var buf = new byte[188 * 1024];
45 |
46 | while (stop == false && encoder.Ready)
47 | {
48 | var count = reader.Read(buf);
49 |
50 | if (count > 0)
51 | encoder.Write(buf, count);
52 | else
53 | break;
54 | }
55 | }
56 | catch (Exception ex)
57 | {
58 | Debug.WriteLine("ライブ→エンコーダでエラーが発生... " + ex.Message);
59 | }
60 |
61 | encoder.EndWrite();
62 |
63 | }, TaskCreationOptions.AttachedToParent);
64 |
65 | //エンコーダからキューへ格納
66 | const int queueSize = 32;
67 | var queue = new Queue(queueSize); //エンコードデータを溜めるキュー
68 | bool finish = false; //エンコード完了フラグ
69 |
70 | tasks[1] = Task.Factory.StartNew(() =>
71 | {
72 | try
73 | {
74 | while (stop == false && encoder.Ready)
75 | {
76 | if (queue.Count < queueSize)
77 | {
78 | var bufsize = 64 * 1024;
79 | var data = encoder.Read(bufsize);
80 |
81 | if (data.Length > 0)
82 | queue.Enqueue(data);
83 | else
84 | break;
85 | }
86 | else
87 | {
88 | encoder.Read(); //キューがいっぱいのときに、エンコーダが終了しないようにする
89 | Thread.Sleep(100);
90 | }
91 | }
92 | }
93 | catch (Exception ex)
94 | {
95 | stop = true;
96 | Debug.WriteLine("エンコーダ→キューでエラーが発生... " + ex.Message);
97 | }
98 |
99 | finish = true;
100 |
101 | }, TaskCreationOptions.AttachedToParent);
102 |
103 | //キューからブラウザへ送信
104 | try
105 | {
106 | con.Response.SendChunked = true;
107 |
108 | while (stop == false && encoder.Ready)
109 | {
110 | if (queue.Count > 0)
111 | {
112 | var data = queue.Dequeue();
113 | con.Response.OutputStream.Write(data, 0, data.Length);
114 | }
115 | else
116 | {
117 | if (finish)
118 | break;
119 | else
120 | Thread.Sleep(100);
121 | }
122 | }
123 | }
124 | catch (Exception ex)
125 | {
126 | stop = true;
127 | Debug.WriteLine("キュー→レスポンスでエラーが発生... " + ex.Message);
128 | }
129 |
130 | Task.WaitAll(tasks, 3000);
131 | Dispose();
132 | }
133 |
134 | void Dispose()
135 | {
136 | if (encoder != null)
137 | encoder.Dispose();
138 |
139 | if (reader != null)
140 | reader.Dispose();
141 | }
142 | }
143 |
144 | class WebPdLiveStream : WebPdStream
145 | {
146 | public WebPdLiveStream(HttpListenerContext con) : base(con) { }
147 |
148 | public override void Run()
149 | {
150 | Debug.WriteLine("live stream request.");
151 |
152 | var tunerName = GetQuery("tuner");
153 | var fsid = GetQuery("fsid").ToLong();
154 | var mode = GetQuery("mode");
155 |
156 | reader = new LiveStreamReader(tunerName, fsid);
157 | Encode(mode);
158 | }
159 | }
160 |
161 | class WebPdRecordStream : WebPdStream
162 | {
163 | public WebPdRecordStream(HttpListenerContext con) : base(con) { }
164 |
165 | public override void Run()
166 | {
167 | Debug.WriteLine("record stream request.");
168 |
169 | var id = GetQuery("id").ToInt();
170 | var start = GetQuery("start").ToInt();
171 | var mode = GetQuery("mode");
172 |
173 | reader = new RecordStreamReader(id, start);
174 | Encode(mode);
175 | }
176 | }
177 | }
178 |
--------------------------------------------------------------------------------
/Maidbar/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Timekeeper/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Tvmaid/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Tvmaid/TsFileInfo.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.VisualBasic.FileIO;
2 | using System;
3 | using System.IO;
4 | using System.Diagnostics;
5 |
6 | namespace Tvmaid
7 | {
8 | //TSファイルの情報を取得
9 | class TsFileInfo
10 | {
11 | public DateTime StartTime;
12 | public DateTime EndTime;
13 | public DateTime ReserveStart;
14 | public DateTime ReserveEnd;
15 |
16 | public string Title = "";
17 | public string Service = "";
18 | public string Desc = "";
19 | public string LongDesc = "";
20 | public string Genre = "";
21 | public string File;
22 |
23 | public TsFileInfo(string path)
24 | {
25 | File = Path.GetFileName(path);
26 | Title = Path.GetFileNameWithoutExtension(path);
27 |
28 | using (var fs = new FileStream(path, FileMode.Open))
29 | {
30 | if (fs.Length < 188 * 10)
31 | throw new Exception("ファイルサイズが小さすぎます。");
32 |
33 | StartTime = GetTsTime(fs, false);
34 |
35 | fs.Seek(-188, SeekOrigin.End);
36 | EndTime = GetTsTime(fs, true);
37 | }
38 |
39 | if (EndTime - StartTime > TimeSpan.FromHours(24))
40 | throw new Exception("不正な時刻のファイルです。");
41 |
42 | ReserveStart = StartTime;
43 | ReserveEnd = EndTime;
44 |
45 | var csv = GetTsInfo(path);
46 |
47 | if (csv != null)
48 | ParseCsv(csv);
49 | }
50 |
51 | string GetTsInfo(string path)
52 | {
53 | var p = new Process();
54 | p.StartInfo.FileName = Util.GetBasePath("rplsinfo.exe");
55 | p.StartInfo.Arguments = string.Format("\"{0}\" -C -dtpcbieg -l 10", path);
56 | p.StartInfo.UseShellExecute = false;
57 | p.StartInfo.CreateNoWindow = true;
58 | p.StartInfo.RedirectStandardOutput = true;
59 | p.Start();
60 | var data = p.StandardOutput.ReadToEnd();
61 | p.WaitForExit();
62 |
63 | return p.ExitCode == 0 ? data : null;
64 | }
65 |
66 | void ParseCsv(string csv)
67 | {
68 | var parser = new TextFieldParser(new StringReader(csv));
69 | parser.TextFieldType = FieldType.Delimited;
70 | parser.SetDelimiters(",");
71 | parser.HasFieldsEnclosedInQuotes = true;
72 | parser.TrimWhiteSpace = false;
73 | var row = parser.ReadFields();
74 |
75 | var start = row[0] + " " + row[1];
76 | var duration = row[2];
77 |
78 | DateTime time;
79 |
80 | if (DateTime.TryParse(start, out time))
81 | ReserveStart = time;
82 |
83 | TimeSpan span;
84 | if (TimeSpan.TryParse(duration, out span))
85 | ReserveEnd = ReserveStart.Add(span);
86 |
87 | var conv = AppDefine.TextConverter;
88 |
89 | Service = row[3];
90 | Title = conv.Convert(row[4]);
91 | Desc = conv.Convert(row[5]);
92 | LongDesc = conv.Convert(row[6]);
93 | Genre = row[7].Replace(" 〔", "/").Replace("〕 ", "\r\n").Replace("〕", "\r\n");
94 | }
95 |
96 | DateTime GetTsTime(FileStream fs, bool back)
97 | {
98 | var packet = new byte[188];
99 | long start = 0; //PCR最初
100 | long end = 0; //PCR最後
101 |
102 | while (true)
103 | {
104 | var count = fs.Read(packet, 0, packet.Length);
105 |
106 | if (count != packet.Length)
107 | throw new Exception("時刻の情報が見つかりません。");
108 |
109 | if (packet[0] != 0x47)
110 | throw new Exception("不正なデータがあり、時間を取得できませんでした。");
111 |
112 | //PCR
113 | //アダプテーションあり+PCRあり
114 | if ((packet[3] & 0x20) > 0 && (packet[5] & 0x10) > 0)
115 | {
116 | //33bitのPCRを取得
117 | long pcr = ((long)packet[6] << 25) + ((long)packet[7] << 17) + ((long)packet[8] << 9) + ((long)packet[9] << 1) + ((packet[10] >> 7) & 0x1);
118 |
119 | if (start == 0 && end == 0)
120 | start = pcr;
121 |
122 | end = pcr;
123 | }
124 |
125 | //TOT
126 | var pid = ((packet[1] << 8) + packet[2]) & 0x1fff;
127 |
128 | if (pid == 0x14)
129 | {
130 | var diff = (start - end) / 90000; //90kHzで割って秒単位にする
131 | var time = GetMjdTime(packet, 4 + 1 + 3); //4+1+3「TSヘッダ+ペイロード区切り+ペイロードの時刻情報」までのバイト数
132 |
133 | if (Math.Abs(diff) < 11)
134 | return time.AddSeconds(diff); //TOTは5~10秒ごとなので、PCRで補正する
135 | else
136 | return time; //PCRが11秒以上なら無視(不正と判断)してTOTの時刻を返す
137 | }
138 |
139 | if (back)
140 | fs.Seek(-188 * 2, SeekOrigin.Current);
141 | }
142 | }
143 |
144 | DateTime GetMjdTime(byte[] packet, int start)
145 | {
146 | var mjd = (packet[start + 0] << 8) | packet[start + 1];
147 |
148 | var y = (int)((mjd - 15078.2) / 365.25);
149 | var m = (int)((mjd - 14956.1 - (int)(y * 365.25)) / 30.6001);
150 | var k = (14 == m || m == 15) ? 1 : 0;
151 |
152 | var day = mjd - 14956 - (int)(y * 365.25) - (int)(m * 30.6001);
153 | var year = 1900 + y + k;
154 | var month = m - 1 - k * 12;
155 |
156 | var hour = ((packet[start + 2] & 0xf0) >> 4) * 10 + (packet[start + 2] & 0x0f);
157 | var minute = ((packet[start + 3] & 0xf0) >> 4) * 10 + (packet[start + 3] & 0x0f);
158 | var second = ((packet[start + 4] & 0xf0) >> 4) * 10 + (packet[start + 4] & 0x0f);
159 |
160 | return new DateTime(year, month, day, hour, minute, second);
161 | }
162 | }
163 | }
164 |
--------------------------------------------------------------------------------
/Tvmaid/Gui/SleepCountdown.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Tvmaid
2 | {
3 | partial class SleepCountdown
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.components = new System.ComponentModel.Container();
32 | this.cancelButton = new System.Windows.Forms.Button();
33 | this.countLabel = new System.Windows.Forms.Label();
34 | this.timer = new System.Windows.Forms.Timer(this.components);
35 | this.sleepButton = new System.Windows.Forms.Button();
36 | this.progressBar = new System.Windows.Forms.ProgressBar();
37 | this.wakeTimeLable = new System.Windows.Forms.Label();
38 | this.SuspendLayout();
39 | //
40 | // cancelButton
41 | //
42 | this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
43 | this.cancelButton.Location = new System.Drawing.Point(429, 92);
44 | this.cancelButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
45 | this.cancelButton.Name = "cancelButton";
46 | this.cancelButton.Size = new System.Drawing.Size(99, 31);
47 | this.cancelButton.TabIndex = 4;
48 | this.cancelButton.Text = "キャンセル";
49 | this.cancelButton.UseVisualStyleBackColor = true;
50 | //
51 | // countLabel
52 | //
53 | this.countLabel.AutoSize = true;
54 | this.countLabel.Location = new System.Drawing.Point(27, 23);
55 | this.countLabel.Name = "countLabel";
56 | this.countLabel.Size = new System.Drawing.Size(86, 19);
57 | this.countLabel.TabIndex = 0;
58 | this.countLabel.Text = "カウントダウン";
59 | //
60 | // timer
61 | //
62 | this.timer.Enabled = true;
63 | this.timer.Interval = 1000;
64 | this.timer.Tick += new System.EventHandler(this.timer_Tick);
65 | //
66 | // sleepButton
67 | //
68 | this.sleepButton.Location = new System.Drawing.Point(324, 92);
69 | this.sleepButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
70 | this.sleepButton.Name = "sleepButton";
71 | this.sleepButton.Size = new System.Drawing.Size(99, 31);
72 | this.sleepButton.TabIndex = 3;
73 | this.sleepButton.Text = "スリープ";
74 | this.sleepButton.UseVisualStyleBackColor = true;
75 | this.sleepButton.Click += new System.EventHandler(this.sleepButton_Click);
76 | //
77 | // progressBar
78 | //
79 | this.progressBar.Location = new System.Drawing.Point(31, 64);
80 | this.progressBar.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
81 | this.progressBar.Maximum = 60;
82 | this.progressBar.Name = "progressBar";
83 | this.progressBar.Size = new System.Drawing.Size(497, 10);
84 | this.progressBar.TabIndex = 1;
85 | //
86 | // wakeTimeLable
87 | //
88 | this.wakeTimeLable.AutoSize = true;
89 | this.wakeTimeLable.Location = new System.Drawing.Point(27, 98);
90 | this.wakeTimeLable.Name = "wakeTimeLable";
91 | this.wakeTimeLable.Size = new System.Drawing.Size(69, 19);
92 | this.wakeTimeLable.TabIndex = 2;
93 | this.wakeTimeLable.Text = "復帰予定";
94 | //
95 | // SleepCountdown
96 | //
97 | this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 19F);
98 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
99 | this.CancelButton = this.cancelButton;
100 | this.ClientSize = new System.Drawing.Size(558, 142);
101 | this.ControlBox = false;
102 | this.Controls.Add(this.wakeTimeLable);
103 | this.Controls.Add(this.progressBar);
104 | this.Controls.Add(this.sleepButton);
105 | this.Controls.Add(this.countLabel);
106 | this.Controls.Add(this.cancelButton);
107 | this.Font = new System.Drawing.Font("Meiryo UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
108 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
109 | this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
110 | this.MaximizeBox = false;
111 | this.MinimizeBox = false;
112 | this.Name = "SleepCountdown";
113 | this.ShowInTaskbar = false;
114 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
115 | this.Text = "Tvmaid";
116 | this.TopMost = true;
117 | this.ResumeLayout(false);
118 | this.PerformLayout();
119 |
120 | }
121 |
122 | #endregion
123 |
124 | private System.Windows.Forms.Button cancelButton;
125 | private System.Windows.Forms.Label countLabel;
126 | private System.Windows.Forms.Timer timer;
127 | private System.Windows.Forms.Button sleepButton;
128 | private System.Windows.Forms.ProgressBar progressBar;
129 | private System.Windows.Forms.Label wakeTimeLable;
130 | }
131 | }
--------------------------------------------------------------------------------
/Tvmaid/Data/AutoReserve.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Tvmaid
5 | {
6 | //自動録画予約
7 | class AutoReserve
8 | {
9 | public int Id = -1; //-1: 新規
10 | public string Name = "未定";
11 | public string Folder = "";
12 |
13 | public string Query = "";
14 | public string Option = "";
15 | public int Status = (int)Reserve.StatusCode.Overlay | (int)Reserve.StatusCode.EventMode;
16 |
17 | public enum AutoRecStatus
18 | {
19 | Enable = 1
20 | };
21 |
22 | public AutoReserve() { }
23 |
24 | public AutoReserve(DbTable t)
25 | {
26 | Init(t);
27 | }
28 |
29 | void Init(DbTable t)
30 | {
31 | Id = t.GetInt("id");
32 | Name = t.GetStr("name");
33 | Folder = t.GetStr("folder");
34 |
35 | Query = t.GetStr("query");
36 | Option = t.GetStr("option");
37 | Status = t.GetInt("status");
38 | }
39 |
40 | public AutoReserve(Tvdb tvdb, int id)
41 | {
42 | tvdb.Sql = "select * from auto_reserve where id = " + id;
43 | using (var t = tvdb.GetTable())
44 | {
45 | if (t.Read())
46 | Init(t);
47 | else
48 | throw new Exception("自動予約が見つかりません。");
49 | }
50 | }
51 |
52 | //削除
53 | public void Remove(Tvdb tvdb)
54 | {
55 | //自動で行われた予約を削除
56 | tvdb.Sql = "delete from reserve where auto = " + Id;
57 | tvdb.Execute();
58 |
59 | tvdb.Sql = "delete from auto_reserve where id = " + Id;
60 | tvdb.Execute();
61 |
62 | Reserve.SetOverlay(tvdb);
63 | }
64 |
65 | //追加/編集
66 | public void Add(Tvdb tvdb)
67 | {
68 | try
69 | {
70 | tvdb.BeginTrans();
71 |
72 | if (this.Name == "")
73 | throw new Exception("名前を入力してください。");
74 |
75 | if (Id == -1)
76 | {
77 | tvdb.Sql = "select id from auto_reserve where name = '{0}'".Formatex(Name);
78 |
79 | if (tvdb.GetData() != null)
80 | throw new Exception("同じ名前の自動予約があります。登録できませんでした。 - " + Name);
81 |
82 | Id = tvdb.GetNextId("auto_reserve");
83 | }
84 | else
85 | {
86 | tvdb.Sql = "select id from auto_reserve where name = '{0}' and not id = {1}".Formatex(Name, Id);
87 |
88 | if (tvdb.GetData() != null)
89 | throw new Exception("同じ名前の自動予約があります。登録できませんでした。 - " + Name);
90 |
91 | Remove(tvdb);
92 | }
93 |
94 | if (Folder == "")
95 | throw new Exception("フォルダ名がありません。登録できませんでした。 - " + Name);
96 |
97 | tvdb.Sql = @"insert into auto_reserve values(
98 | {0}, '{1}', '{2}', '{3}', '{4}', {5});".Formatex(
99 | Id,
100 | Tvdb.SqlEncode(Name),
101 | Tvdb.SqlEncode(Folder),
102 | Tvdb.SqlEncode(Query),
103 | Tvdb.SqlEncode(Option),
104 | Status
105 | );
106 | tvdb.Execute();
107 | }
108 | finally
109 | {
110 | tvdb.Commit();
111 | }
112 |
113 | if (Status == 1)
114 | AddReserve(tvdb);
115 | }
116 |
117 | //検索条件に合致して、まだ予約されていない番組を予約
118 | public void AddReserve(Tvdb tvdb)
119 | {
120 | //現時刻+マージン(マージンを足しておかないと、終了した番組を予約してしまうため)
121 | var margin = AppDefine.Main.Data.GetInt("record.margin.end");
122 | var now = DateTime.Now + new TimeSpan(0, 0, margin);
123 |
124 | tvdb.Sql = @"select * from event
125 | left join reserve on event.fsid = reserve.fsid and event.eid = reserve.eid
126 | where
127 | event.end > {0} and reserve.id is null and event.id in ({1})".Formatex(now.Ticks, Query);
128 |
129 | var events = new List();
130 |
131 | using (var t = tvdb.GetTable())
132 | {
133 | while (t.Read())
134 | events.Add(new Event(t));
135 | }
136 |
137 | //missAutoReserveCount以上ヒットした場合、その自動予約を無効にする(間違った自動予約と判定する)
138 | const int missAutoReserveCount = 50;
139 |
140 | if (events.Count > missAutoReserveCount)
141 | {
142 | this.Status = 0;
143 | tvdb.Sql = "update auto_reserve set status = 0 where id = " + this.Id;
144 | tvdb.Execute();
145 |
146 | Log.Alert("自動予約 '{0}' を無効にしました。{1} 件以上ヒットします。条件を見なおしてください。".Formatex(Name, missAutoReserveCount));
147 | }
148 | else
149 | {
150 | foreach (var ev in events)
151 | {
152 | var res = new Reserve();
153 | res.Fsid = ev.Fsid;
154 | res.Eid = ev.Eid;
155 | res.StartTime = ev.Start;
156 | res.Duration = ev.Duration;
157 | res.Title = ev.Title;
158 | res.Auto = Id;
159 | res.Add(tvdb);
160 | }
161 | }
162 | }
163 |
164 | public static void AddReserveAll(Tvdb tvdb)
165 | {
166 | var autoList = new List();
167 | tvdb.Sql = "select * from auto_reserve where status = 1 and query <> ''";
168 |
169 | using (var t = tvdb.GetTable())
170 | {
171 | while (t.Read())
172 | autoList.Add(new AutoReserve(t));
173 | }
174 |
175 | foreach (var auto in autoList)
176 | auto.AddReserve(tvdb);
177 | }
178 | }
179 | }
180 |
--------------------------------------------------------------------------------
/Tvmaid/Gui/ExitForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------
/Tvmaid/TvServer/TvServerApi.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Tvmaid
5 | {
6 | abstract class TvServerApi : TvServerBase
7 | {
8 | public enum State
9 | {
10 | View, //視聴
11 | Recoding, //録画中
12 | RecPaused, //録画一時停止中
13 | Stoped, //停止
14 | Unknown //不明
15 | }
16 |
17 | public TvServerApi(Tuner tuner) : base(tuner) { }
18 |
19 | public void Close()
20 | {
21 | Call(Api.Close);
22 | }
23 |
24 | public bool IsEpgComplete(int nid, int tsid)
25 | {
26 | var arg = "{0}\x1{1}\x0".Formatex(nid, tsid);
27 | return Call(Api.IsEpgComplete, arg) == "1";
28 | }
29 |
30 | public int GetState()
31 | {
32 | return Call(Api.GetState).ToInt();
33 | }
34 |
35 | //サービスリストを取得
36 | public List GetServices()
37 | {
38 | var ret = Call(Api.GetServices);
39 |
40 | var lines = ret.Split(new char[] { '\x1' }, StringSplitOptions.RemoveEmptyEntries);
41 | var list = new List();
42 |
43 | foreach (var line in lines)
44 | {
45 | try
46 | {
47 | //データの一部が、""になっている場合があるので、
48 | //StringSplitOptions.RemoveEmptyEntriesをつけてはいけない
49 | var data = line.Split(new char[] { '\x2' });
50 |
51 | var s = new Service();
52 | s.Driver = System.IO.Path.GetFileName(tuner.DriverPath);
53 | s.Nid = Convert.ToInt32(data[0]);
54 | s.Tsid = Convert.ToInt32(data[1]);
55 | s.Sid = Convert.ToInt32(data[2]);
56 | s.Name = data[3];
57 | list.Add(s);
58 | }
59 | catch (Exception ex)
60 | {
61 | throw new Exception("サービス情報が不正です。[追加情報] " + ex.Message);
62 | }
63 |
64 | }
65 | return list;
66 | }
67 |
68 | //サービス切り替え
69 | public void SetService(Service service)
70 | {
71 | var arg = string.Format("{0}\x1{1}\x1{2}\x0", service.Nid, service.Tsid, service.Sid);
72 | Call(Api.SetService, arg);
73 | }
74 |
75 | //指定イベントの時間を取得
76 | //録画時の追従用
77 | //EventのStartとDurationのみセットする
78 | public Event GetEventTime(Service service, int eid)
79 | {
80 | var arg = "{0}\x1{1}\x1{2}\x1{3}\x0".Formatex(service.Nid, service.Tsid, service.Sid, eid);
81 | var ret = Call(Api.GetEventTime, arg);
82 |
83 | try
84 | {
85 | var data = ret.Split(new char[] { '\x1' }, StringSplitOptions.RemoveEmptyEntries);
86 | var ev = new Event();
87 | ev.Start = Convert.ToDateTime(data[0]);
88 | ev.Duration = Convert.ToInt32(data[1]);
89 |
90 | return ev;
91 | }
92 | catch (Exception ex)
93 | {
94 | throw new Exception("番組情報が不正です。[追加情報] " + ex.Message);
95 | }
96 | }
97 |
98 | //TSの状態を取得
99 | public TsStatus GetTsStatus()
100 | {
101 | var ret = Call(Api.GetTsStatus);
102 |
103 | try
104 | {
105 | var data = ret.Split(new char[] { '\x1' }, StringSplitOptions.RemoveEmptyEntries);
106 | var error = Convert.ToUInt64(data[0]);
107 | var drop = Convert.ToUInt64(data[1]);
108 | var scramble = Convert.ToUInt64(data[2]);
109 |
110 | var ts = new TsStatus();
111 | ts.Error = error < int.MaxValue ? (int)error : int.MaxValue;
112 | ts.Drop = drop < int.MaxValue ? (int)drop : int.MaxValue;
113 | ts.Scramble = scramble < int.MaxValue ? (int)scramble : int.MaxValue;
114 |
115 | return ts;
116 | }
117 | catch (Exception ex)
118 | {
119 | throw new Exception("TSエラー情報が不正です。[追加情報] " + ex.Message);
120 | }
121 | }
122 |
123 | //番組表更新
124 | public List GetEvents(Service service)
125 | {
126 | var arg = string.Format("{0}\x1{1}\x1{2}\x0", service.Nid, service.Tsid, service.Sid);
127 | var ret = Call(Api.GetEvents, arg);
128 | var list = new List();
129 |
130 | var lines = ret.Split(new char[] { '\x1' }, StringSplitOptions.RemoveEmptyEntries);
131 |
132 | foreach (var line in lines)
133 | {
134 | try
135 | {
136 | //データの一部が、""になっている場合があるので、
137 | //StringSplitOptions.RemoveEmptyEntriesをつけてはいけない
138 | var data = line.Split(new char[] { '\x2' });
139 | var ev = new Event();
140 |
141 | ev.Eid = data[0].ToInt();
142 | ev.Start = data[1].ToDateTime();
143 | ev.Duration = data[2].ToInt();
144 | ev.Title = data[3];
145 | ev.Desc = data[4];
146 | ev.LongDesc = data[5];
147 | ev.Genre = data[6].ToLong();
148 | ev.Pay = data[7] == "1";
149 | ev.Fsid = service.Fsid;
150 | list.Add(ev);
151 | }
152 | catch (Exception ex)
153 | {
154 | throw new Exception("番組情報が不正です。[追加情報] " + ex.Message);
155 | }
156 | }
157 | return list;
158 | }
159 |
160 | public void StartRec(string file)
161 | {
162 | Call(Api.StartRec, string.Format("{0}\0", file));
163 | }
164 |
165 | public void GetLogo(Service service, string path)
166 | {
167 | var req = string.Format("{0}\x1{1}\x1{2}\x1{3}\x0", service.Nid, service.Tsid, service.Sid, path);
168 | Call(Api.GetLogo, req);
169 | }
170 |
171 | public void StopRec()
172 | {
173 | Call(Api.StopRec);
174 | }
175 | }
176 | }
177 |
--------------------------------------------------------------------------------
/Tvmaid/Gui/SleepCountdown.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------