Skip to content

Commit

Permalink
Relax IO access restrictions
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrubN committed Dec 14, 2023
1 parent e63469d commit 3a947a9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion TwitchDownloaderCore/Tools/FfmpegMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static class FfmpegMetadata
public static async Task SerializeAsync(string filePath, string streamerName, string videoId, string videoTitle, DateTime videoCreation, int viewCount, string videoDescription = null,
double startOffsetSeconds = 0, IEnumerable<VideoMomentEdge> videoMomentEdges = null, CancellationToken cancellationToken = default)
{
await using var fs = new FileStream(filePath, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None);
await using var fs = new FileStream(filePath, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.Read);
await using var sw = new StreamWriter(fs) { NewLine = LINE_FEED };

await SerializeGlobalMetadata(sw, streamerName, videoId, videoTitle, videoCreation, viewCount, videoDescription);
Expand Down
2 changes: 1 addition & 1 deletion TwitchDownloaderCore/TwitchHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ public static async Task<GqlUserInfoResponse> GetUserInfo(List<string> idList)
//Let's save this image to the cache
try
{
await using var stream = File.Open(filePath, FileMode.Create, FileAccess.ReadWrite, FileShare.None);
await using var stream = File.Open(filePath, FileMode.Create, FileAccess.Write, FileShare.Read);
await stream.WriteAsync(imageBytes, cancellationToken);
}
catch { }
Expand Down
4 changes: 2 additions & 2 deletions TwitchDownloaderCore/VideoDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ private static bool VerifyVideoPart(string downloadFolder, string part)
return false;
}

using var fs = File.Open(partFile, FileMode.Open, FileAccess.Read, FileShare.None);
using var fs = File.Open(partFile, FileMode.Open, FileAccess.Read, FileShare.Read);
var fileLength = fs.Length;
if (fileLength == 0 || fileLength % TS_PACKET_LENGTH != 0)
{
Expand Down Expand Up @@ -668,7 +668,7 @@ private async Task CombineVideoParts(string downloadFolder, List<string> videoPa
int partCount = videoParts.Count;
int doneCount = 0;

await using var outputStream = new FileStream(outputFile, FileMode.Create, FileAccess.Write, FileShare.None);
await using var outputStream = new FileStream(outputFile, FileMode.Create, FileAccess.Write, FileShare.Read);
foreach (var part in videoParts)
{
await DriveHelper.WaitForDrive(outputDrive, _progress, cancellationToken);
Expand Down

0 comments on commit 3a947a9

Please sign in to comment.