Skip to content

Commit

Permalink
Refactors the api's
Browse files Browse the repository at this point in the history
  • Loading branch information
digimezzo committed Nov 5, 2023
1 parent 4de73d7 commit fc6627c
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 86 deletions.
102 changes: 35 additions & 67 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import 'reflect-metadata';
import '../polyfills';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { FanartApi } from './common/api/fanart/fanart-api';
import { GitHubApi } from './common/api/git-hub/git-hub-api';
import { LastfmApi } from './common/api/lastfm/lastfm-api';
import { FanartApi } from './common/api/fanart/fanart.api';
import { GitHubApi } from './common/api/git-hub/git-hub.api';
import { LastfmApi } from './common/api/lastfm/lastfm.api';
import { ContextMenuOpener } from './common/context-menu-opener';
import { AlbumKeyGenerator } from './common/data/album-key-generator';
import { BaseDatabaseMigrator } from './common/data/base-database-migrator';
Expand Down Expand Up @@ -198,37 +198,25 @@ import { TracksFilterPipe } from './pipes/tracks-filter.pipe';
import { ZeroToBlankPipe } from './pipes/zero-to-blank.pipe';
import { AlbumArtworkCacheIdFactory } from './services/album-artwork-cache/album-artwork-cache-id-factory';
import { AlbumArtworkCacheService } from './services/album-artwork-cache/album-artwork-cache.service';

import { AlbumService } from './services/album/album-service';

import { AppearanceService } from './services/appearance/appearance.service';

import { DefaultThemesCreator } from './services/appearance/default-themes-creator';
import { ApplicationService } from './services/application/application.service';

import { ArtistInformationFactory } from './services/artist-information/artist-information-factory';
import { ArtistInformationService } from './services/artist-information/artist-information.service';

import { ArtistService } from './services/artist/artist.service';

import { CollectionService } from './services/collection/collection.service';

import { DialogService } from './services/dialog/dialog.service';

import { DiscordService } from './services/discord/discord.service';
import { PresenceUpdater } from './services/discord/presence-updater';
import { ElectronService } from './services/electron.service';

import { FileService } from './services/file/file.service';

import { FolderService } from './services/folder/folder.service';

import { GenreService } from './services/genre/genre.service';
import { AlbumArtworkAdder } from './services/indexing/album-artwork-adder';
import { AlbumArtworkGetter } from './services/indexing/album-artwork-getter';
import { AlbumArtworkIndexer } from './services/indexing/album-artwork-indexer';
import { AlbumArtworkRemover } from './services/indexing/album-artwork-remover';

import { CollectionChecker } from './services/indexing/collection-checker';
import { DirectoryWalker } from './services/indexing/directory-walker';
import { EmbeddedAlbumArtworkGetter } from './services/indexing/embedded-album-artwork-getter';
Expand All @@ -244,64 +232,40 @@ import { TrackIndexer } from './services/indexing/track-indexer';
import { TrackRemover } from './services/indexing/track-remover';
import { TrackUpdater } from './services/indexing/track-updater';
import { TrackVerifier } from './services/indexing/track-verifier';

import { MediaSessionService } from './services/media-session/media-session.service';

import { CachedAlbumArtworkGetter } from './services/metadata/cached-album-artwork-getter';
import { MetadataService } from './services/metadata/metadata.service';

import { NavigationService } from './services/navigation/navigation.service';

import { NowPlayingNavigationService } from './services/now-playing-navigation/now-playing-navigation.service';

import { PlaybackIndicationService } from './services/playback-indication/playback-indication.service';

import { PlaybackInformationService } from './services/playback-information/playback-information.service';
import { AudioPlayer } from './services/playback/audio-player';

import { PlaybackService } from './services/playback/playback.service';
import { ProgressUpdater } from './services/playback/progress-updater';
import { Queue } from './services/playback/queue';

import { PlaylistFolderModelFactory } from './services/playlist-folder/playlist-folder-model-factory';
import { PlaylistFolderService } from './services/playlist-folder/playlist-folder.service';

import { PlaylistDecoder } from './services/playlist/playlist-decoder';
import { PlaylistFileManager } from './services/playlist/playlist-file-manager';
import { PlaylistModelFactory } from './services/playlist/playlist-model-factory';
import { PlaylistService } from './services/playlist/playlist.service';

