diff --git a/unwind-ui/src/App.vue b/unwind-ui/src/App.vue index d797fdc..72e583e 100644 --- a/unwind-ui/src/App.vue +++ b/unwind-ui/src/App.vue @@ -170,6 +170,14 @@ type User = { groups: Array<{ id: ULID }> } +function parse_query(query) { + const match = /^(.*?)(?:\s+([<=>])?(\d+|\(\d+\)))?$/.exec(query) + const title = match[1].replaceAll('"', "") + const comp = match[2] || "" + const year = match[3] ? /\d+/.exec(match[3])[0] : "" + return { title, year: year ? `${comp}${year}` : null } +} + export default defineComponent({ data: () => ({ query: "", @@ -213,10 +221,12 @@ export default defineComponent({ const media_type = this.media_type === "" ? null : this.media_type const user_id = (this.filter_group === "" && this.credentials.user_id) || null const group_id = user_id === null && this.filter_group ? this.filter_group : null + const { title, year } = parse_query(this.query) const more = await debounced_get( "movies", { - title: this.query, + title, + year, per_page, include_unrated: true, page: this.page,