mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 12:47:11 -05:00
PlayAudio -> PlayAVTags
This commit is contained in:
parent
8da0491ae5
commit
d47cb1bd55
3 changed files with 11 additions and 11 deletions
|
|
@ -32,8 +32,8 @@ service FrontendService {
|
|||
// Save colour picker's custom colour palette
|
||||
rpc SaveCustomColours(generic.Empty) returns (generic.Empty);
|
||||
|
||||
// Plays the listed audio tags
|
||||
rpc PlayAudio(PlayAudioRequest) returns (generic.Empty);
|
||||
// Plays the listed AV tags
|
||||
rpc PlayAVTags(PlayAVTagsRequest) returns (generic.Empty);
|
||||
}
|
||||
|
||||
service BackendFrontendService {}
|
||||
|
|
@ -48,6 +48,6 @@ message SetSchedulingStatesRequest {
|
|||
scheduler.SchedulingStates states = 2;
|
||||
}
|
||||
|
||||
message PlayAudioRequest {
|
||||
message PlayAVTagsRequest {
|
||||
repeated card_rendering.AVTag tags = 1;
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ from anki import hooks
|
|||
from anki.cards import Card
|
||||
from anki.collection import OpChanges, OpChangesOnly, Progress, SearchNode
|
||||
from anki.decks import UpdateDeckConfigs
|
||||
from anki.frontend_pb2 import PlayAudioRequest
|
||||
from anki.frontend_pb2 import PlayAVTagsRequest
|
||||
from anki.scheduler.v3 import SchedulingStatesWithContext, SetSchedulingStatesRequest
|
||||
from anki.scheduler_pb2 import NextCardDataResponse
|
||||
from anki.template import (
|
||||
|
|
@ -693,8 +693,8 @@ def next_card_data() -> bytes:
|
|||
return data.SerializeToString()
|
||||
|
||||
|
||||
def play_audio():
|
||||
req = PlayAudioRequest.FromString(request.data)
|
||||
def play_avtags():
|
||||
req = PlayAVTagsRequest.FromString(request.data)
|
||||
play_tags(av_tags_to_native(req.tags))
|
||||
|
||||
|
||||
|
|
@ -715,7 +715,7 @@ post_handler_list = [
|
|||
deck_options_ready,
|
||||
save_custom_colours,
|
||||
next_card_data,
|
||||
play_audio,
|
||||
play_avtags,
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright: Ankitects Pty Ltd and contributors
|
||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
import { CardAnswer, type NextCardDataResponse_NextCardData } from "@generated/anki/scheduler_pb";
|
||||
import { nextCardData, playAudio } from "@generated/backend";
|
||||
import { nextCardData, playAvtags } from "@generated/backend";
|
||||
import { derived, get, writable } from "svelte/store";
|
||||
import type { InnerReviewerRequest } from "../reviewer-inner/innerReviewerRequest";
|
||||
import type { ReviewerRequest } from "./reviewerRequest";
|
||||
|
|
@ -46,7 +46,7 @@ export class ReviewerState {
|
|||
switch (e.data.type) {
|
||||
case "audio": {
|
||||
const tags = get(this.answerShown) ? this._cardData!.answerAvTags : this._cardData!.questionAvTags;
|
||||
playAudio({ tags: [tags[e.data.index]] });
|
||||
playAvtags({ tags: [tags[e.data.index]] });
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -110,7 +110,7 @@ export class ReviewerState {
|
|||
|
||||
const question = resp.nextCard?.front || "";
|
||||
this.updateHtml(question, resp?.nextCard?.css, resp?.nextCard?.bodyClass);
|
||||
playAudio({ tags: this._cardData!.questionAvTags });
|
||||
playAvtags({ tags: this._cardData!.questionAvTags });
|
||||
|
||||
this.beginAnsweringMs = Date.now();
|
||||
}
|
||||
|
|
@ -121,7 +121,7 @@ export class ReviewerState {
|
|||
|
||||
public showAnswer() {
|
||||
this.answerShown.set(true);
|
||||
playAudio({ tags: this._cardData!.answerAvTags });
|
||||
playAvtags({ tags: this._cardData!.answerAvTags });
|
||||
this.updateHtml(this._cardData?.back || "");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue