Add BAPSicle play count support.
This commit is contained in:
parent
582f48ed56
commit
c6f3e32ad2
5 changed files with 65 additions and 18 deletions
|
@ -47,14 +47,12 @@ export const bapsicleMiddleware: Middleware<{}, RootState, Dispatch<any>> = (
|
|||
var loadedItem: PlanItem = {
|
||||
timeslotitemid: raw_planitem.timeslotItemId,
|
||||
channel: message.channel,
|
||||
played: false,
|
||||
type: raw_planitem.trackId ? "central" : "aux",
|
||||
trackid: raw_planitem.trackId,
|
||||
managedid: raw_planitem.managedId,
|
||||
...raw_planitem,
|
||||
};
|
||||
if (bapsicle_state.loaded) {
|
||||
console.log("isLoaded");
|
||||
store.dispatch(MixerState.load(channel, loadedItem));
|
||||
} else {
|
||||
store.dispatch(
|
||||
|
@ -120,7 +118,6 @@ export const bapsicleMiddleware: Middleware<{}, RootState, Dispatch<any>> = (
|
|||
managedid: raw_planitem.managedId,
|
||||
...raw_planitem,
|
||||
};
|
||||
//planItem.draggableId = planItem.timeslotitemid.toString()
|
||||
planItem = planItem as PlanItem;
|
||||
planItems.push(planItem);
|
||||
});
|
||||
|
|
|
@ -2,6 +2,7 @@ import React, { useState, useEffect } from "react";
|
|||
import { getTimeslots, Timeslot } from "../api";
|
||||
|
||||
import {
|
||||
FaCircleNotch,
|
||||
FaCog,
|
||||
FaDownload,
|
||||
FaSearch,
|
||||
|
@ -38,6 +39,7 @@ export function LoadShowDialogue(close: any) {
|
|||
<>
|
||||
<ResultsPlaceholder state={state} />
|
||||
{state !== "searching" && (
|
||||
<>
|
||||
<div
|
||||
className="btn btn-outline-danger outline float-right"
|
||||
onClick={() => {
|
||||
|
@ -46,10 +48,23 @@ export function LoadShowDialogue(close: any) {
|
|||
});
|
||||
}}
|
||||
>
|
||||
<FaTrashAlt size={16} /> Clear All Channels
|
||||
<FaTrashAlt size={15} /> Clear All Channels
|
||||
</div>
|
||||
<div
|
||||
className="btn btn-outline-dark outline float-right mr-1"
|
||||
onClick={() => {
|
||||
sendBAPSicleChannel({
|
||||
command: "RESETPLAYED",
|
||||
weight: -1,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FaCircleNotch size={15} /> Mark All Unplayed
|
||||
</div>
|
||||
)}
|
||||
<h2>Load Show</h2>
|
||||
</>
|
||||
)}
|
||||
|
||||
<div className="loadshow-list">
|
||||
{items.map((item, index) => (
|
||||
<div className="loadshow-result card text-dark" key={index}>
|
||||
|
|
|
@ -67,8 +67,13 @@ export const Item = memo(function Item({
|
|||
id={isReal ? TS_ITEM_MENU_ID : ""}
|
||||
collect={() => ({ id, column, index })}
|
||||
>
|
||||
<span className={"icon " + x.type} />
|
||||
<span className={"icon " + x.type}></span>
|
||||
|
||||
{"play_count" in x && (
|
||||
<>
|
||||
<code>{x.play_count}</code>
|
||||
</>
|
||||
)}
|
||||
{x.title.toString()}
|
||||
{"artist" in x &&
|
||||
x.artist !== "" &&
|
||||
|
@ -82,7 +87,6 @@ export const Item = memo(function Item({
|
|||
>
|
||||
Explicit
|
||||
</small>
|
||||
<code>{"weight" in x && x.weight}</code>
|
||||
</ContextMenuTrigger>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
@ -244,7 +244,7 @@ const Showplanner: React.FC = function() {
|
|||
});
|
||||
}
|
||||
async function onCtxUnPlayedClick(e: any, data: { id: string }) {
|
||||
dispatch(setItemPlayed({ itemId: data.id, played: false }));
|
||||
dispatch(setItemPlayed(data.id, false));
|
||||
}
|
||||
|
||||
// Add support for reloading the show plan from the iFrames.
|
||||
|
|
|
@ -21,6 +21,7 @@ export interface ItemGhost {
|
|||
|
||||
export interface PlanItemBase {
|
||||
played?: boolean;
|
||||
play_count?: number;
|
||||
}
|
||||
export type PlanItem = (TimeslotItem | ItemGhost) & PlanItemBase;
|
||||
|
||||
|
@ -237,11 +238,41 @@ export default showplan.reducer;
|
|||
|
||||
export const {
|
||||
setItemTimings,
|
||||
setItemPlayed,
|
||||
//setItemPlayed,
|
||||
planSaveError,
|
||||
getShowplanSuccessChannel,
|
||||
} = showplan.actions;
|
||||
|
||||
export const setItemPlayed = (
|
||||
itemid: string,
|
||||
played: boolean,
|
||||
player: number | null = null
|
||||
): AppThunk => async (dispatch, getState) => {
|
||||
if (played) {
|
||||
return;
|
||||
}
|
||||
var weight = -1;
|
||||
|
||||
if (itemid) {
|
||||
const idx = getState().showplan.plan!.findIndex(
|
||||
(x) => itemId(x) === itemid
|
||||
);
|
||||
weight = getState().showplan.plan![idx].weight;
|
||||
}
|
||||
if (player) {
|
||||
sendBAPSicleChannel({
|
||||
channel: player,
|
||||
command: "RESETPLAYED",
|
||||
weight: weight,
|
||||
});
|
||||
} else {
|
||||
sendBAPSicleChannel({
|
||||
command: "RESETPLAYED",
|
||||
weight: weight,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const moveItem = (
|
||||
itemid: string,
|
||||
to: [number, number]
|
||||
|
|
Loading…
Reference in a new issue