Skip to content

Commit 3df69fc

Browse files
committed
fix missing cache file; add video urls #3
1 parent 59441cd commit 3df69fc

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

VOffline/Services/Storage/FilesystemTools.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ public FilesystemTools(IOptionsSnapshot<Settings> settings)
2727
RootDir = MkDir(settings.Value.OutputPath);
2828
cacheFile = new FileInfo(CombineCutPath(RootDir, CacheFilename));
2929
cache = new ConcurrentDictionary<string, DateTime>();
30+
31+
if (!cacheFile.Exists)
32+
{
33+
cacheFile.Create()?.Dispose();
34+
}
3035
}
3136

3237
public void LoadCache(ILog log)

VOffline/Services/Vk/AttachmentExtensions.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ public static IEnumerable<IDownload> ToDownloads(this Video video, int i, Filesy
9494
}
9595
else
9696
{
97-
log.Warn($"Video {video.Id} [{video.Title}] has no links");
97+
log.Warn($"Video {video.Id} [{video.Title}] has no links. Trying to compose vk url");
98+
var file = filesystemTools.CreateFile(dir, $"{i} {video.Id}.txt", CreateMode.OverwriteExisting);
99+
File.WriteAllText(file.FullName, $"https://vk.com/video{video.OwnerId}_{video.Id}");
98100
}
99101
}
100102

@@ -201,6 +203,7 @@ public static string Serialize(this Comment comment)
201203
{
202204
sb.Append($", reply to user {comment.ReplyToUserId} comment {comment.ReplyToCommentId}");
203205
}
206+
204207
return sb.ToString();
205208
}
206209

VOffline/VOffline.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>netcoreapp2.1</TargetFramework>
6-
<UsersecretsId>26938AF3-7336-429C-A3AF-2D3048ACB226</UsersecretsId>
76
<LangVersion>latest</LangVersion>
7+
<RootNamespace>VOffline</RootNamespace>
8+
<UserSecretsId>93680df2-87fc-4326-b623-001d5725f6ae</UserSecretsId>
89
</PropertyGroup>
910

1011
<ItemGroup>

0 commit comments

Comments
 (0)