Add option to filename parser to skip organized scenes (#1665)

Fixes #1219
This commit is contained in:
gitgiggety
2021-08-24 04:14:37 +02:00
committed by GitHub
parent 392fa3535c
commit 28b092885c
6 changed files with 35 additions and 2 deletions

View File

@@ -125,7 +125,8 @@ type FindScenesResultType {
input SceneParserInput { input SceneParserInput {
ignoreWords: [String!], ignoreWords: [String!],
whitespaceCharacters: String, whitespaceCharacters: String,
capitalizeTitle: Boolean capitalizeTitle: Boolean,
ignoreOrganized: Boolean
} }
type SceneMovieID { type SceneMovieID {

View File

@@ -484,6 +484,11 @@ func (p *SceneFilenameParser) Parse(repo models.ReaderRepository) ([]*models.Sce
}, },
} }
if p.ParserInput.IgnoreOrganized != nil && *p.ParserInput.IgnoreOrganized {
organized := false
sceneFilter.Organized = &organized
}
p.Filter.Q = nil p.Filter.Q = nil
scenes, total, err := repo.Scene().Query(sceneFilter, p.Filter) scenes, total, err := repo.Scene().Query(sceneFilter, p.Filter)

View File

@@ -63,6 +63,7 @@ export interface IParserInput {
page: number; page: number;
pageSize: number; pageSize: number;
findClicked: boolean; findClicked: boolean;
ignoreOrganized: boolean;
} }
interface IParserRecipe { interface IParserRecipe {
@@ -95,6 +96,9 @@ export const ParserInput: React.FC<IParserInputProps> = (
const [capitalizeTitle, setCapitalizeTitle] = useState<boolean>( const [capitalizeTitle, setCapitalizeTitle] = useState<boolean>(
props.input.capitalizeTitle props.input.capitalizeTitle
); );
const [ignoreOrganized, setIgnoreOrganized] = useState<boolean>(
props.input.ignoreOrganized
);
function onFind() { function onFind() {
props.onFind({ props.onFind({
@@ -105,6 +109,7 @@ export const ParserInput: React.FC<IParserInputProps> = (
page: 1, page: 1,
pageSize: props.input.pageSize, pageSize: props.input.pageSize,
findClicked: props.input.findClicked, findClicked: props.input.findClicked,
ignoreOrganized,
}); });
} }
@@ -226,6 +231,20 @@ export const ParserInput: React.FC<IParserInputProps> = (
})} })}
</Form.Label> </Form.Label>
</Form.Group> </Form.Group>
<Form.Group>
<Form.Check
inline
className="m-0"
id="ignore-organized"
checked={ignoreOrganized}
onChange={() => setIgnoreOrganized(!ignoreOrganized)}
/>
<Form.Label htmlFor="ignore-organized">
{intl.formatMessage({
id: "config.tools.scene_filename_parser.ignore_organized",
})}
</Form.Label>
</Form.Group>
{/* TODO - mapping stuff will go here */} {/* TODO - mapping stuff will go here */}

View File

@@ -24,6 +24,7 @@ const initialParserInput = {
page: 1, page: 1,
pageSize: 20, pageSize: 20,
findClicked: false, findClicked: false,
ignoreOrganized: true,
}; };
const initialShowFieldsState = new Map<string, boolean>([ const initialShowFieldsState = new Map<string, boolean>([
@@ -127,6 +128,7 @@ export const SceneFilenameParser: React.FC = () => {
ignoreWords: parserInput.ignoreWords, ignoreWords: parserInput.ignoreWords,
whitespaceCharacters: parserInput.whitespaceCharacters, whitespaceCharacters: parserInput.whitespaceCharacters,
capitalizeTitle: parserInput.capitalizeTitle, capitalizeTitle: parserInput.capitalizeTitle,
ignoreOrganized: parserInput.ignoreOrganized,
}; };
queryParseSceneFilenames(parserFilter, parserInputData) queryParseSceneFilenames(parserFilter, parserInputData)

View File

@@ -295,6 +295,7 @@
"escape_chars": "Use \\ to escape literal characters", "escape_chars": "Use \\ to escape literal characters",
"filename": "Filename", "filename": "Filename",
"filename_pattern": "Filename Pattern", "filename_pattern": "Filename Pattern",
"ignore_organized": "Ignore organised scenes",
"ignored_words": "Ignored words", "ignored_words": "Ignored words",
"matches_with": "Matches with {i}", "matches_with": "Matches with {i}",
"select_parser_recipe": "Select Parser Recipe", "select_parser_recipe": "Select Parser Recipe",

View File

@@ -2,5 +2,10 @@
"eye_color": "Eye Color", "eye_color": "Eye Color",
"favourite": "Favorite", "favourite": "Favorite",
"hair_color": "Hair Color", "hair_color": "Hair Color",
"organized": "Organized" "organized": "Organized",
"tools": {
"scene_filename_parser": {
"ignore_organized": "Ignore organized scenes"
}
}
} }