Skip to content

Commit

Permalink
修正時間字串計算錯誤,輸出檔名加上時間
Browse files Browse the repository at this point in the history
  • Loading branch information
jim60105 committed Feb 22, 2022
1 parent b827894 commit 0d68e55
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Download.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private string CalculatePath(string? title, DateTime? date)

date ??= DateTime.Now;

string newPath = Path.Combine(outputDirectory.FullName, $"{date:yyyyMMdd} {title} ({id}).mp4");
string newPath = Path.Combine(outputDirectory.FullName, $"{date:yyyyMMdd} {title} ({id}) [{start}_{end}].mp4");

Log.Debug("Calculate output file path as {newPath}", newPath);
return newPath;
Expand Down
10 changes: 5 additions & 5 deletions Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ private async Task DownloadAsync(string id, float start, float end, DirectoryInf
Application.DoEvents();
}

MessageBox.Show($"Video segments are stored in:\n\n{download.outputFilePath}", "Finish");

// Open save directory
Process process = new();
process.StartInfo.UseShellExecute = true;
process.StartInfo.FileName = directory.FullName;
process.Start();

MessageBox.Show($"Video segments are stored in:\n\n{download.outputFilePath}", "Finish");
}
catch (Exception e)
{
Expand Down Expand Up @@ -200,13 +200,13 @@ private static float ConvertTimeStringToSecond(string text)
string time = timeList[i].Trim();
if (float.TryParse(time, out var t))
{
result += t * (i * 60);
result += (float)(t * Math.Pow(60, i));
}
else
{
// Parse failed
result = 0;
break;
Log.Logger.Error("Cannot parse {time} to float number!", time);
return -1;
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions Properties/PublishProfiles/ClickOnceProfile.pubxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ApplicationRevision>5</ApplicationRevision>
<ApplicationVersion>1.1.0.*</ApplicationVersion>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.1.1.*</ApplicationVersion>
<BootstrapperEnabled>True</BootstrapperEnabled>
<Configuration>Release</Configuration>
<CreateDesktopShortcut>True</CreateDesktopShortcut>
Expand Down Expand Up @@ -39,7 +39,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<UpdateMode>Foreground</UpdateMode>
<UpdateRequired>False</UpdateRequired>
<WebPageFileName>Publish.html</WebPageFileName>
<History>True|2022-02-22T06:39:00.2333859Z;</History>
</PropertyGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.NetCore.DesktopRuntime.6.0.x64">
Expand Down

0 comments on commit 0d68e55

Please sign in to comment.