Skip to content

Commit

Permalink
Added the comic import feature [#539]
Browse files Browse the repository at this point in the history
 * Comic files can be discovered, selected and imported.
  • Loading branch information
mcpierce authored and BRUCELLA2 committed Nov 22, 2020
1 parent 62f38a1 commit dc6af73
Show file tree
Hide file tree
Showing 22 changed files with 1,394 additions and 0 deletions.
1 change: 1 addition & 0 deletions comixed-web/src/app/app.translate.ts
Expand Up @@ -22,6 +22,7 @@ import { HttpClient } from '@angular/common/http';
export function HttpLoaderFactory(http: HttpClient): MultiTranslateHttpLoader {
return new MultiTranslateHttpLoader(http, [
{ prefix: './assets/i18n/', suffix: '/app.json' },
{ prefix: './assets/i18n/', suffix: '/comic-import.json' },
{ prefix: './assets/i18n/', suffix: '/core.json' },
{ prefix: './assets/i18n/', suffix: '/user.json' }
]);
Expand Down
57 changes: 57 additions & 0 deletions comixed-web/src/app/comic-import/actions/comic-import.actions.ts
@@ -0,0 +1,57 @@
/*
* ComiXed - A digital comic book library management application.
* Copyright (C) 2020, The ComiXed Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses>
*/

import { createAction, props } from '@ngrx/store';
import { ComicFile } from '@app/comic-import/models/comic-file';

export const loadComicFiles = createAction(
'[ComicImport] Load comics in a file system',
props<{ directory: string; maximum: number }>()
);
export const comicFilesLoaded = createAction(
'[ComicImport] Loaded comics in a file system',
props<{ files: ComicFile[] }>()
);
export const loadComicFilesFailed = createAction(
'[ComicImport] Failed to load comic files in a file system'
);
export const setComicFilesSelectedState = createAction(
'[ComicImport] Set the selected state on comic files',
props<{ files: ComicFile[]; selected: boolean }>()
);
export const clearComicFileSelections = createAction(
'[ComicImport] Clear all selected comic files'
);
export const sendComicFiles = createAction(
'[ComicImport] Begin importing the selected comic files',
props<{
files: ComicFile[];
ignoreMetadata: boolean;
deleteBlockedPages: boolean;
}>()
);
export const comicFilesSent = createAction(
'[ComicImport] Importing comic files has started'
);
export const sendComicFilesFailed = createAction(
'[ComicImport] Failed to begin importing comic files'
);
export const setImportingComicsState = createAction(
'[ComicImport] Explicitly sets the importing state',
props<{ importing: boolean }>()
);
22 changes: 22 additions & 0 deletions comixed-web/src/app/comic-import/comic-import.constants.ts
@@ -0,0 +1,22 @@
/*
* ComiXed - A digital comic book library management application.
* Copyright (C) 2020, The ComiXed Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses>
*/

import { API_ROOT_URL } from '../core';

export const LOAD_COMIC_FILES_URL = `${API_ROOT_URL}/files/contents`;
export const SEND_COMIC_FILES_URL = `${API_ROOT_URL}/files/import`;
49 changes: 49 additions & 0 deletions comixed-web/src/app/comic-import/comic-import.fixtures.ts
@@ -0,0 +1,49 @@
/*
* ComiXed - A digital comic book library management application.
* Copyright (C) 2020, The ComiXed Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses>
*/

import { ComicFile } from './models/comic-file';

export const ROOT_DIRECTORY = '/home/comixedadmin/Documents/comics';

export const COMIC_FILE_1: ComicFile = {
id: 1,
filename: '/Users/comixed/Documents/comics/existing-comic-file.cbz',
baseFilename: 'existing-comic-file',
size: 65535
};

export const COMIC_FILE_2: ComicFile = {
id: 2,
filename: '/Users/comixed/Documents/comics/another-comic-file.cbz',
baseFilename: 'another-comic-file',
size: 32767
};

export const COMIC_FILE_3: ComicFile = {
id: 3,
filename: '/Users/comixed/Documents/comics/this-comic-file.cbz',
baseFilename: 'this-comic-file',
size: 46787
};

export const COMIC_FILE_4: ComicFile = {
id: 4,
filename: '/Users/comixed/Documents/comics/that-comic-file.cbz',
baseFilename: 'that-comic-file',
size: 56213
};
78 changes: 78 additions & 0 deletions comixed-web/src/app/comic-import/comic-import.module.ts
@@ -0,0 +1,78 @@
/*
* ComiXed - A digital comic book library management application.
* Copyright (C) 2020, The ComiXed Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses>
*/

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { CoreModule } from '../core/core.module';
import { ImportComicsComponent } from './pages/import-comics/import-comics.component';
import { ImportToolbarComponent } from './components/import-toolbar/import-toolbar.component';
import { ComicImportRoutingModule } from '@app/comic-import/comic-import-routing.module';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatInputModule } from '@angular/material/input';
import { TranslateModule } from '@ngx-translate/core';
import { MatSelectModule } from '@angular/material/select';
import { MatButtonModule } from '@angular/material/button';
import { StoreModule } from '@ngrx/store';
import {
COMIC_IMPORT_FEATURE_KEY,
reducer as comicImportReducer,
} from '@app/comic-import/reducers/comic-import.reducer';
import { EffectsModule } from '@ngrx/effects';
import { ComicImportEffects } from '@app/comic-import/effects/comic-import.effects';
import { ComicFileListComponent } from './components/comic-file-list/comic-file-list.component';
import { MatTableModule } from '@angular/material/table';
import { ComicFileCoverUrlPipe } from './pipes/comic-file-cover-url.pipe';
import { ComicFileDetailsComponent } from './components/comic-file-details/comic-file-details.component';
import { MatGridListModule } from '@angular/material/grid-list';
import { FlexModule } from '@angular/flex-layout';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatSortModule } from '@angular/material/sort';
import { MatCardModule } from '@angular/material/card';
import { MatTooltipModule } from '@angular/material/tooltip';

@NgModule({
declarations: [
ImportComicsComponent,
ImportToolbarComponent,
ComicFileListComponent,
ComicFileCoverUrlPipe,
ComicFileDetailsComponent,
],
imports: [
CommonModule,
CoreModule,
ComicImportRoutingModule,
ReactiveFormsModule,
TranslateModule.forRoot(),
StoreModule.forFeature(COMIC_IMPORT_FEATURE_KEY, comicImportReducer),
EffectsModule.forFeature([ComicImportEffects]),
MatInputModule,
MatSelectModule,
MatButtonModule,
MatTableModule,
MatGridListModule,
FlexModule,
MatCheckboxModule,
MatSortModule,
MatCardModule,
MatTooltipModule,
FormsModule,
],
exports: [CommonModule, CoreModule],
})
export class ComicImportModule {}

0 comments on commit dc6af73

Please sign in to comment.