[TB] fix: moving hash dir files too far up
This commit is contained in:
parent
9d57466472
commit
bd96795f34
2 changed files with 9 additions and 3 deletions
|
|
@ -354,13 +354,19 @@ public class TorBoxTorrentClient(ILogger<TorBoxTorrentClient> logger, IHttpClien
|
||||||
return Map(result!);
|
return Map(result!);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MoveHashDirectoryUpTB(String extractPath, Torrent _torrent)
|
public static void MoveHashDirContents(String extractPath, Torrent _torrent)
|
||||||
{
|
{
|
||||||
var hashDir = Path.Combine(extractPath, _torrent.Hash);
|
var hashDir = Path.Combine(extractPath, _torrent.Hash);
|
||||||
|
|
||||||
if (Directory.Exists(hashDir))
|
if (Directory.Exists(hashDir))
|
||||||
{
|
{
|
||||||
var innerFolder = Directory.GetDirectories(hashDir)[0];
|
var innerFolder = Directory.GetDirectories(hashDir)[0];
|
||||||
|
|
||||||
|
if (!Path.GetFileName(innerFolder).Equals(_torrent.Hash, StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
innerFolder = hashDir;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var file in Directory.GetFiles(innerFolder))
|
foreach (var file in Directory.GetFiles(innerFolder))
|
||||||
{
|
{
|
||||||
var destFile = Path.Combine(extractPath, Path.GetFileName(file));
|
var destFile = Path.Combine(extractPath, Path.GetFileName(file));
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ public class UnpackClient(Download download, String destinationPath)
|
||||||
|
|
||||||
if (Settings.Get.Provider.Provider == Data.Enums.Provider.TorBox)
|
if (Settings.Get.Provider.Provider == Data.Enums.Provider.TorBox)
|
||||||
{
|
{
|
||||||
TorBoxTorrentClient.MoveHashDirectoryUpTB(extractPath, _torrent);
|
TorBoxTorrentClient.MoveHashDirContents(extractPath, _torrent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue