mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-04-19 12:24:59 -04:00
Added Sync button to individual Series and Movie pages
This commit is contained in:
parent
81909caf51
commit
525d569d09
6 changed files with 43 additions and 4 deletions
|
@ -3,6 +3,7 @@
|
|||
from flask_restx import Resource, Namespace, reqparse, fields, marshal
|
||||
|
||||
from app.database import TableMovies, database, update, select, func
|
||||
from radarr.sync.movies import update_one_movie
|
||||
from subtitles.indexer.movies import list_missing_subtitles_movies, movies_scan_subtitles
|
||||
from app.event_handler import event_stream
|
||||
from subtitles.wanted import wanted_search_missing_subtitles_movies
|
||||
|
@ -158,7 +159,7 @@ class Movies(Resource):
|
|||
patch_request_parser = reqparse.RequestParser()
|
||||
patch_request_parser.add_argument('radarrid', type=int, required=False, help='Radarr movie ID')
|
||||
patch_request_parser.add_argument('action', type=str, required=False, help='Action to perform from ["scan-disk", '
|
||||
'"search-missing", "search-wanted"]')
|
||||
'"search-missing", "search-wanted", "sync"]')
|
||||
|
||||
@authenticate
|
||||
@api_ns_movies.doc(parser=patch_request_parser)
|
||||
|
@ -184,5 +185,8 @@ class Movies(Resource):
|
|||
elif action == "search-wanted":
|
||||
wanted_search_missing_subtitles_movies()
|
||||
return '', 204
|
||||
elif action == "sync":
|
||||
update_one_movie(radarrid, 'updated', True)
|
||||
return '', 204
|
||||
|
||||
return 'Unknown action', 400
|
||||
|
|
|
@ -6,6 +6,7 @@ from flask_restx import Resource, Namespace, reqparse, fields, marshal
|
|||
from functools import reduce
|
||||
|
||||
from app.database import get_exclusion_clause, TableEpisodes, TableShows, database, select, update, func
|
||||
from sonarr.sync.series import update_one_series
|
||||
from subtitles.indexer.series import list_missing_subtitles, series_scan_subtitles
|
||||
from subtitles.mass_download import series_download_subtitles
|
||||
from subtitles.wanted import wanted_search_missing_subtitles_series
|
||||
|
@ -198,7 +199,7 @@ class Series(Resource):
|
|||
patch_request_parser = reqparse.RequestParser()
|
||||
patch_request_parser.add_argument('seriesid', type=int, required=False, help='Sonarr series ID')
|
||||
patch_request_parser.add_argument('action', type=str, required=False, help='Action to perform from ["scan-disk", '
|
||||
'"search-missing", "search-wanted"]')
|
||||
'"search-missing", "search-wanted", "sync"]')
|
||||
|
||||
@authenticate
|
||||
@api_ns_series.doc(parser=patch_request_parser)
|
||||
|
@ -224,5 +225,8 @@ class Series(Resource):
|
|||
elif action == "search-wanted":
|
||||
wanted_search_missing_subtitles_series()
|
||||
return '', 204
|
||||
elif action == "sync":
|
||||
update_one_series(seriesid, 'updated')
|
||||
return '', 204
|
||||
|
||||
return 'Unknown action', 400
|
||||
|
|
|
@ -4,4 +4,5 @@ export enum TaskGroup {
|
|||
DeleteSubtitle = "Deleting subtitles...",
|
||||
SearchSubtitle = "Searching subtitles...",
|
||||
ScanDisk = "Scanning disk...",
|
||||
Sync = "Syncing...",
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import {
|
|||
faCircleChevronDown,
|
||||
faCircleChevronRight,
|
||||
faCloudUploadAlt,
|
||||
faHardDrive,
|
||||
faHdd,
|
||||
faPlay,
|
||||
faSearch,
|
||||
|
@ -140,6 +141,20 @@ const SeriesEpisodesView: FunctionComponent = () => {
|
|||
<Toolbox.Button
|
||||
icon={faSync}
|
||||
disabled={!available || hasTask}
|
||||
onClick={() => {
|
||||
if (series) {
|
||||
task.create(series.title, TaskGroup.Sync, action, {
|
||||
action: "sync",
|
||||
seriesid: id,
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
Sync
|
||||
</Toolbox.Button>
|
||||
<Toolbox.Button
|
||||
icon={faHardDrive}
|
||||
disabled={!available || hasTask}
|
||||
onClick={() => {
|
||||
if (series) {
|
||||
task.create(series.title, TaskGroup.ScanDisk, action, {
|
||||
|
|
|
@ -7,6 +7,7 @@ import { showNotification } from "@mantine/notifications";
|
|||
import {
|
||||
faCloudUploadAlt,
|
||||
faEllipsis,
|
||||
faHardDrive,
|
||||
faHistory,
|
||||
faSearch,
|
||||
faSync,
|
||||
|
@ -127,6 +128,20 @@ const MovieDetailView: FunctionComponent = () => {
|
|||
<Toolbox.Button
|
||||
icon={faSync}
|
||||
disabled={hasTask}
|
||||
onClick={() => {
|
||||
if (movie) {
|
||||
task.create(movie.title, TaskGroup.Sync, action, {
|
||||
action: "sync",
|
||||
radarrid: id,
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
Sync
|
||||
</Toolbox.Button>
|
||||
<Toolbox.Button
|
||||
icon={faHardDrive}
|
||||
disabled={hasTask}
|
||||
onClick={() => {
|
||||
if (movie) {
|
||||
task.create(movie.title, TaskGroup.ScanDisk, action, {
|
||||
|
|
4
frontend/src/types/form.d.ts
vendored
4
frontend/src/types/form.d.ts
vendored
|
@ -9,12 +9,12 @@ declare namespace FormType {
|
|||
type MoviesAction = OneMovieAction | SearchWantedAction;
|
||||
|
||||
interface OneMovieAction {
|
||||
action: "search-missing" | "scan-disk";
|
||||
action: "search-missing" | "scan-disk" | "sync";
|
||||
radarrid: number;
|
||||
}
|
||||
|
||||
interface OneSeriesAction {
|
||||
action: "search-missing" | "scan-disk";
|
||||
action: "search-missing" | "scan-disk" | "sync";
|
||||
seriesid: number;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue