add tvshow syntax to db
basic tvshow api request to show available tvshows limit randompage videos to 3 improve settings object to remove one useless copy
This commit is contained in:
		@@ -79,7 +79,7 @@ class App extends React.Component<{}, state> {
 | 
			
		||||
            // set theme
 | 
			
		||||
            GlobalInfos.enableDarkTheme(result.DarkMode);
 | 
			
		||||
 | 
			
		||||
            GlobalInfos.setVideoPath(result.VideoPath);
 | 
			
		||||
            GlobalInfos.setVideoPaths(result.VideoPath, result.TVShowPath);
 | 
			
		||||
 | 
			
		||||
            this.setState({
 | 
			
		||||
                mediacentername: result.MediacenterName
 | 
			
		||||
 
 | 
			
		||||
@@ -23,6 +23,8 @@ interface GetRandomMoviesType {
 | 
			
		||||
 * Randompage shuffles random viedeopreviews and provides a shuffle btn
 | 
			
		||||
 */
 | 
			
		||||
class RandomPage extends React.Component<{}, state> {
 | 
			
		||||
    readonly LoadNR = 3;
 | 
			
		||||
 | 
			
		||||
    constructor(props: {}) {
 | 
			
		||||
        super(props);
 | 
			
		||||
 | 
			
		||||
@@ -37,7 +39,7 @@ class RandomPage extends React.Component<{}, state> {
 | 
			
		||||
    componentDidMount(): void {
 | 
			
		||||
        addKeyHandler(this.keypress);
 | 
			
		||||
 | 
			
		||||
        this.loadShuffledvideos(4);
 | 
			
		||||
        this.loadShuffledvideos(this.LoadNR);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    componentWillUnmount(): void {
 | 
			
		||||
@@ -75,7 +77,7 @@ class RandomPage extends React.Component<{}, state> {
 | 
			
		||||
     * click handler for shuffle btn
 | 
			
		||||
     */
 | 
			
		||||
    shuffleclick(): void {
 | 
			
		||||
        this.loadShuffledvideos(4);
 | 
			
		||||
        this.loadShuffledvideos(this.LoadNR);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,38 @@
 | 
			
		||||
import React from 'react';
 | 
			
		||||
import Preview from '../../elements/Preview/Preview';
 | 
			
		||||
import {APINode, callAPI} from '../../utils/Api';
 | 
			
		||||
import {TVShow} from '../../types/ApiTypes';
 | 
			
		||||
import DynamicContentContainer from '../../elements/DynamicContentContainer/DynamicContentContainer';
 | 
			
		||||
 | 
			
		||||
interface State {
 | 
			
		||||
    loading: boolean;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface Props {}
 | 
			
		||||
 | 
			
		||||
class TVShowPage extends React.Component<Props, State> {
 | 
			
		||||
    state = {
 | 
			
		||||
        loading: true
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    data: TVShow.TVshowType[] = [];
 | 
			
		||||
 | 
			
		||||
    componentDidMount(): void {
 | 
			
		||||
        callAPI(APINode.TVShow, {action: 'getTVShows'}, (resp: TVShow.TVshowType[]) => {
 | 
			
		||||
            this.data = resp;
 | 
			
		||||
            this.setState({loading: false});
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
class TVShowPage extends React.Component {
 | 
			
		||||
    render(): JSX.Element {
 | 
			
		||||
        return (
 | 
			
		||||
            <>
 | 
			
		||||
                <Preview name='myTestItem' picLoader={(callback): void => callback('')} />
 | 
			
		||||
                <DynamicContentContainer
 | 
			
		||||
                    renderElement={(elem): JSX.Element => (
 | 
			
		||||
                        <Preview name={elem.Name} picLoader={(callback): void => callback('')} linkPath={'/tvshows/' + elem.Id} />
 | 
			
		||||
                    )}
 | 
			
		||||
                    data={this.state.loading ? [] : this.data}
 | 
			
		||||
                />
 | 
			
		||||
            </>
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -35,6 +35,7 @@ export namespace SettingsTypes {
 | 
			
		||||
        Password: boolean;
 | 
			
		||||
        MediacenterName: string;
 | 
			
		||||
        VideoPath: string;
 | 
			
		||||
        TVShowPath: string;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    export interface loadGeneralSettingsType {
 | 
			
		||||
@@ -58,6 +59,16 @@ export namespace SettingsTypes {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export namespace TVShow {
 | 
			
		||||
    /**
 | 
			
		||||
     * result of actor fetch
 | 
			
		||||
     */
 | 
			
		||||
    export interface TVshowType {
 | 
			
		||||
        Id: number;
 | 
			
		||||
        Name: string;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export namespace ActorTypes {
 | 
			
		||||
    /**
 | 
			
		||||
     * result of actor fetch
 | 
			
		||||
 
 | 
			
		||||
@@ -279,5 +279,6 @@ export enum APINode {
 | 
			
		||||
    Settings = 'settings',
 | 
			
		||||
    Tags = 'tags',
 | 
			
		||||
    Actor = 'actor',
 | 
			
		||||
    Video = 'video'
 | 
			
		||||
    Video = 'video',
 | 
			
		||||
    TVShow = 'tvshow'
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,7 @@ import lighttheme from '../AppLightTheme.module.css';
 | 
			
		||||
class StaticInfos {
 | 
			
		||||
    private darktheme: boolean = true;
 | 
			
		||||
    private videopath: string = '';
 | 
			
		||||
    private tvshowpath: string = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * check if the current theme is the dark theme
 | 
			
		||||
@@ -47,8 +48,9 @@ class StaticInfos {
 | 
			
		||||
     * set the current videopath
 | 
			
		||||
     * @param vidpath videopath with beginning and ending slash
 | 
			
		||||
     */
 | 
			
		||||
    setVideoPath(vidpath: string): void {
 | 
			
		||||
    setVideoPaths(vidpath: string, tvshowpath: string): void {
 | 
			
		||||
        this.videopath = vidpath;
 | 
			
		||||
        this.tvshowpath = tvshowpath;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -58,6 +60,13 @@ class StaticInfos {
 | 
			
		||||
        return this.videopath;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * return the current tvshow path
 | 
			
		||||
     */
 | 
			
		||||
    getTVShowPath(): string {
 | 
			
		||||
        return this.tvshowpath;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * load the Password page manually
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user