Skip to content

Commit

Permalink
Bugfix/633 album cover indexing is broken (#636)
Browse files Browse the repository at this point in the history
* Removed shitty sharp and removes indexing from workers

* Further album artwork indexing cleanup

* Indexing works again

* Removed dependency on ipcRenderer in IndexingService
  • Loading branch information
digimezzo authored Jul 31, 2024
1 parent 6a32667 commit 0e67f0b
Show file tree
Hide file tree
Showing 61 changed files with 1,495 additions and 3,077 deletions.
1 change: 0 additions & 1 deletion angular.webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ module.exports = {
net: 'commonjs net',
querystring: 'commonjs querystring',
url: 'commonjs url',
sharp: 'commonjs sharp',
},
};
1 change: 0 additions & 1 deletion electron-builder.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ const config = {
Name: 'Dopamine 3',
Terminal: 'false',
},
asarUnpack: ['**/node_modules/sharp/**'], // Because ElectronBuilder ignores Linux. See: https://github.com/electron-userland/electron-builder/issues/6200
},
};

Expand Down
1 change: 0 additions & 1 deletion main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion main.js.map

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-return */
import {app, BrowserWindow, ipcMain, Menu, nativeTheme, protocol, Tray} from 'electron';
import { app, BrowserWindow, ipcMain, Menu, nativeTheme, protocol, Tray } from 'electron';
import log from 'electron-log';
import * as Store from 'electron-store';
import * as windowStateKeeper from 'electron-window-state';
import * as os from 'os';
import * as path from 'path';
import * as url from 'url';
import {Worker} from 'worker_threads';

const sharp = require('sharp'); // required to use sharp in worker threads
import { Worker } from 'worker_threads';

/**
* Command line parameters
Expand Down Expand Up @@ -332,7 +330,7 @@ try {

ipcMain.on('indexing-worker', (event: any, arg: any) => {
const workerThread = new Worker(path.join(__dirname, 'main/workers/indexing-worker.js'), {
workerData: {arg},
workerData: { arg },
});

workerThread.on('message', (message): void => {
Expand Down
28 changes: 0 additions & 28 deletions main/common/image-processor.js

This file was deleted.

79 changes: 0 additions & 79 deletions main/data/album-artwork-repository.js

This file was deleted.

40 changes: 0 additions & 40 deletions main/data/track-repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,46 +275,6 @@ class TrackRepository {
const statement = database.prepare(`${QueryParts.selectTracksQueryPart(false)} WHERE t.Path=?;`);
return statement.get(path);
}

disableNeedsAlbumArtworkIndexing(albumKey) {
const database = this.databaseFactory.create();
const statement = database.prepare(`UPDATE Track SET NeedsAlbumArtworkIndexing=0 WHERE AlbumKey=?;`);
statement.run(albumKey);
}

getLastModifiedTrackForAlbumKeyAsync(albumKeyIndex, albumKey) {
const database = this.databaseFactory.create();
const statement = database.prepare(`${QueryParts.selectTracksQueryPart(false)} WHERE t.AlbumKey${albumKeyIndex}=?;`);
return statement.get(albumKey);
}

getAlbumDataThatNeedsIndexing(albumKeyIndex) {
const database = this.databaseFactory.create();

const statement = database.prepare(
`${QueryParts.selectAlbumDataQueryPart(albumKeyIndex, false)}
WHERE (t.AlbumKey${albumKeyIndex} IS NOT NULL AND t.AlbumKey${albumKeyIndex} <> ''
AND t.AlbumKey${albumKeyIndex} NOT IN (SELECT AlbumKey FROM AlbumArtwork)) OR NeedsAlbumArtworkIndexing=1
GROUP BY t.AlbumKey${albumKeyIndex};`,
);

return statement.all();
}

enableNeedsAlbumArtworkIndexingForAllTracks(onlyWhenHasNoCover) {
const database = this.databaseFactory.create();
let statement;

if (onlyWhenHasNoCover) {
statement = database.prepare(
`UPDATE Track SET NeedsAlbumArtworkIndexing=1 WHERE AlbumKey NOT IN (SELECT AlbumKey FROM AlbumArtwork);`,
);
} else {
statement = database.prepare(`UPDATE Track SET NeedsAlbumArtworkIndexing=1;`);
}

statement.run();
}
}

exports.TrackRepository = TrackRepository;
115 changes: 0 additions & 115 deletions main/indexing/album-artwork-adder.js

This file was deleted.

Loading

0 comments on commit 0e67f0b

Please sign in to comment.