Skip to content

Commit

Permalink
Twitch変換機能修正
Browse files Browse the repository at this point in the history
- yt-dlp(Youtube)のコメント変換時に常にYoutubeカスタム絵文字が:aaaaaaaaa: のように表示されるのを修正
リファクタリング
- 不要な変数と未使用のメソッド削除
  • Loading branch information
nnn-revo2012 committed May 23, 2023
1 parent bc83625 commit af0a232
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 100 deletions.
17 changes: 15 additions & 2 deletions comeconv/ConvTwitch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,25 @@ public bool TwitchConvertYtDlpYoutube(string sfile, string dfile)
if (emt["text"] != null)
message += emt["text"].ToString();
else if (emt["emoji"] != null)
{
if (emt["emoji"]["isCustomEmoji"] == null ||
emt["emoji"]["isCustomEmoji"].ToString() == "false")
{
message += emt["emoji"]["emojiId"].ToString();
}
else
if (emt["emoji"]["shortcuts"] != null)
message += emt["emoji"]["shortcuts"].FirstOrDefault().ToString();
{
if (!_props.IsTwiCommType)
{
if (emt["emoji"]["shortcuts"] != null)
message += emt["emoji"]["shortcuts"].FirstOrDefault().ToString();
}
else
{
message += " ";
}
}
}
}
}

Expand Down
17 changes: 0 additions & 17 deletions comeconv/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,10 @@ public partial class Form1 : Form
//0処理待ち 1処理中 2中断
private static int ProgramStatus { get; set; } //プログラム状態

//dispose するもの
//private NicoDb _ndb = null; //NicoDb

private ExecPsInfo epi = null; //実行/保存ファイル情報

private readonly object lockObject = new object(); //情報表示用
private string LogFile;
//private string LogFile2;
//private string LogFile3;

public Form1(string[] args)
{
Expand Down Expand Up @@ -118,10 +113,6 @@ private async void tabPage1_DragDrop(object sender, DragEventArgs e)
}
catch (Exception Ex)
{
//if (_ndb != null)
//{
// _ndb.Dispose();
//}
AddLog("ドラッグ&ドロップできません。\r\n" + Ex.Message, 2);
}

Expand Down Expand Up @@ -303,10 +294,6 @@ private async void tabPage3_DragDrop(object sender, DragEventArgs e)
}
catch (Exception Ex)
{
//if (_ndb != null)
//{
// _ndb.Dispose();
//}
AddLog("ドラッグ&ドロップできません。\r\n" + Ex.Message, 2);
}

Expand Down Expand Up @@ -425,10 +412,6 @@ private async void repair_DragDrop(object sender, DragEventArgs e)
}
catch (Exception Ex)
{
//if (_ndb != null)
//{
// _ndb.Dispose();
//}
AddLog("ドラッグ&ドロップできません。\r\n" + Ex.Message, 2);
}

Expand Down
81 changes: 0 additions & 81 deletions comeconv/Prop/Props.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,6 @@ namespace comeconv.Prop

public class Props
{
//定数設定
public static readonly string[][] ReplaceWords =
{
new[] {"?PID?","lv1234567","ProgramId。lv1234567のような文字列。"},
new[] {"?UNAME?","ユーザ名","ユーザ名。公式の場合、official"},
new[] {"?UID?","ユーザID","ユーザID。nicovideo.jp/user/に続く数字の列。公式の場合、official"},
new[] {"?CNAME?","コミュニティ名","コミュニティ名。公式の場合、official"},
new[] {"?CID?","コミュニティID","コミュニティID。co1234のような文字列。公式の場合、official"},
new[] {"?TITLE?","放送タイトル","放送タイトル。"},
new[] {"?YEAR?","2019","年4桁(開演時刻)"},
new[] {"?MONTH?","09","月2桁(開演時刻)"},
new[] {"?DAY?","01","日2桁(開演時刻)"},
new[] {"?DAY8?","20190901","年4桁,月2桁,日2桁"},
new[] {"?DAY6?","190901","年2桁,月2桁,日2桁"},
new[] {"?HOUR?","18","時2桁"},
new[] {"?MINUTE?","31","分2桁"},
new[] {"?SECOND?","02","秒2桁"},
new[] {"?TIME6?","183102","時2桁,分2桁,秒2桁"},
new[] {"?TIME4?","3102","時2桁,分2桁"}
//new[] {"", "",""}
};

public static readonly IDictionary<string, string> PropLists =
new Dictionary<string, string>()
{
// "community"
{"comId", "community.id"}, // "co\d+"
// "program"
{"beginTime", "program.beginTime"}, // integer
{"description", "program.description"}, // 放送説明
{"endTime", "program.endTime"}, // integer
{"isFollowerOnly", "program.isFollowerOnly"}, // bool
{"isPrivate", "program.isPrivate"}, // bool
{"mediaServerType","program.mediaServerType"}, // "DMC"
{"nicoliveProgramId", "program.nicoliveProgramId"}, // "lv\d+"
{"openTime", "program.openTime"}, // integer
{"providerType", "program.providerType"}, // "community"
{"status", "program.status"}, //
{"userName", "program.supplier.name"}, // ユーザ名
{"userPageUrl", "program.supplier.pageUrl"}, // "https://www.nicovideo.jp/user/\d+"
{"title", "program.title"}, // title
{"vposBaseTime", "program.vposBaseTime"}, // integer
// "site"
{"serverTime", "site.serverTime"}, // integer
// "socialGroup"
{"socDescription", "socialGroup.description"}, // コミュ説明
{"socId", "socialGroup.id"}, // "co\d+" or "ch\d+"
{"socLevel", "socialGroup.level"}, // integer
{"socName", "socialGroup.name"}, // community name
{"socType", "socialGroup.type"}, // "community"
// "user"
{"accountType", "user.accountType"}, // "premium"
{"isLoggedIn", "user.isLoggedIn"}, // bool
};

public bool IsDebug { get; set; }

public string ExecFile { get; set; }
Expand Down Expand Up @@ -324,31 +269,5 @@ public static string GetDirSepString()
return Path.DirectorySeparatorChar.ToString();
}

public static string GetProviderType(string type)
{
var result = "??";
switch (type)
{
case "community":
result = "コミュニティ";
break;
case "user":
result = "コミュニティ";
break;
case "channel":
result = "チャンネル";
break;
case "official":
result = "公式生放送";
break;
case "cas":
result = "実験放送";
break;
default:
break;
}
return result;
}

}
}

0 comments on commit af0a232

Please sign in to comment.