import { ScrobblingService } from './services/scrobbling/scrobbling.service';

import { SearchService } from './services/search/search.service';

import { SemanticZoomService } from './services/semantic-zoom/semantic-zoom.service';

import { SnackBarService } from './services/snack-bar/snack-bar.service';

import { TracksColumnsOrdering } from './services/track-columns/tracks-columns-ordering';
import { TracksColumnsService } from './services/track-columns/tracks-columns.service';

import { TrackModelFactory } from './services/track/track-model-factory';
import { TrackService } from './services/track/track.service';

import { TranslatorService } from './services/translator/translator.service';

import { TrayService } from './services/tray/tray.service';

import { UpdateService } from './services/update/update.service';

import { LyricsService } from './services/lyrics/lyrics.service';
import { EmbeddedLyricsGetter } from './services/lyrics/embedded-lyrics-getter';
import { LrcLyricsGetter } from './services/lyrics/lrc-lyrics-getter';
import { OnlineLyricsGetter } from './services/lyrics/online-lyrics-getter';
import { ChartLyricsApi } from './common/api/lyrics/chart-lyrics-api';
import { IntegrationTestRunner } from './testing/integration-test-runner';
import { AZLyricsApi } from './common/api/lyrics/a-z-lyrics-api';
import { WebSearchLyricsApi } from './common/api/lyrics/web-search-lyrics/web-search-lyrics-api';
import { WebSearchApi } from './common/api/lyrics/web-search-lyrics/web-search-api';
import { EventListenerService } from './services/event-listener/event-listener.service';

import { BaseDesktop } from './common/io/base-desktop';
import { Desktop } from './common/io/desktop';
import { AudioPlayerBase } from './services/playback/audio-player.base';
Expand All @@ -310,34 +274,38 @@ import { LyricsServiceBase } from './services/lyrics/lyrics.service.base';
import { ArtistInformationServiceBase } from './services/artist-information/artist-information.service.base';
import { NowPlayingNavigationServiceBase } from './services/now-playing-navigation/now-playing-navigation.service.base';
import { ScrobblingServiceBase } from './services/scrobbling/scrobbling.service.base';
import {TracksColumnsServiceBase} from "./services/track-columns/tracks-columns.service.base";
import {SemanticZoomServiceBase} from "./services/semantic-zoom/semantic-zoom.service.base";
import {TrayServiceBase} from "./services/tray/tray.service.base";
import {FileServiceBase} from "./services/file/file.service.base";
import {FolderServiceBase} from "./services/folder/folder.service.base";
import {AppearanceServiceBase} from "./services/appearance/appearance.service.base";
import {PlaylistFolderServiceBase} from "./services/playlist-folder/playlist-folder.service.base";
import {PlaylistServiceBase} from "./services/playlist/playlist.service.base";
import {SearchServiceBase} from "./services/search/search.service.base";
import {MetadataServiceBase} from "./services/metadata/metadata.service.base";
import {MediaSessionServiceBase} from "./services/media-session/media-session.service.base";
import {PlaybackInformationServiceBase} from "./services/playback-information/playback-information.service.base";
import {PlaybackIndicationServiceBase} from "./services/playback-indication/playback-indication.service.base";
import {DiscordServiceBase} from "./services/discord/discord.service.base";
import {CollectionServiceBase} from "./services/collection/collection.service.base";
import {AlbumServiceBase} from "./services/album/album-service.base";
import {TrackServiceBase} from "./services/track/track.service.base";
import {GenreServiceBase} from "./services/genre/genre.service.base";
import {ArtistServiceBase} from "./services/artist/artist.service.base";
import {DialogServiceBase} from "./services/dialog/dialog.service.base";
import {PlaybackServiceBase} from "./services/playback/playback.service.base";
import {SnackBarServiceBase} from "./services/snack-bar/snack-bar.service.base";
import {UpdateServiceBase} from "./services/update/update.service.base";
import {TranslatorServiceBase} from "./services/translator/translator.service.base";
import {IndexingServiceBase} from "./services/indexing/indexing.service.base";
import {NavigationServiceBase} from "./services/navigation/navigation.service.base";
import {AlbumArtworkCacheServiceBase} from "./services/album-artwork-cache/album-artwork-cache.service.base";
import {ApplicationServiceBase} from "./services/application/application.service.base";
import { TracksColumnsServiceBase } from './services/track-columns/tracks-columns.service.base';
import { SemanticZoomServiceBase } from './services/semantic-zoom/semantic-zoom.service.base';
import { TrayServiceBase } from './services/tray/tray.service.base';
import { FileServiceBase } from './services/file/file.service.base';
import { FolderServiceBase } from './services/folder/folder.service.base';
import { AppearanceServiceBase } from './services/appearance/appearance.service.base';
import { PlaylistFolderServiceBase } from './services/playlist-folder/playlist-folder.service.base';
import { PlaylistServiceBase } from './services/playlist/playlist.service.base';
import { SearchServiceBase } from './services/search/search.service.base';
import { MetadataServiceBase } from './services/metadata/metadata.service.base';
import { MediaSessionServiceBase } from './services/media-session/media-session.service.base';
import { PlaybackInformationServiceBase } from './services/playback-information/playback-information.service.base';
import { PlaybackIndicationServiceBase } from './services/playback-indication/playback-indication.service.base';
import { DiscordServiceBase } from './services/discord/discord.service.base';
import { CollectionServiceBase } from './services/collection/collection.service.base';
import { AlbumServiceBase } from './services/album/album-service.base';
import { TrackServiceBase } from './services/track/track.service.base';
import { GenreServiceBase } from './services/genre/genre.service.base';
import { ArtistServiceBase } from './services/artist/artist.service.base';
import { DialogServiceBase } from './services/dialog/dialog.service.base';
import { PlaybackServiceBase } from './services/playback/playback.service.base';
import { SnackBarServiceBase } from './services/snack-bar/snack-bar.service.base';
import { UpdateServiceBase } from './services/update/update.service.base';
import { TranslatorServiceBase } from './services/translator/translator.service.base';
import { IndexingServiceBase } from './services/indexing/indexing.service.base';
import { NavigationServiceBase } from './services/navigation/navigation.service.base';
import { AlbumArtworkCacheServiceBase } from './services/album-artwork-cache/album-artwork-cache.service.base';
import { ApplicationServiceBase } from './services/application/application.service.base';
import { AZLyricsApi } from './common/api/lyrics/a-z-lyrics.api';
import { ChartLyricsApi } from './common/api/lyrics/chart-lyrics.api';
import { WebSearchLyricsApi } from './common/api/lyrics/web-search-lyrics/web-search-lyrics.api';
import { WebSearchApi } from './common/api/lyrics/web-search-lyrics/web-search.api';

