fix missing cache file; add video urls #3

This commit is contained in:
Rostislav Kirillov 2021-02-22 20:54:47 +05:00
parent 59441cd0d0
commit 3df69fc5e6
3 changed files with 11 additions and 2 deletions

View file

@ -27,6 +27,11 @@ namespace VOffline.Services.Storage
RootDir = MkDir(settings.Value.OutputPath);
cacheFile = new FileInfo(CombineCutPath(RootDir, CacheFilename));
cache = new ConcurrentDictionary<string, DateTime>();
if (!cacheFile.Exists)
{
cacheFile.Create()?.Dispose();
}
}
public void LoadCache(ILog log)

View file

@ -94,7 +94,9 @@ namespace VOffline.Services.Vk
}
else
{
log.Warn($"Video {video.Id} [{video.Title}] has no links");
log.Warn($"Video {video.Id} [{video.Title}] has no links. Trying to compose vk url");
var file = filesystemTools.CreateFile(dir, $"{i} {video.Id}.txt", CreateMode.OverwriteExisting);
File.WriteAllText(file.FullName, $"https://vk.com/video{video.OwnerId}_{video.Id}");
}
}
@ -201,6 +203,7 @@ namespace VOffline.Services.Vk
{
sb.Append($", reply to user {comment.ReplyToUserId} comment {comment.ReplyToCommentId}");
}
return sb.ToString();
}

View file

@ -3,8 +3,9 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<UsersecretsId>26938AF3-7336-429C-A3AF-2D3048ACB226</UsersecretsId>
<LangVersion>latest</LangVersion>
<RootNamespace>VOffline</RootNamespace>
<UserSecretsId>93680df2-87fc-4326-b623-001d5725f6ae</UserSecretsId>
</PropertyGroup>
<ItemGroup>