diff --git a/assets/config/labels.yml b/assets/config/labels.yml index c71807158..0169e7bd5 100644 --- a/assets/config/labels.yml +++ b/assets/config/labels.yml @@ -59,7 +59,6 @@ seashore: threshold: 0.3 categories: - beach - - coast - water lakeside: @@ -104,9 +103,7 @@ fashion: label: portrait threshold: 0.1 categories: - - fashion - - person - - face + - people poncho: see: fashion @@ -274,10 +271,8 @@ stingray: threshold: 0.2 categories: - water - - sea - fish - animal - - ray cock: threshold: 0.2 @@ -731,7 +726,6 @@ wombat: jellyfish: categories: - water - - sea - animal - fish @@ -1480,20 +1474,17 @@ starfish: threshold: 0.5 categories: - water - - sea - animal - fish sea urchin: categories: - water - - sea - animal sea cucumber: categories: - water - - sea - animal rabbit: @@ -1789,7 +1780,6 @@ fish: threshold: 0.2 categories: - water - - sea - animal barracouta: @@ -1903,7 +1893,7 @@ barbershop: barn: cateories: - - building + - architecture bassoon: label: entertainment @@ -1926,7 +1916,6 @@ bathtub: beacon: categories: - - building - tower - architecture @@ -1945,7 +1934,6 @@ beer glass: bell cote: label: church categories: - - building - architecture bicycle-built-for-two: @@ -1956,13 +1944,12 @@ bicycle-built-for-two: birdhouse: categories: - - building - - house + - bird + - outdoor boathouse: categories: - - building - - house + - architecture - water bobsled: @@ -2030,9 +2017,7 @@ car wheel: castle: categories: - - building - - old - - architecture + - historic catamaran: categories: @@ -2169,7 +2154,6 @@ disk brake: dock: categories: - water - - sea dogsled: categories: @@ -2389,7 +2373,6 @@ library: lifeboat: categories: - water - - sea - boat lighter: @@ -2457,13 +2440,11 @@ microwave: minibus: label: bus categories: - - van - vehicle minivan: label: van categories: - - car - vehicle mixing bowl: @@ -2511,7 +2492,6 @@ moving van: label: van categories: - vehicle - - bus notebook: label: computer @@ -2548,7 +2528,6 @@ paddle: paddlewheel: categories: - water - - sea padlock: label: tool @@ -2565,7 +2544,7 @@ paintbrush: palace: label: historic architecture categories: - - building + - historic panpipe: label: goods @@ -2657,7 +2636,6 @@ police van: label: van categories: - vehicle - - bus pool table: categories: @@ -2699,8 +2677,6 @@ punching bag: recreational vehicle: label: camper categories: - - bus - - van - vehicle reflex camera: @@ -2806,7 +2782,6 @@ snorkel: categories: - swimming - water - - sea snowmobile: categories: @@ -2841,7 +2816,6 @@ spatula: speedboat: categories: - water - - sea - boat sports car: @@ -2885,7 +2859,6 @@ studio couch: submarine: categories: - water - - sea - boat suspension bridge: @@ -2939,7 +2912,6 @@ trimaran: categories: - boat - water - - sea triumphal arch: categories: @@ -2949,7 +2921,6 @@ triumphal arch: trolleybus: label: bus categories: - - van - vehicle trombone: @@ -3022,10 +2993,8 @@ wreck: yawl: categories: - - ship - boat - water - - sea - vehicle yurt: @@ -3347,7 +3316,6 @@ tile roof: label: building categories: - architecture - - house croquet ball: label: pumpkin @@ -3463,8 +3431,6 @@ band aid: portrait: label: portrait categories: - - person - - face - people oxygen mask: @@ -3480,8 +3446,6 @@ heritage: label: portrait categories: - people - - person - - face safety pin: priority: -1 @@ -3500,10 +3464,7 @@ vestment: bassinet: label: baby categories: - - person - - child - - portrait - - face + - people patio: label: building diff --git a/frontend/src/component/p-photo-search.vue b/frontend/src/component/p-photo-search.vue index 8d84c5c6c..e486a57e7 100644 --- a/frontend/src/component/p-photo-search.vue +++ b/frontend/src/component/p-photo-search.vue @@ -54,18 +54,18 @@ item-value="code" item-text="name" v-model="filter.country" - :items="options.countries"> + :items="countryOptions"> + item-value="year" + item-text="label" + v-model="filter.year" + :items="yearOptions"> @@ -87,7 +87,51 @@ :items="options.sorting"> - + + + + + + + + + + + + + + + + + @@ -152,42 +196,69 @@ filterChange: Function, }, data() { - const cameras = [{ID: 0, CameraModel: this.$gettext('All Cameras')}].concat(this.$config.getValue('cameras')); - const countries = [{ - code: '', - name: this.$gettext('All Countries') - }].concat(this.$config.getValue('countries')); - return { + config: this.$config.values, searchExpanded: false, + all: { + countries: [{ code: "", name: this.$gettext("All Countries")}], + cameras: [{ID: 0, CameraModel: this.$gettext("All Cameras")}], + lenses: [{ID: 0, LensModel: "All Lenses"}], + colors: [{label: "All Colors", name: ""}], + categories: [{LabelName: "", Title: this.$gettext("All Categories")}], + }, options: { 'views': [ - // {value: 'tiles', text: this.$gettext('Tiles')}, {value: 'mosaic', text: this.$gettext('Mosaic')}, {value: 'details', text: this.$gettext('Details')}, {value: 'list', text: this.$gettext('List')}, ], - 'countries': countries, - 'cameras': cameras, 'sorting': [ {value: 'imported', text: this.$gettext('Recently imported')}, {value: 'newest', text: this.$gettext('Newest first')}, {value: 'oldest', text: this.$gettext('Oldest first')}, ], }, - showAfterPicker: false, - showBeforePicker: false, + // showAfterPicker: false, + // showBeforePicker: false, labels: { search: this.$gettext("Search"), view: this.$gettext("View"), country: this.$gettext("Country"), camera: this.$gettext("Camera"), + lens: this.$gettext("Lens"), + year: this.$gettext("Year"), + color: this.$gettext("Color"), + category: this.$gettext("Category"), sort: this.$gettext("Sort By"), before: this.$gettext("Taken before"), after: this.$gettext("Taken after"), }, }; }, + computed: { + countryOptions() { + return this.all.countries.concat(this.config.countries); + }, + cameraOptions() { + return this.all.cameras.concat(this.config.cameras); + }, + lensOptions() { + return this.all.lenses.concat(this.config.lenses); + }, + colorOptions() { + return this.all.colors.concat(this.config.colors); + }, + categoryOptions() { + return this.all.categories.concat(this.config.categories); + }, + yearOptions() { + let result = [{"year": 0, "label": "All Years"}]; + for (let i = 0; i < this.config.years.length; i++) { + result.push({"year": this.config.years[i], "label": this.config.years[i].toString()}); + } + return result; + }, + }, methods: { dropdownChange() { this.filterChange(); @@ -196,16 +267,12 @@ this.searchExpanded = false; } }, - datepickerChange() { + /*datepickerChange() { this.showAfterPicker = false; this.showBeforePicker = false; this.dropdownChange(); }, - setView(name) { - this.settings.view = name; - this.filterChange(); - }, clearBefore() { this.filter.before = ''; this.datepickerChange(); @@ -213,11 +280,16 @@ clearAfter() { this.filter.after = ''; this.datepickerChange(); + }, + */ + setView(name) { + this.settings.view = name; + this.filterChange(); }, clearQuery() { this.filter.q = ''; this.filterChange(); }, - } + }, }; diff --git a/frontend/src/pages/photos.vue b/frontend/src/pages/photos.vue index 1fdde6b64..aa42cea58 100644 --- a/frontend/src/pages/photos.vue +++ b/frontend/src/pages/photos.vue @@ -50,8 +50,14 @@ this.filter.q = query['q'] ? query['q'] : ''; this.filter.camera = query['camera'] ? parseInt(query['camera']) : 0; this.filter.country = query['country'] ? query['country'] : ''; - this.filter.before = query['before'] ? query['before'] : ''; - this.filter.after = query['after'] ? query['after'] : ''; + this.filter.lens = query['lens'] ? parseInt(query['lens']) : 0; + this.filter.year = query['year'] ? parseInt(query['year']) : 0; + this.filter.color = query['color'] ? query['color'] : ''; + this.filter.label = query['label'] ? query['label'] : ''; + + // this.filter.before = query['before'] ? query['before'] : ''; + // this.filter.after = query['after'] ? query['after'] : ''; + this.settings.view = this.viewType(); this.lastFilter = {}; this.routeName = this.$route.name; @@ -64,11 +70,28 @@ const order = query['order'] ? query['order'] : 'imported'; const camera = query['camera'] ? parseInt(query['camera']) : 0; const q = query['q'] ? query['q'] : ''; - const before = query['before'] ? query['before'] : ''; - const after = query['after'] ? query['after'] : ''; + + // const before = query['before'] ? query['before'] : ''; + // const after = query['after'] ? query['after'] : ''; + const country = query['country'] ? query['country'] : ''; + const lens = query['lens'] ? parseInt(query['lens']) : 0; + const year = query['year'] ? parseInt(query['year']) : 0; + const color = query['color'] ? query['color'] : ''; + const label = query['label'] ? query['label'] : ''; const view = this.viewType(); - const filter = {country: country, camera: camera, order: order, q: q, before: before, after: after}; + const filter = { + country: country, + camera: camera, + lens: lens, + label: label, + year: year, + color: color, + order: order, + q: q, + /* before: before, + after: after, */ + }; const settings = {view: view}; return { diff --git a/internal/colors/colors.go b/internal/colors/colors.go index 8c301ea6a..a7942274a 100644 --- a/internal/colors/colors.go +++ b/internal/colors/colors.go @@ -61,17 +61,17 @@ var All = Colors{ Cyan, Blue, Purple, - Brown, White, Grey, Black, + Brown, } var Names = map[Color]string{ Black: "dark", // 0 Brown: "brown", // 1 Grey: "grey", // 2 - White: "bright", // 3 + White: "white", // 3 Purple: "purple", // 4 Gold: "gold", // 5 Blue: "blue", // 6 diff --git a/internal/config/config.go b/internal/config/config.go index 2da083ea2..636a2520d 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -652,7 +652,7 @@ func (c *Config) ClientConfig() ClientConfig { Limit(20).Order("album_name"). Find(&albums) - var years []string + var years []int db.Table("photos"). Order("photo_year DESC"). diff --git a/internal/form/photo_search.go b/internal/form/photo_search.go index 7803a8db4..647e3a694 100644 --- a/internal/form/photo_search.go +++ b/internal/form/photo_search.go @@ -35,8 +35,11 @@ type PhotoSearch struct { Album string `form:"album"` Label string `form:"label"` Country string `form:"country"` + Year uint `form:"year"` + Month uint `form:"month"` Color string `form:"color"` Camera int `form:"camera"` + Lens int `form:"lens"` Before time.Time `form:"before" time_format:"2006-01-02"` After time.Time `form:"after" time_format:"2006-01-02"` Favorites bool `form:"favorites"` diff --git a/internal/photoprism/tensorflow_test.go b/internal/photoprism/tensorflow_test.go index b59f8b468..66ed5b61f 100644 --- a/internal/photoprism/tensorflow_test.go +++ b/internal/photoprism/tensorflow_test.go @@ -233,9 +233,9 @@ func TestTensorFlow_BestLabels(t *testing.T) { result := tensorFlow.bestLabels(p) assert.Equal(t, "chicken", result[0].Name) assert.Equal(t, "bird", result[0].Categories[0]) + assert.Equal(t, "animal", result[1].Categories[1]) assert.Equal(t, "image", result[0].Source) assert.Equal(t, "fish", result[1].Name) - assert.Equal(t, "animal", result[1].Categories[2]) assert.Equal(t, "image", result[1].Source) t.Log(result) }) diff --git a/internal/repo/photo.go b/internal/repo/photo.go index 6e8d596f5..99f9dda52 100644 --- a/internal/repo/photo.go +++ b/internal/repo/photo.go @@ -193,6 +193,18 @@ func (s *Repo) Photos(f form.PhotoSearch) (results []PhotoResult, err error) { q = q.Where("photos.camera_id = ?", f.Camera) } + if f.Lens > 0 { + q = q.Where("photos.lens_id = ?", f.Lens) + } + + if f.Year > 0 { + q = q.Where("photos.photo_year = ?", f.Year) + } + + if f.Month > 0 { + q = q.Where("photos.photo_month = ?", f.Month) + } + if f.Color != "" { q = q.Where("files.file_main_color = ?", strings.ToLower(f.Color)) }