Skip to content

Commit

Permalink
Actually replace updated images.
Browse files Browse the repository at this point in the history
  • Loading branch information
Komodo5197 committed May 17, 2024
1 parent 4df3af2 commit 0ecbb69
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions lib/models/jellyfin_models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2278,6 +2278,9 @@ class BaseItemDto with RunTimeTickDuration {
other.albumArtist == albumArtist &&
other.childCount == childCount &&
other.imageId == imageId &&
// imageId does not necessarily change when the image is updated, so
// we must compare blurHashes as well.
other.blurHash == blurHash &&
other.mediaSources?.length == mediaSources?.length &&
other.mediaStreams?.length == mediaStreams?.length &&
other.normalizationGain == normalizationGain &&
Expand Down
4 changes: 2 additions & 2 deletions lib/services/downloads_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import 'dart:async';
import 'dart:collection';
import 'dart:io';

import 'package:background_downloader/background_downloader.dart';
import 'package:collection/collection.dart';
import 'package:Finamp/components/global_snackbar.dart';
import 'package:Finamp/services/jellyfin_api_helper.dart';
import 'package:background_downloader/background_downloader.dart';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
Expand Down
6 changes: 3 additions & 3 deletions lib/services/downloads_service_backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:logging/logging.dart';
import 'package:path/path.dart' as path_helper;
import 'package:uuid/uuid.dart';

import '../models/finamp_models.dart';
import '../models/jellyfin_models.dart';
Expand Down Expand Up @@ -1592,9 +1593,8 @@ class DownloadsSyncService {
path_helper.join(downloadLocation.currentPath, subDirectory);
}

// We still use imageIds for filenames despite switching to blurhashes as
// blurhashes can include characters that filesystems don't support
final fileName = "${_filesystemSafe(item.imageId)!}.image";
// Always use a new, unique filename when creating image downloads
final fileName = "${const Uuid().v4()}.image";

_isar.writeTxnSync(() {
DownloadItem? canonItem =
Expand Down

0 comments on commit 0ecbb69

Please sign in to comment.