Commit Graph

215 Commits

Author SHA1 Message Date
Googol Lee
f1b523a27e Include a group of small but real media files for testing. (#1131)
* Move scanner/test_data/* to a stand-alone directory.

* Include real medias.

* Rename testdata to test_data

* Rename test_data/scanner -> test_data/library

* Clean tests to avoid depneding env.

* Rename: scanner/test_data -> scanner/test_media

* Rename: test_data/bin -> test_data/mock_bin

* Fix paths in tests.
2024-11-23 09:02:11 +01:00
Googol Lee
a9d7b774bd Add log package for better logging level. (#1130)
* Add log package. Update worker with new log package.

* Add init error to worker.

* Init workers when binary launching.

* Add tests to cover different errors.
2024-11-21 10:44:38 +01:00
Googol Lee
772129dbeb Remove continue-on-error: true because it hides errors. (#1129)
* Add test for the workflow.

* Remove continue-on-error.

* Remove always failing test.

* Fix the hidden failure.

* Regenerated.
2024-11-19 19:03:19 +01:00
Kostiantyn
a0a2380f90 Remove deprecated convert and add required -auto-orient flags (#1118)
Co-authored-by: Konstantin Koval
2024-11-09 18:49:53 +02:00
Googol Lee
c151bdee96 Process jpgs if raw processing is disabled. (#1096) 2024-10-20 16:52:47 +02:00
bzzim
2f13094d08 Fix wrap nil error (#1042)
* Fix wrap nil error

In this case ReadVideoStreamMetadata return nil, nil because: 

func Wrap(err error, message string) error {
	if err == nil {
		return nil
	}
	.....
}

* Update process_video_task.go
2024-10-14 14:16:58 +02:00
Googol Lee
4303b71311 Use hardware acceleration when converting videos. (#1056) 2024-10-11 22:27:56 +02:00
Kostiantyn
83e441650b Split long functions and optimize code (#1082)
Co-authored-by: Konstantin Koval
2024-10-08 21:58:17 +03:00
Kostiantyn
d1193c5ca4 Refactoring part 1: Fix some annoying linter warnings in API code (#1064)
* names, constants of reusable strings, removed unneeded `if`, replaced deprecated imports

* more deprecated imports replaced

* What is this?))

* Fix a path and quote a var in Dockerfile

* Addressing review comments

---------

Co-authored-by: Konstantin Koval <kkb@ukr.net>
2024-09-30 14:45:02 +02:00
Googol Lee
340c181442 Use self-building dependencies and update the code with imagemagick. (#1053) 2024-09-17 15:02:23 +02:00
Googol Lee
a6cbfc76f3 Back to bookworm. (#1040) 2024-09-06 13:32:22 +02:00
Googol Lee
6e1e1d12ce Update to magick 7 in alpine. (#1035) 2024-09-02 22:12:00 +02:00
Googol Lee
ad13172a32 Switch to Debian testing and imagemagick. (#1021) 2024-08-29 10:30:06 +02:00
Jorilx
bef9e7c666 Add support for GIF images (#1024) 2024-08-20 22:41:30 +02:00
Lajos Koszti
10e9e354b5 order root albums by path on settings page (#983)
Once you have more than a few paths assigned to a user, it becomes
quite hard to oversee the list.

Personally, I would add my albums to Photoview one by one, so I can
manage the processing better. For example, I can review and fix the face
recognition for one new album at a time, and I don't need to deal with
too much data.
Since I started to add the albums in a random order, it's relatively
hard to find which album is added and which is not.

An easy fix is to order the photo paths by their name.

- Extended the query of the rootAlbums to order them by path
2024-07-01 20:04:50 +02:00
Kostiantyn
df9af39a16 Validate incoming GPS data (#951)
* Validate incoming GPS data and throw an error if it is incorrect, storing Null values

* Extracted GPS data processing to function in external parser; optimized IF in internal parser; removed unnecessary comments; set exact values for positive test

* Add the migration for removing existing invalid GPS data and its test; added better errors to asserts in the GPS validation test

* Install FFmpeg and ExifTool on the API unit-test environment

* Fix 'stripped.jpg', 'IncorrectGPS.jpg', and 'CorrectGPS.jpg' tests for the external parser

* Optimized data validation in the external parser, returned error by the internal parser for invalid data, updated test to expect errors and handle them

* Switched from error to log entry in case of incorrect GPS data, as error handling is not so transparent in the internal parser

---------

Co-authored-by: Konstantin Koval
2024-06-29 10:32:48 +03:00
Simon Ser
d0d0bf21bc Make face detection optional at build-time (#881)
Add a "no_face_detection" build tag to disable face detection
when building. This is useful when installing the face detection
dependencies is undesirable and cuts down build times (e.g. on a
Raspberry Pi).
2024-04-11 22:20:09 +01:00
Konstantin
b2d591bd1b Don't stop scanning album on media fail (#892)
* Don't stop scanning album on media fail

* Update api/scanner/scanner_album.go

accepting suggestion from Jordan

Co-authored-by: Jordan Hellier <13520761+jordy2254@users.noreply.github.com>

---------

Co-authored-by: Konstantin Koval <kkb@ukr.net>
Co-authored-by: Jordan Hellier <13520761+jordy2254@users.noreply.github.com>
2024-03-30 11:04:03 +02:00
Alex Kabakaev
153f37e5fb move mp4 moov atom to the beginning (#883)
Video playback starts faster in browsers.
2024-03-30 09:01:16 +00:00
Yo Sev
9c85663522 Fix invalid UTC offset during datetime parsing (#823) 2024-03-30 07:57:21 +01:00
Andreas
68cc2a0eee reordered cli arguments for ffmpeg to improve speed to generate thumbnails from videos (#917) 2024-03-29 19:35:50 +00:00
john dev
a28e9ba8b7 Prepend missing key CreationDate to createDateKeys 2023-03-21 14:26:03 +01:00
Jakub Tymejczyk
030c9262c6 Fix encoding video thumbnails 2023-03-03 08:51:44 +01:00
Jakub Tymejczyk
a2170bc02b Fixes issue 804 2023-02-28 15:33:02 +01:00
john dev
15e3cc3b8c Add support to parse DateTImes with UTC offset 2023-02-15 08:29:41 +01:00
WindLi001
0ac38e6605 Limit thumbnail size of small original photo 2023-02-10 12:53:25 +08:00
Lajos Koszti
1f8664d7f8 fix transaction already commited error
I encountered with the following error:

> 2023/02/05 07:33:00 /app/scanner/face_detection/face_detector.go:92 sql: transaction has already been committed or rolled back
> [0.042ms] [rows:0] SELECT * FROM `media` WHERE `media`.`id` = 823 ORDER BY `media`.`id` LIMIT 1
> 2023/02/05 07:33:00 ERROR: Error detecting faces in image (/photos/Borzsony2017/DSC_0028.NEF): sql: transaction has already been committed or rolled back

It turned out it comes from the api/routes/photos.go

I found a very similar code in album_scanner.go.
The difference I saw was that while in the single photo request the
transaction passed to the `scanner_tasks.Tasks.BeforeProcessMedia` call,
in the album_scann.go the transaction created after this call and
created from the context which returned by `BeforeProcessMedia`.

Another difference was that in the `ProcessSingleMedia` call the
`AfterProcessMedia` call was called with the same - db transaction -
context, in the album_scanner it was called outside of the transaction.

I changed the logic by merging the two behavior:
Create the transaction from the context of `BeforeProcessMedia` and also
use the transaction context in the `AfterProcessMedia`.
After the change the error disappeared.

So to have it in a common place I extracted that logic into a function
and use for both the single photo request and in the album scanner.

I did not go more deeper to find out what's going on with the context
under the hood.
2023-02-05 09:05:05 +01:00
PJ-Watson
5c1bbf9065 Fixed ScanAlbum failing silently.
2.3.12 -> 2.3.13 restructured ScanAlbum so that errors were returned rather than raising a ScannerError directly - this ensures that the errors are logged correctly.
2022-08-12 02:18:59 +01:00
PJ-Watson
7715865309 Add support for .CR3 photos. 2022-08-10 07:43:39 +01:00
PJ-Watson
3e780dbe48 Changed downsampling method to custom type. 2022-08-09 06:09:55 +01:00
PJ-Watson
5c4eeef870 Introduce thumbnail filtering options. 2022-08-05 19:37:55 +01:00
viktorstrate
831e24f654 Fix API tests 2022-07-08 17:44:03 +02:00
viktorstrate
a5d152f0c0 Make scanner tasks share ctx 2022-07-07 22:00:05 +02:00
viktorstrate
f512db6c32 Merge branch 'master' into rework-scanner-internals 2022-07-07 19:58:30 +02:00
viktorstrate
447f05185f Fix scanner queue tests 2022-03-28 18:43:00 +02:00
James Cross
501c50e259 Adding image description to sidebar 2022-03-28 16:08:30 +01:00
viktorstrate
b09d32019e Make it compile again 2022-03-02 17:26:06 +01:00
viktorstrate
6e2a64bc77 WIP: split up scanner into separate tasks 2022-02-15 17:22:41 +01:00
viktorstrate
6361df1793 Start on big scanner code refactoring 2022-02-14 23:57:45 +01:00
viktorstrate
ee5c113c32 Add EXIF modify dates as a fallback for create dates 2022-02-07 17:57:10 +01:00
viktorstrate
f2f75c03b3 Add more keys for potential create dates to exiftool 2022-02-07 17:44:45 +01:00
viktorstrate
0d9760b33f Integrate blurhashes with UI 2022-02-01 23:39:19 +01:00
viktorstrate
b4ad1c4f88 Add blurhash generation 2022-02-01 22:02:08 +01:00
viktorstrate
e509124510 Disable 'media already scanned' logs 2021-11-21 11:41:52 +01:00
viktorstrate
12085698c8 Refactoring + disable cleanup tests for sqlite 2021-11-06 15:41:25 +01:00
viktorstrate
6545a04225 Add tests for modifying media on disk 2021-11-06 13:30:23 +01:00
viktorstrate
0618b70110 Enable foreign keys for sqlite 2021-11-06 13:23:59 +01:00
viktorstrate
c48ede175a Fix exif circular imports in tests 2021-11-06 13:01:01 +01:00
viktorstrate
3040daafb6 Fix tests 2021-11-06 12:38:05 +01:00
viktorstrate
b467f2ca61 Add failing test for #198 2021-11-06 12:23:47 +01:00