export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { ILyricsApi } from './i-lyrics-api';
import { ILyricsApi } from './i-lyrics.api';
import { Injectable } from '@angular/core';
import { Lyrics } from './lyrics';
import { HttpClient } from '@angular/common/http';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import { ILyricsApi } from './i-lyrics-api';
import { ILyricsApi } from './i-lyrics.api';
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { XMLParser } from 'fast-xml-parser';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
import { Injectable } from '@angular/core';
import { Lyrics } from '../lyrics';
import { ILyricsApi } from '../i-lyrics-api';
import { ILyricsApi } from '../i-lyrics.api';
import { WebSearchResult } from './web-search-result';
import { WebSearchApi } from './web-search-api';
import { WebSearchApi } from './web-search.api';
import { IWebSearchLyricsSource } from './sources/i-web-search-lyrics-source';
import { AZLyricsSource } from './sources/a-z-lyrics-source';
import { Strings } from '../../../strings';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { FanartApi } from '../../common/api/fanart/fanart-api';
import { LastfmApi } from '../../common/api/lastfm/lastfm-api';
import { FanartApi } from '../../common/api/fanart/fanart.api';
import { LastfmApi } from '../../common/api/lastfm/lastfm.api';
import { LastfmArtist } from '../../common/api/lastfm/lastfm-artist';
import { Logger } from '../../common/logger';
import { Strings } from '../../common/strings';
Expand Down
14 changes: 9 additions & 5 deletions src/app/services/indexing/online-album-artwork-getter.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { Injectable } from '@angular/core';
import { LastfmAlbum } from '../../common/api/lastfm/lastfm-album';
import { LastfmApi } from '../../common/api/lastfm/lastfm-api';
import { LastfmApi } from '../../common/api/lastfm/lastfm.api';
import { ImageProcessor } from '../../common/image-processor';
import { Logger } from '../../common/logger';
import { IFileMetadata } from '../../common/metadata/i-file-metadata';
import { Strings } from '../../common/strings';

