add networks + random changes
This commit is contained in:
1 parent
bb36b2bd44
commit
5dc5a023b8
26 files changed
+1399
-1975
No files matched your search
@@ -83,6 +83,11 @@ export class AppComponent implements OnInit, AfterViewInit {
|
||||
|
||||
onScroll(): void {
|
||||
const container = this.scrollContainer.nativeElement;
|
||||
|
||||
this.scrollService.notifyScrollChange({
|
||||
scrollTop: container.scrollTop,
|
||||
clientHeight: container.clientHeight,
|
||||
});
|
||||
|
||||
// Check if the scrollbar is near the bottom
|
||||
if (
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Media } from '../../shared/models/media.model';
|
||||
})
|
||||
export class CustomMediaService {
|
||||
private backend_apiUrl = environment.API_URL;
|
||||
private apiAction = 'custom-media';
|
||||
private apiAction = 'media';
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
|
||||
@@ -20,10 +20,4 @@ export class EntryRatingsService {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
getEntrySeenById(id: string) {
|
||||
return this.http.get<EntryRating[]>(
|
||||
`${this.backend_apiUrl}/${this.apiAction}/${id}`
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,24 @@ export class EntryService {
|
||||
);
|
||||
}
|
||||
|
||||
updateEntryRatings(entryId: number, entryRatings: EntryRating) {
|
||||
return this.http.put<EntryRating>(
|
||||
`${this.backend_apiUrl}/${this.apiAction}/${entryId}/ratings`,
|
||||
{
|
||||
entryRatings: entryRatings,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
updateEntryIds(entryId: number, entryIds: EntryId) {
|
||||
return this.http.put<EntryId>(
|
||||
`${this.backend_apiUrl}/${this.apiAction}/${entryId}/ids`,
|
||||
{
|
||||
entryIds: entryIds,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// update entry
|
||||
refrechEntryById(entryId: number) {
|
||||
return this.http.put<Entry>(
|
||||
|
||||
@@ -20,7 +20,7 @@ export class MaintenanceService {
|
||||
|
||||
getMissingFiles() {
|
||||
return this.http.get<MaintenanceResult>(
|
||||
`${this.backend_apiUrl}/${this.apiAction}/missing-files`
|
||||
`${this.backend_apiUrl}/${this.apiAction}/orphan-media-records`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ export class MaintenanceService {
|
||||
|
||||
deleteMissingFiles() {
|
||||
return this.http.delete<MaintenanceResult>(
|
||||
`${this.backend_apiUrl}/${this.apiAction}/missing-files`
|
||||
`${this.backend_apiUrl}/${this.apiAction}/orphan-media-records`
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6,12 +6,18 @@ import { Subject } from 'rxjs';
|
||||
})
|
||||
export class ScrollService {
|
||||
private scrollEndSubject = new Subject<void>();
|
||||
private scrollChangeSubject = new Subject<object>();
|
||||
|
||||
// Observable for subcomponents to subscribe
|
||||
scrollEnd$ = this.scrollEndSubject.asObservable();
|
||||
scrollChange$ = this.scrollChangeSubject.asObservable();
|
||||
|
||||
// Emit scroll end event
|
||||
notifyScrollEnd(): void {
|
||||
this.scrollEndSubject.next();
|
||||
}
|
||||
|
||||
notifyScrollChange(data: object): void {
|
||||
this.scrollChangeSubject.next(data);
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ export class CalendarPageComponent implements OnInit {
|
||||
dateClick: this.handleDateClick.bind(this), // Bind the date click event handler
|
||||
datesSet: this.handleDatesSet.bind(this), // month change
|
||||
eventClick: this.handleEventClick.bind(this), // Handle event clicks
|
||||
dayMaxEvents: 4, // Limit the number of events displayed per day
|
||||
dayMaxEvents: 3, // Limit the number of events displayed per day
|
||||
height: 'auto',
|
||||
};
|
||||
|
||||
@@ -45,13 +45,13 @@ export class CalendarPageComponent implements OnInit {
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
const today = new Date();
|
||||
const firstDayOfFirstWeek = this.getFirstMondayOfMonth(today)
|
||||
.toISOString()
|
||||
.split('T')[0];
|
||||
const lastDayOfLastWeek = this.getLastSundayOfMonth(today)
|
||||
.toISOString()
|
||||
.split('T')[0];
|
||||
// const today = new Date();
|
||||
// const firstDayOfFirstWeek = this.getFirstMondayOfMonth(today)
|
||||
// .toISOString()
|
||||
// .split('T')[0];
|
||||
// const lastDayOfLastWeek = this.getLastSundayOfMonth(today)
|
||||
// .toISOString()
|
||||
// .split('T')[0];
|
||||
|
||||
// console.log('First Day of First Week:', firstDayOfFirstWeek);
|
||||
// console.log('Last Day of Last Week:', lastDayOfLastWeek);
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<div *ngIf="isLoading" class="loading-indicator">
|
||||
Loading...
|
||||
</div>
|
||||
<button class="loading-button" (click)="loadNext()">Load More</button>
|
||||
<button class="loading-button" (click)="loadNext()" *ngIf="maxPage > currentPage">Load More</button>
|
||||
|
||||
<!-- Pagination -->
|
||||
<!-- <div class="pagination-container d-flex justify-content-end" *ngIf="maxPage > 1">
|
||||
|
||||
@@ -43,7 +43,7 @@ export class SearchPageComponent implements OnInit, OnDestroy {
|
||||
searchControl = new FormControl();
|
||||
|
||||
private scrollSubscription!: Subscription;
|
||||
|
||||
private queryParamsSubscription!: Subscription;
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private tmdbService: TmdbService,
|
||||
@@ -62,12 +62,14 @@ export class SearchPageComponent implements OnInit, OnDestroy {
|
||||
// this.search(value); // Call your API search function here
|
||||
});
|
||||
|
||||
this.route.queryParams.subscribe((params: any) => {
|
||||
if (params && params['title']) {
|
||||
let title = params['title'];
|
||||
this.searchControl.setValue(title);
|
||||
this.queryParamsSubscription = this.route.queryParams.subscribe(
|
||||
(params: any) => {
|
||||
if (params && params['title']) {
|
||||
let title = params['title'];
|
||||
this.searchControl.setValue(title);
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
this.scrollSubscription = this.scrollService.scrollEnd$.subscribe(() => {
|
||||
if (!this.isLoading) {
|
||||
@@ -81,6 +83,10 @@ export class SearchPageComponent implements OnInit, OnDestroy {
|
||||
if (this.scrollSubscription) {
|
||||
this.scrollSubscription.unsubscribe();
|
||||
}
|
||||
|
||||
if (this.queryParamsSubscription) {
|
||||
this.queryParamsSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
setEntryType(entryType: boolean) {
|
||||
@@ -150,6 +156,8 @@ export class SearchPageComponent implements OnInit, OnDestroy {
|
||||
.getByKeywordMulti(this.keyword, this.currentPage)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
this.maxPage = result.total_pages;
|
||||
console.log(this.maxPage);
|
||||
this.entries = this.entries.concat(result.entries as Entry[]);
|
||||
this.isLoading = false;
|
||||
},
|
||||
|
||||
@@ -303,10 +303,17 @@ export class LibraryPageComponent implements OnInit, AfterViewInit {
|
||||
// ! Match all criteria logic
|
||||
if (this.filterCriteria.matchAll) {
|
||||
return (
|
||||
(formattedTitle
|
||||
((formattedTitle
|
||||
? entry.title.toLowerCase().includes(formattedTitle) ||
|
||||
entry.original_title.toLowerCase().includes(formattedTitle)
|
||||
: true) &&
|
||||
: true) ||
|
||||
entry.networks
|
||||
.map((network) => network.name.toLowerCase())
|
||||
.some((networkName) =>
|
||||
networkName.includes(
|
||||
formattedTitle.replace('network:', '').toLowerCase().trim()
|
||||
)
|
||||
)) &&
|
||||
(this.filterCriteria.genres?.length
|
||||
? this.filterCriteria.genres.every((genre) =>
|
||||
entry.genres.includes(genre)
|
||||
@@ -327,10 +334,13 @@ export class LibraryPageComponent implements OnInit, AfterViewInit {
|
||||
? entry.title.toLowerCase().includes(formattedTitle) ||
|
||||
entry.original_title.toLowerCase().includes(formattedTitle)
|
||||
: true) ||
|
||||
(entry.network_studio
|
||||
? entry.network_studio.toLowerCase() ==
|
||||
formattedTitle.replace('studio:', '')
|
||||
: true) ||
|
||||
entry.networks
|
||||
.map((network) => network.name.toLowerCase())
|
||||
.some(
|
||||
(networkName) =>
|
||||
networkName ==
|
||||
formattedTitle.replace('network:', '').toLowerCase()
|
||||
) ||
|
||||
(this.filterCriteria.genres?.length &&
|
||||
this.filterCriteria.genres.some((genre) =>
|
||||
entry.genres.includes(genre)
|
||||
@@ -374,8 +384,6 @@ export class LibraryPageComponent implements OnInit, AfterViewInit {
|
||||
const startIndex = (this.currentPage - 1) * this.pageSize;
|
||||
const endIndex = startIndex + this.pageSize;
|
||||
|
||||
console.log(this.pageSize, startIndex, endIndex);
|
||||
|
||||
this.entriesToDisplay = this.entriesList.slice(startIndex, endIndex);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { EntrySeen } from './entry-seen.model';
|
||||
import { Media } from './media.model';
|
||||
import { Season } from './season.model';
|
||||
import { Collection } from './collection.model';
|
||||
import { Network } from './network.model';
|
||||
|
||||
export interface Entry {
|
||||
id: number;
|
||||
@@ -44,6 +45,7 @@ export interface Entry {
|
||||
|
||||
genres: string[];
|
||||
medias: Media[];
|
||||
networks: Network[];
|
||||
|
||||
poster_path: string;
|
||||
banner_path: string;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
export interface Network {
|
||||
id: number;
|
||||
|
||||
name: string;
|
||||
originCountry: string;
|
||||
homepage: string;
|
||||
|
||||
logoPath: string;
|
||||
posterPath: string;
|
||||
backdropPath: string;
|
||||
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export const environment = {
|
||||
production: false,
|
||||
API_URL: 'http://localhost:4000/api/v1',
|
||||
TMDB_API_URL: 'https://api.themoviedb.org/3',
|
||||
TMDB_API_KEY: 'YOUR_API_KEY',
|
||||
};
|
||||
Reference in new issue
Block a user