Skip to content

Commit

Permalink
media default fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Anime4000 committed Jan 31, 2018
1 parent d4794ab commit c6213b2
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 21 deletions.
8 changes: 7 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
Version 7.7 (Prism Ark)
Version 7.8 (Opera Fantasia)
----------------------------
[new] Able to capture language code from file name (Subtitle)
[fixed] Encoding did not honor "Main List Check State" (able to skip item)
[fixed] Default codecs for new import media

Version 7.7 (Prism Ark)
-----------------------
[new] Enable/Disable verbose log
[fixed] Broken version detection that always return true.
Expand Down
11 changes: 11 additions & 0 deletions ifme/Get.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,17 @@ internal static string LangCheck(string lang)
return "und";
}

internal static string LangFile(string file)
{
var temp = Path.GetFileNameWithoutExtension(file);
var lang = temp.Substring(temp.Length - 3, 3);

if (LanguageCode.TryGetValue(lang, out string code))
return lang;

return "und";
}

internal static bool IsValidPath(string FilePath)
{
try
Expand Down
4 changes: 2 additions & 2 deletions ifme/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.7.*")]
[assembly: AssemblyFileVersion("7.7")]
[assembly: AssemblyVersion("7.8.*")]
[assembly: AssemblyFileVersion("7.8")]
2 changes: 1 addition & 1 deletion ifme/Properties/Resources.Designer.cs

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

2 changes: 1 addition & 1 deletion ifme/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="AppCodeName" xml:space="preserve">
<value>Prism Ark</value>
<value>Opera Fantasia</value>
</data>
<data name="AppTitle" xml:space="preserve">
<value>Internet Friendly Media Encoder</value>
Expand Down
1 change: 1 addition & 0 deletions ifme/frmMain.Designer.cs

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

38 changes: 28 additions & 10 deletions ifme/frmMain.Method.cs
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,18 @@ private void AddMedia(string file)
MediaValidator.GetCodecVideo("mkv", out var vid);
MediaValidator.GetCodecAudio("m4a", out var aid);

foreach (var item in media.Video)
// get default encoder of choice
if (!Plugin.Items.TryGetValue(Properties.Settings.Default.EncoderIdVideo, out Plugin defVideo))
{
// something default if plugin of choice not found
}

if (!Plugin.Items.TryGetValue(Properties.Settings.Default.EncoderIdAudio, out Plugin defAudio))
{
// something default if plugin of choice not found
}

foreach (var item in media.Video)
{
queue.Video.Add(new MediaQueueVideo
{
Expand All @@ -752,11 +763,11 @@ private void AddMedia(string file)

Encoder = new MediaQueueVideoEncoder
{
Id = Properties.Settings.Default.EncoderIdVideo,
Preset = "medium",
Tune = "ssim",
Id = defVideo.GUID,
Preset = defVideo.Video.PresetDefault,
Tune = defVideo.Video.TuneDefault,
Mode = 0,
Value = 24,
Value = defVideo.Video.Mode[0].Value.Default,
MultiPass = 2,
Command = string.Empty
},
Expand Down Expand Up @@ -794,11 +805,11 @@ private void AddMedia(string file)

Encoder = new MediaQueueAudioEncoder
{
Id = Properties.Settings.Default.EncoderIdAudio,
Id = defAudio.GUID,
Mode = 0,
Quality = 192000,
SampleRate = 44100,
Channel = 2,
Quality = defAudio.Audio.Mode[0].Default,
SampleRate = defAudio.Audio.SampleRateDefault,
Channel = defAudio.Audio.ChannelDefault,
Command = string.Empty
}
});
Expand Down Expand Up @@ -908,7 +919,7 @@ private void AddSubtitle(string file)
Enable = true,
File = file,
Id = -1,
Lang = "und",
Lang = Get.LangFile(file),
Format = Path.GetExtension(file).Remove(1)
});
}
Expand Down Expand Up @@ -1548,6 +1559,13 @@ private void bgThread_DoWork(object sender, DoWorkEventArgs e)
lstMedia.Items[id].SubItems[4].Text = $"Done! ({Get.Duration(tt)})";
});
}
else
{
lstMedia.Invoke((MethodInvoker)delegate
{
lstMedia.Items[id].SubItems[4].Text = "Skip...";
});
}
}
}

Expand Down
13 changes: 9 additions & 4 deletions ifme/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ private void btnStart_Click(object sender, EventArgs e)
var dict = new Dictionary<int, MediaQueue>();
foreach (ListViewItem item in lstMedia.Items)
{
dict.Add(item.Index, item.Tag as MediaQueue);
item.SubItems[4].Text = "Waiting...";
}
dict.Add(item.Index, item.Tag as MediaQueue);
item.SubItems[4].Text = "Waiting...";
}

// check if all queue has enable hardsub
if (!dict.All(x => !x.Value.HardSub))
Expand Down Expand Up @@ -337,7 +337,12 @@ private void ListViewItem_KeyDown(object sender, KeyEventArgs e)
}
}

private void lstMedia_SelectedIndexChanged(object sender, EventArgs e)
private void lstMedia_ItemChecked(object sender, ItemCheckedEventArgs e)
{
(lstMedia.Items[e.Item.Index].Tag as MediaQueue).Enable = e.Item.Checked;
}

private void lstMedia_SelectedIndexChanged(object sender, EventArgs e)
{
if (lstMedia.SelectedItems.Count > 0)
{
Expand Down
2 changes: 1 addition & 1 deletion installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Internet Friendly Media Encoder"
#define MyAppVersion "7.6"
#define MyAppVersion "7.8"
#define MyAppPublisher "Anime4000"
#define MyAppURL "https://x265.github.io/"
#define MyAppExeName "ifme.exe"
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.6
7.7

0 comments on commit c6213b2

Please sign in to comment.