mirror of
https://github.com/immich-app/immich.git
synced 2026-07-08 05:17:54 -07:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 439ace9dba | |||
| 5c2fb2245a | |||
| 924e6251fd |
@@ -183,6 +183,7 @@ class AuthNotifier extends StateNotifier<AuthState> {
|
||||
|
||||
Future<void> saveLocalEndpoint(String url) async {
|
||||
await _ref.read(settingsProvider).write(.networkLocalEndpoint, url);
|
||||
await _apiService.updateHeaders();
|
||||
}
|
||||
|
||||
String? getSavedWifiName() {
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:immich_mobile/domain/models/settings_key.dart';
|
||||
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
||||
import 'package:immich_mobile/extensions/translate_extensions.dart';
|
||||
import 'package:immich_mobile/models/auth/auxilary_endpoint.model.dart';
|
||||
import 'package:immich_mobile/providers/api.provider.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/settings.provider.dart';
|
||||
import 'package:immich_mobile/widgets/settings/networking_settings/endpoint_input.dart';
|
||||
|
||||
@@ -26,13 +27,16 @@ class ExternalNetworkPreference extends HookConsumerWidget {
|
||||
.map((e) => e.url)
|
||||
.toList();
|
||||
|
||||
ref.read(settingsProvider).write(SettingsKey.networkExternalEndpointList, urls);
|
||||
return ref.read(settingsProvider).write(SettingsKey.networkExternalEndpointList, urls);
|
||||
}
|
||||
|
||||
updateValidationStatus(String url, int index, AuxCheckStatus status) {
|
||||
updateValidationStatus(String url, int index, AuxCheckStatus status) async {
|
||||
entries.value[index] = entries.value[index].copyWith(url: url, status: status);
|
||||
|
||||
saveEndpointList();
|
||||
await saveEndpointList();
|
||||
if (status == AuxCheckStatus.valid) {
|
||||
await ref.read(apiServiceProvider).updateHeaders();
|
||||
}
|
||||
}
|
||||
|
||||
handleReorder(int oldIndex, int newIndex) {
|
||||
|
||||
@@ -183,6 +183,98 @@
|
||||
},
|
||||
"uiHints": ["Filter"]
|
||||
},
|
||||
{
|
||||
"name": "assetDateFilter",
|
||||
"title": "Filter by date",
|
||||
"description": "Filter assets by date taken",
|
||||
"types": ["AssetV1"],
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"startDate": {
|
||||
"type": "object",
|
||||
"title": "Start date",
|
||||
"description": "Earliest date of assets to include",
|
||||
"properties": {
|
||||
"day": {
|
||||
"type": "number",
|
||||
"title": "Day",
|
||||
"description": "Day of the year to match",
|
||||
"uiHint": {
|
||||
"order": 1
|
||||
}
|
||||
},
|
||||
"month": {
|
||||
"type": "number",
|
||||
"title": "Month",
|
||||
"description": "Month of the year to match",
|
||||
"uiHint": {
|
||||
"order": 2
|
||||
}
|
||||
},
|
||||
"year": {
|
||||
"type": "number",
|
||||
"title": "Year",
|
||||
"description": "Year to match",
|
||||
"uiHint": {
|
||||
"order": 3
|
||||
}
|
||||
}
|
||||
},
|
||||
"uiHint": {
|
||||
"order": 1
|
||||
},
|
||||
"required": ["day", "month", "year"]
|
||||
},
|
||||
"endDate": {
|
||||
"type": "object",
|
||||
"title": "End date",
|
||||
"description": "Latest date of assets to include",
|
||||
"properties": {
|
||||
"day": {
|
||||
"type": "number",
|
||||
"title": "Day",
|
||||
"description": "Day of the year to match",
|
||||
"uiHint": {
|
||||
"order": 1
|
||||
}
|
||||
},
|
||||
"month": {
|
||||
"type": "number",
|
||||
"title": "Month",
|
||||
"description": "Month of the year to match",
|
||||
"uiHint": {
|
||||
"order": 2
|
||||
}
|
||||
},
|
||||
"year": {
|
||||
"type": "number",
|
||||
"title": "Year",
|
||||
"description": "Year to match",
|
||||
"uiHint": {
|
||||
"order": 3
|
||||
}
|
||||
}
|
||||
},
|
||||
"uiHint": {
|
||||
"order": 2
|
||||
},
|
||||
"required": ["day", "month", "year"]
|
||||
},
|
||||
"recurring": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"title": "Match recurring dates",
|
||||
"description": "Allow any assets with matching months/days regardless of the year",
|
||||
"uiHint": {
|
||||
"order": 3
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["recurring", "startDate", "endDate"]
|
||||
},
|
||||
"uiHints": ["Filter"]
|
||||
},
|
||||
{
|
||||
"name": "assetTypeFilter",
|
||||
"title": "Filter by asset type",
|
||||
|
||||
@@ -124,6 +124,27 @@ const methods = wrapper<Manifest>({
|
||||
return { workflow: { continue: earthDiameter * delta <= (config.coordinate?.radius ?? 0) } };
|
||||
},
|
||||
|
||||
assetDateFilter: ({ config, data }) => {
|
||||
const assetDate = new Date(data.asset.localDateTime);
|
||||
let startDate = new Date(config.startDate.year, config.startDate.month - 1, config.startDate.day);
|
||||
let endDate = new Date(config.endDate.year, config.endDate.month - 1, config.endDate.day);
|
||||
|
||||
if (config.recurring) {
|
||||
startDate.setFullYear(assetDate.getFullYear());
|
||||
endDate.setFullYear(assetDate.getFullYear());
|
||||
|
||||
if (endDate < startDate) {
|
||||
if (assetDate > endDate) {
|
||||
endDate.setFullYear(endDate.getFullYear() + 1);
|
||||
} else {
|
||||
startDate.setFullYear(startDate.getFullYear() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { workflow: { continue: assetDate >= startDate && assetDate <= endDate } };
|
||||
},
|
||||
|
||||
assetLock: ({ config, data }) => {
|
||||
if (!config.inverse && data.asset.visibility !== AssetVisibility.Locked) {
|
||||
return { changes: { asset: { visibility: AssetVisibility.Locked } } };
|
||||
@@ -179,6 +200,7 @@ const {
|
||||
assetFavorite,
|
||||
assetFileFilter,
|
||||
assetLocationFilter,
|
||||
assetDateFilter,
|
||||
assetLock,
|
||||
assetMissingTimeZoneFilter,
|
||||
assetTypeFilter,
|
||||
@@ -195,6 +217,7 @@ export {
|
||||
assetFavorite,
|
||||
assetFileFilter,
|
||||
assetLocationFilter,
|
||||
assetDateFilter,
|
||||
assetLock,
|
||||
assetMissingTimeZoneFilter,
|
||||
assetTypeFilter,
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ FROM builder AS plugins
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
COPY --from=ghcr.io/jdx/mise:2026.6.14@sha256:b8f8c20fc3308f8b1d00ccca2bc968e4e208af1c5c1069e1ad9753baa099acff /usr/local/bin/mise /usr/local/bin/mise
|
||||
COPY --from=ghcr.io/jdx/mise:2026.7.2@sha256:51d92371cc08e3c4f0e52f58bb3ec1975a6dc966b7430a4da37dcfc6ae772f30 /usr/local/bin/mise /usr/local/bin/mise
|
||||
|
||||
WORKDIR /app
|
||||
COPY ./mise.toml ./mise.toml
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
FROM ghcr.io/immich-app/base-server-dev:202607061334@sha256:c83ef9c6d7f5e7f6a276fe96647484d46b7bf6cacc1e35b823dd1d7a1aeda3b8 AS dev
|
||||
|
||||
|
||||
COPY --from=ghcr.io/jdx/mise:2026.6.14@sha256:b8f8c20fc3308f8b1d00ccca2bc968e4e208af1c5c1069e1ad9753baa099acff /usr/local/bin/mise /usr/local/bin/mise
|
||||
COPY --from=ghcr.io/jdx/mise:2026.7.2@sha256:51d92371cc08e3c4f0e52f58bb3ec1975a6dc966b7430a4da37dcfc6ae772f30 /usr/local/bin/mise /usr/local/bin/mise
|
||||
|
||||
RUN echo "devdir=/buildcache/node-gyp" >> /usr/local/etc/npmrc && \
|
||||
echo "store-dir=/buildcache/pnpm-store" >> /usr/local/etc/npmrc && \
|
||||
|
||||
@@ -3,9 +3,10 @@ import { ExifDateTime, exiftool, WriteTags } from 'exiftool-vendored';
|
||||
import ffmpeg, { FfprobeData, FfprobeStream } from 'fluent-ffmpeg';
|
||||
import _ from 'lodash';
|
||||
import { Duration } from 'luxon';
|
||||
import { spawn } from 'node:child_process';
|
||||
import { execFile as execFileCb } from 'node:child_process';
|
||||
import fs from 'node:fs/promises';
|
||||
import { Writable } from 'node:stream';
|
||||
import { promisify } from 'node:util';
|
||||
import sharp from 'sharp';
|
||||
import { ORIENTATION_TO_SHARP_ROTATION } from 'src/constants';
|
||||
import { Exif } from 'src/database';
|
||||
@@ -43,6 +44,8 @@ const probe = (input: string, options: string[]): Promise<FfprobeData> =>
|
||||
ffmpeg.ffprobe(input, options, (error, data) => (error ? reject(error) : resolve(data))),
|
||||
);
|
||||
|
||||
const execFile = promisify(execFileCb);
|
||||
|
||||
sharp.concurrency(0);
|
||||
sharp.cache({ files: 0 });
|
||||
|
||||
@@ -288,37 +291,33 @@ export class MediaRepository {
|
||||
* Needed for accurate segments, especially when remuxing, seeking and/or VFR is involved.
|
||||
* Scanning packets for keyframes in JS is much faster than -skip_frame nokey since it avoids decoding the video.
|
||||
*/
|
||||
probePackets(input: string, streamIndex: number): Promise<VideoPacketInfo | null> {
|
||||
const ffprobe = spawn(
|
||||
'ffprobe',
|
||||
[
|
||||
'-v',
|
||||
'error',
|
||||
'-select_streams',
|
||||
String(streamIndex),
|
||||
'-show_entries',
|
||||
'packet=pts,duration,flags',
|
||||
'-of',
|
||||
'csv=p=0',
|
||||
input,
|
||||
],
|
||||
{ stdio: ['ignore', 'pipe', 'pipe'] },
|
||||
);
|
||||
async probePackets(input: string, streamIndex: number): Promise<VideoPacketInfo | null> {
|
||||
const { stdout } = await execFile('ffprobe', [
|
||||
'-v',
|
||||
'error',
|
||||
'-select_streams',
|
||||
String(streamIndex),
|
||||
'-show_entries',
|
||||
'packet=pts,duration,flags',
|
||||
'-of',
|
||||
'csv=p=0',
|
||||
input,
|
||||
]);
|
||||
|
||||
let totalDuration = 0;
|
||||
const keyframePts: number[] = [];
|
||||
const keyframeAccDuration: number[] = [];
|
||||
const keyframeOwnDuration: number[] = [];
|
||||
const postDiscard: { pts: number; duration: number }[] = [];
|
||||
const parseLine = (line: string) => {
|
||||
for (const line of stdout.split('\n')) {
|
||||
if (!line) {
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
const [ptsStr, durationStr, flags] = line.split(',');
|
||||
const pts = Number.parseInt(ptsStr);
|
||||
const duration = Number.parseInt(durationStr);
|
||||
if (Number.isNaN(pts) || Number.isNaN(duration) || !flags) {
|
||||
return;
|
||||
if (Number.isNaN(pts) || Number.isNaN(duration)) {
|
||||
continue;
|
||||
}
|
||||
// Discarded packets don't contribute to packet count, but still contribute to video duration
|
||||
totalDuration += duration;
|
||||
@@ -333,43 +332,20 @@ export class MediaRepository {
|
||||
// Non-keyframes are accounted for in totalDuration.
|
||||
keyframeOwnDuration.push(duration);
|
||||
}
|
||||
}
|
||||
|
||||
if (postDiscard.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
totalDuration,
|
||||
packetCount: postDiscard.length,
|
||||
outputFrames: this.cfrOutputFrames(postDiscard, postDiscard.length / totalDuration),
|
||||
keyframePts,
|
||||
keyframeAccDuration,
|
||||
keyframeOwnDuration,
|
||||
};
|
||||
|
||||
let stderr = '';
|
||||
let remainder = '';
|
||||
ffprobe.stderr.setEncoding('utf8');
|
||||
ffprobe.stderr.on('data', (chunk: string) => (stderr += chunk));
|
||||
ffprobe.stdout.setEncoding('utf8');
|
||||
ffprobe.stdout.on('data', (chunk: string) => {
|
||||
const lines = chunk.split('\n');
|
||||
lines[0] = remainder + lines[0];
|
||||
remainder = lines.pop() as string;
|
||||
for (const line of lines) {
|
||||
parseLine(line);
|
||||
}
|
||||
});
|
||||
|
||||
return new Promise<VideoPacketInfo | null>((resolve, reject) => {
|
||||
ffprobe.on('error', reject);
|
||||
ffprobe.on('close', (code) => {
|
||||
if (code !== 0) {
|
||||
return reject(new Error(`ffprobe exited with code ${code}: ${stderr.trim()}`));
|
||||
}
|
||||
parseLine(remainder);
|
||||
if (postDiscard.length === 0) {
|
||||
return resolve(null);
|
||||
}
|
||||
|
||||
resolve({
|
||||
totalDuration,
|
||||
packetCount: postDiscard.length,
|
||||
outputFrames: this.cfrOutputFrames(postDiscard, postDiscard.length / totalDuration),
|
||||
keyframePts,
|
||||
keyframeAccDuration,
|
||||
keyframeOwnDuration,
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
transcode(input: string, output: string | Writable, options: TranscodeCommand): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user