home · contact · privacy
Fix sync using from hash representation for retrieving "missing" files. master
authorChristian Heller <c.heller@plomlompom.de>
Wed, 25 Dec 2024 19:59:20 +0000 (20:59 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 25 Dec 2024 19:59:20 +0000 (20:59 +0100)
src/sync.py

index dde4348492c62cfd8c620524fee6ebfc6de84c9c..bd7a74a257e027d3597363a33526aceac0afbdbe 100755 (executable)
@@ -8,7 +8,7 @@ from urllib.request import urlopen
 # non-included libs
 from paramiko import SSHClient  # type: ignore
 from scp import SCPClient  # type: ignore
 # non-included libs
 from paramiko import SSHClient  # type: ignore
 from scp import SCPClient  # type: ignore
-from ytplom.db import DbConn, PATH_DB
+from ytplom.db import DbConn, Hash, PATH_DB
 from ytplom.misc import (
         PATH_TEMP, Config, QuotaLog, VideoFile, YoutubeQuery, YoutubeVideo)
 from ytplom.http import PAGE_NAMES
 from ytplom.misc import (
         PATH_TEMP, Config, QuotaLog, VideoFile, YoutubeQuery, YoutubeVideo)
 from ytplom.http import PAGE_NAMES
@@ -101,7 +101,7 @@ def fill_missing(scp: SCPClient, config: Config) -> None:
         direction, mover = direction_mover
         for digest in (d for d in missings[i]
                        if d not in missings[int(not bool(i))]):
         direction, mover = direction_mover
         for digest in (d for d in missings[i]
                        if d not in missings[int(not bool(i))]):
-            vf = VideoFile.get_one(conn, digest)
+            vf = VideoFile.get_one(conn, Hash.from_b64(digest))
             print(f'SYNC: sending {direction} file {vf.full_path}')
             mover(vf.full_path, vf.full_path)
 
             print(f'SYNC: sending {direction} file {vf.full_path}')
             mover(vf.full_path, vf.full_path)