mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
backend stores media folder/db locations; don't need to pass them in
This commit is contained in:
parent
58da7988c3
commit
aa832e9117
4 changed files with 5 additions and 21 deletions
|
@ -243,7 +243,5 @@ message AddFileToMediaFolderIn {
|
|||
|
||||
message SyncMediaIn {
|
||||
string hkey = 1;
|
||||
string media_folder = 2;
|
||||
string media_db = 3;
|
||||
string endpoint = 4;
|
||||
string endpoint = 2;
|
||||
}
|
||||
|
|
|
@ -276,17 +276,8 @@ class RustBackend:
|
|||
)
|
||||
).add_file_to_media_folder
|
||||
|
||||
def sync_media(
|
||||
self, hkey: str, media_folder: str, media_db: str, endpoint: str
|
||||
) -> None:
|
||||
def sync_media(self, hkey: str, endpoint: str) -> None:
|
||||
self._run_command(
|
||||
pb.BackendInput(
|
||||
sync_media=pb.SyncMediaIn(
|
||||
hkey=hkey,
|
||||
media_folder=media_folder,
|
||||
media_db=media_db,
|
||||
endpoint=endpoint,
|
||||
)
|
||||
),
|
||||
pb.BackendInput(sync_media=pb.SyncMediaIn(hkey=hkey, endpoint=endpoint,)),
|
||||
release_gil=True,
|
||||
)
|
||||
|
|
|
@ -11,7 +11,6 @@ from typing import List, Union
|
|||
import aqt
|
||||
from anki import hooks
|
||||
from anki.lang import _
|
||||
from anki.media import media_paths_from_col_path
|
||||
from anki.rsbackend import (
|
||||
DBError,
|
||||
Interrupted,
|
||||
|
@ -76,12 +75,8 @@ class MediaSyncer:
|
|||
self._want_stop = False
|
||||
gui_hooks.media_sync_did_start_or_stop(True)
|
||||
|
||||
(media_folder, media_db) = media_paths_from_col_path(self.mw.col.path)
|
||||
|
||||
def run() -> None:
|
||||
self.mw.col.backend.sync_media(
|
||||
hkey, media_folder, media_db, self._endpoint()
|
||||
)
|
||||
self.mw.col.backend.sync_media(hkey, self._endpoint())
|
||||
|
||||
self.mw.taskman.run_in_background(run, self._on_finished)
|
||||
|
||||
|
|
|
@ -321,7 +321,7 @@ impl Backend {
|
|||
}
|
||||
|
||||
fn sync_media(&self, input: SyncMediaIn) -> Result<()> {
|
||||
let mgr = MediaManager::new(&input.media_folder, &input.media_db)?;
|
||||
let mgr = MediaManager::new(&self.media_folder, &self.media_db)?;
|
||||
|
||||
let callback = |progress: &MediaSyncProgress| {
|
||||
self.fire_progress_callback(Progress::MediaSync(progress))
|
||||
|
|
Loading…
Reference in a new issue