Skip to content

Commit 8ab5aee

Browse files
committed
Remove redundant timestamp option
1 parent 6be2d3f commit 8ab5aee

File tree

3 files changed

+13
-23
lines changed

3 files changed

+13
-23
lines changed

TwitchDownloaderCLI/Options.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class Options
3434
public int DownloadThreads { get; set; }
3535
[Option("oauth", HelpText = "OAuth to be passed when downloading a VOD.")]
3636
public string Oauth { get; set; }
37-
[Option("timestamp", HelpText = "Enable timestamp for chat download in .txt format or chat render.")]
37+
[Option("timestamp", HelpText = "Enable timestamp in chat render.")]
3838
public bool Timestamp { get; set; }
39-
[Option("timestamp-format", HelpText = "Sets the timestamp format for .txt chat logs. Valid values are Utc, Relative, and None")]
39+
[Option("timestamp-format", HelpText = "Sets the timestamp format for .txt chat logs. Valid values are Utc, Relative, and None", Default = TimestampFormat.None)]
4040
public TimestampFormat TimeFormat { get; set; }
4141
[Option("embed-emotes", HelpText = "Embed emotes into chat download.")]
4242
public bool EmbedEmotes { get; set; }

TwitchDownloaderCLI/README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ Time in seconds to crop beginning. For example if I wanted a 10 second stream bu
6161
**-e/-\-ending**
6262
Time in seconds to crop ending. For example if I wanted a 10 second stream but only wanted the first 4 seconds of it I would use -e 4 remove the last 6 seconds of it.
6363

64-
**-\-timestamp**
65-
If downloading to a text file, will add timestamps before each message.
66-
6764
**-\-timestamp-format**
6865
Sets the timestamp format for .txt chat logs. Valid values are Utc, Relative, and None.
6966

@@ -141,7 +138,7 @@ Download a Clip
141138
TwitchDownloaderCLI -m ClipDownload --id NurturingCalmHamburgerVoHiYo -o clip.mp4
142139
Download a Chat (plain text with timestamps)
143140

144-
TwitchDownloaderCLI -m ChatDownload --id 612942303 --timestamp -o chat.txt
141+
TwitchDownloaderCLI -m ChatDownload --id 612942303 --timestamp-format Relative -o chat.txt
145142
Download a Chat (JSON with embeded emotes)
146143

147144
TwitchDownloaderCLI -m ChatDownload --id 612942303 --embed-emotes -o chat.json

TwitchDownloaderCore/ChatDownloader.cs

+10-17
Original file line numberDiff line numberDiff line change
@@ -160,25 +160,18 @@ await Task.Run(() => {
160160
{
161161
string username = comment.commenter.display_name;
162162
string message = comment.message.body;
163-
if (downloadOptions.Timestamp)
163+
if (downloadOptions.TimeFormat == TimestampFormat.Utc)
164164
{
165-
if (downloadOptions.TimeFormat == TimestampFormat.Utc)
166-
{
167-
string timestamp = comment.created_at.ToString("u").Replace("Z", " UTC");
168-
sw.WriteLine(String.Format("[{0}] {1}: {2}", timestamp, username, message));
169-
}
170-
else if (downloadOptions.TimeFormat == TimestampFormat.Relative)
171-
{
172-
TimeSpan time = new TimeSpan(0, 0, (int)comment.content_offset_seconds);
173-
string timestamp = time.ToString(@"h\:mm\:ss");
174-
sw.WriteLine(String.Format("[{0}] {1}: {2}", timestamp, username, message));
175-
}
176-
else if (downloadOptions.TimeFormat == TimestampFormat.None)
177-
{
178-
sw.WriteLine(String.Format("{0}: {1}", username, message));
179-
}
165+
string timestamp = comment.created_at.ToString("u").Replace("Z", " UTC");
166+
sw.WriteLine(String.Format("[{0}] {1}: {2}", timestamp, username, message));
180167
}
181-
else
168+
else if (downloadOptions.TimeFormat == TimestampFormat.Relative)
169+
{
170+
TimeSpan time = new TimeSpan(0, 0, (int)comment.content_offset_seconds);
171+
string timestamp = time.ToString(@"h\:mm\:ss");
172+
sw.WriteLine(String.Format("[{0}] {1}: {2}", timestamp, username, message));
173+
}
174+
else if (downloadOptions.TimeFormat == TimestampFormat.None)
182175
{
183176
sw.WriteLine(String.Format("{0}: {1}", username, message));
184177
}

0 commit comments

Comments
 (0)