@Injectable()
export class OnlineAlbumArtworkGetter {
public constructor(private imageProcessor: ImageProcessor, private lastfmApi: LastfmApi, private logger: Logger) {}
public constructor(
private imageProcessor: ImageProcessor,
private lastfmApi: LastfmApi,
private logger: Logger,
) {}

public async getOnlineArtworkAsync(fileMetadata: IFileMetadata | undefined): Promise<Buffer | undefined> {
if (fileMetadata == undefined) {
Expand Down Expand Up @@ -50,7 +54,7 @@ export class OnlineAlbumArtworkGetter {
e,
`Could not get album info for artist='${artist}' and title='${title}'`,
'OnlineAlbumArtworkGetter',
'getOnlineArtworkAsync'
'getOnlineArtworkAsync',
);
}

Expand All @@ -64,7 +68,7 @@ export class OnlineAlbumArtworkGetter {
this.logger.info(
`Downloaded online artwork for artist='${artist}' and title='${title}'`,
'OnlineAlbumArtworkGetter',
'getOnlineArtworkAsync'
'getOnlineArtworkAsync',
);

return artworkData;
Expand All @@ -73,7 +77,7 @@ export class OnlineAlbumArtworkGetter {
e,
`Could not convert file '${lastfmAlbum.largestImage()}' to data`,
'OnlineAlbumArtworkGetter',
'getOnlineArtworkAsync'
'getOnlineArtworkAsync',
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/app/services/lyrics/online-lyrics-getter.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Injectable } from '@angular/core';
import { TrackModel } from '../track/track-model';
import { ILyricsGetter } from './i-lyrics-getter';
import { ChartLyricsApi } from '../../common/api/lyrics/chart-lyrics-api';
import { ChartLyricsApi } from '../../common/api/lyrics/chart-lyrics.api';
import { LyricsModel } from './lyrics-model';
import { Lyrics } from '../../common/api/lyrics/lyrics';
import { LyricsSourceType } from '../../common/api/lyrics/lyrics-source-type';
import { Logger } from '../../common/logger';
import { Strings } from '../../common/strings';
import { AZLyricsApi } from '../../common/api/lyrics/a-z-lyrics-api';
import { WebSearchLyricsApi } from '../../common/api/lyrics/web-search-lyrics/web-search-lyrics-api';
import { AZLyricsApi } from '../../common/api/lyrics/a-z-lyrics.api';
import { WebSearchLyricsApi } from '../../common/api/lyrics/web-search-lyrics/web-search-lyrics.api';

@Injectable()
export class OnlineLyricsGetter implements ILyricsGetter {
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/scrobbling/scrobbling.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Observable, Subject, Subscription } from 'rxjs';
import { LastfmApi } from '../../common/api/lastfm/lastfm-api';
import { LastfmApi } from '../../common/api/lastfm/lastfm.api';
import { DateTime } from '../../common/date-time';
import { Logger } from '../../common/logger';
import { BaseSettings } from '../../common/settings/base-settings';
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/update/update.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { GitHubApi } from '../../common/api/git-hub/git-hub-api';
import { GitHubApi } from '../../common/api/git-hub/git-hub.api';
import { ProductInformation } from '../../common/application/product-information';
import { BaseDesktop } from '../../common/io/base-desktop';
import { Logger } from '../../common/logger';
Expand Down
6 changes: 3 additions & 3 deletions src/app/testing/integration-test-runner.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Injectable } from '@angular/core';
import { AZLyricsApi } from '../common/api/lyrics/a-z-lyrics-api';
import { AZLyricsApi } from '../common/api/lyrics/a-z-lyrics.api';
import { Lyrics } from '../common/api/lyrics/lyrics';
import { ChartLyricsApi } from '../common/api/lyrics/chart-lyrics-api';
import { WebSearchLyricsApi } from '../common/api/lyrics/web-search-lyrics/web-search-lyrics-api';
import { ChartLyricsApi } from '../common/api/lyrics/chart-lyrics.api';
import { WebSearchLyricsApi } from '../common/api/lyrics/web-search-lyrics/web-search-lyrics.api';

@Injectable()
export class IntegrationTestRunner {
Expand Down

0 comments on commit fc6627c

Please sign in to comment.