Skip to content

Commit

Permalink
fix: epg number/color on create
Browse files Browse the repository at this point in the history
  • Loading branch information
SenexCrenshaw committed Feb 8, 2024
1 parent ae51c9b commit 4e71fd7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class CreateEPGFileRequestHandler(ILogger<CreateEPGFileRequest> Logger, I

int num = command.EPGNumber;

if (await Repository.EPGFile.GetEPGFileByNumber(command.EPGNumber).ConfigureAwait(false) != null)
if (num == 0 || await Repository.EPGFile.GetEPGFileByNumber(command.EPGNumber).ConfigureAwait(false) != null)
{
num = await Repository.EPGFile.GetNextAvailableEPGNumberAsync(cancellationToken).ConfigureAwait(false);
}
Expand Down
14 changes: 13 additions & 1 deletion streammasterwebui/components/epg/EPGFileDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { M3UFileStreamUrlPrefix } from '@lib/common/streammaster_enums';
import { CreateEpgFileRequest, useEpgFilesCreateEpgFileMutation } from '@lib/iptvApi';
import React, { useState } from 'react';
import FileDialog, { type FileDialogProperties } from '../sharedEPGM3U/FileDialog';
Expand All @@ -7,9 +8,20 @@ const EPGFileDialog: React.FC<Partial<FileDialogProperties>> = () => {

const [epgFilesCreateEpgFileMutation] = useEpgFilesCreateEpgFileMutation();

const createEpg = async (name: string, source: string) => {
const createEpg = async (
name: string,
source: string,
maxStreams: number,
startingChannelNumber: number,
streamURLPrefix: M3UFileStreamUrlPrefix,
vodTags: string[],
epgNumber: number,
color: string
) => {
const addEpgFileRequest = {} as CreateEpgFileRequest;

addEpgFileRequest.color = color;
addEpgFileRequest.epgNumber = epgNumber;
addEpgFileRequest.name = name;
addEpgFileRequest.formFile = null;
addEpgFileRequest.urlSource = source;
Expand Down
7 changes: 5 additions & 2 deletions streammasterwebui/components/sharedEPGM3U/FileDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export interface FileDialogProperties {
maxStreams: number,
startingChannelNumber: number,
streamURLPrefix: M3UFileStreamUrlPrefix,
vodTags: string[]
vodTags: string[],
epgNumber: number,
color: string
) => void;
readonly onHide?: (didUpload: boolean) => void;
readonly show?: boolean | null;
Expand Down Expand Up @@ -224,7 +226,8 @@ const FileDialog: React.FC<FileDialogProperties> = ({ fileType, infoMessage: inp
}
});
} else {
onCreateFromSource?.(name, source, maxStreams, startingChannelNumber, streamURLPrefix, vodTags);
const meColor = color ?? getColorHex(epgNumber ?? 0);
onCreateFromSource?.(name, source, maxStreams, startingChannelNumber, streamURLPrefix, vodTags, epgNumber ?? 1, meColor);
}
};

Expand Down

0 comments on commit 4e71fd7

Please sign in to comment.