Skip to content

Commit

Permalink
Merge pull request #22 from hankthetank27/s3-dump
Browse files Browse the repository at this point in the history
S3 dump
  • Loading branch information
hankthetank27 authored Oct 30, 2024
2 parents 4660d41 + 2fc92ef commit ca9d883
Show file tree
Hide file tree
Showing 9 changed files with 3,078 additions and 1,081 deletions.
3,688 changes: 2,738 additions & 950 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
"start": "NODE_ENV=production ts-node ./src/server/index.ts",
"test-start": "ts-node ./src/server/index.ts",
"trace-dev": "NODE_OPTIONS='--trace-warnings --stack-trace-limit=50' nodemon src/server/index.ts -w src/server",
"heap-prof": "node --stack-trace-limit=50 --heap-prof --trace-warnings -r ts-node/register ./src/server/index.ts"
"heap-prof": "node --stack-trace-limit=50 --heap-prof --trace-warnings -r ts-node/register ./src/server/index.ts",
"download-audio": "NODE_ENV=production npx ts-node ./src/server/livestream/DownLoadScripts.ts",
"revalidate": "NODE_ENV=production npx ts-node ./src/server/livestream/RevalidateTags.ts"
},
"dependencies": {
"@distube/ytdl-core": "^4.14.3",
"@aws-sdk/client-s3": "^3.682.0",
"@aws-sdk/lib-storage": "^3.679.0",
"@distube/ytdl-core": "^4.15.1",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@ffmpeg-installer/ffmpeg": "^1.1.0",
Expand Down
22 changes: 17 additions & 5 deletions src/@types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

export interface songInfo{
post_id: string;
title: string;
Expand All @@ -18,8 +17,6 @@ export interface streamProcessTracker {
downloaded: number;
processed: number;
passThroughFlowing: boolean;
ytdlDone: boolean;
transcodeAudioDone: boolean;
passToDestinationDone: boolean;
};

Expand Down Expand Up @@ -48,11 +45,26 @@ export interface dbQueryFilters {

export interface post{
user_name?: string;
track_title?: string;
track_title?: string; // We need to update this on DB documents with s3_file_data from ytdl 'getSongInfo'
text?: string;
link?: string;
link_source?: string;
date_posted: string;
date_posted: Date;
reacts?: string;
has_been_played?: boolean;
date_aired?: Date;
};

export interface SongDocument extends post {
_id: any;
s3_file_data?: {
bucket: string;
key: string;
etag: string;
location: string;
duration: string;
channel: string;
itag: number;
length: number;
}
};
24 changes: 12 additions & 12 deletions src/client/components/CurrentSongDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import Hls from "hls.js";
import { useState, useEffect, useContext, Dispatch, SetStateAction } from "react";
import { SocketContext } from "../context/socket";
import { v4 as uuid } from 'uuid'
import { songInfo } from "../../@types";
import { SongDocument } from "../../@types";
import styles from '@/styles/CurrentSongDisplay.module.css'
import { serverEmiters, clientEmiters } from "../../socketEvents";


interface currentSongDisplayProps{
hlsAudio: Hls | null
currentlyPlaying: songInfo | null
setCurrentlyPlaying: Dispatch<SetStateAction<songInfo | null>>
currentlyPlaying: SongDocument | null
setCurrentlyPlaying: Dispatch<SetStateAction<SongDocument | null>>
};

export function CurrentSongDisplay({
Expand Down Expand Up @@ -67,27 +67,27 @@ export function CurrentSongDisplay({


interface displaySongInfoProps{
currentlyPlaying: songInfo
currentlyPlaying: SongDocument
};

function DisplaySongInfo({
currentlyPlaying,
}: displaySongInfoProps): JSX.Element{

const {
memberPosted,
datePosted,
postText,
user_name,
date_posted,
text,
} = currentlyPlaying

return (
<div className={styles.currentlyPlaying}>
<ul key={uuid()} className={ styles.currentlyPlayingList }>
<li className={ styles.listItem }>
{memberPosted}
{datePosted
{user_name}
{date_posted
? <span>
{(memberPosted ? ", " : "") + new Date(datePosted)
{(user_name ? ", " : "") + new Date(date_posted)
.toDateString()
.split(' ')
.slice(1)
Expand All @@ -98,8 +98,8 @@ function DisplaySongInfo({
}
</li>
<li className={ styles.listItem }>
{postText
? <span>"{postText}"</span>
{text
? <span>"{text}"</span>
: null
}
</li>
Expand Down
8 changes: 4 additions & 4 deletions src/client/components/StreamPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Hls from "hls.js";
import { useEffect, useState, createRef, RefObject } from "react";
import { v4 as uuid } from 'uuid'
import { CurrentSongDisplay } from "./CurrentSongDisplay";
import { songInfo } from "../../@types";
import { SongDocument } from "../../@types";
import styles from '@/styles/StreamPlayer.module.css';


Expand All @@ -16,7 +16,7 @@ export function StreamPlayer({

const audioElement = createRef<HTMLAudioElement>();
const [ hlsAudio, setHlsAudio ] = useState<Hls | null>(null);
const [ currentlyPlaying, setCurrentlyPlaying ] = useState<songInfo | null>(null);
const [ currentlyPlaying, setCurrentlyPlaying ] = useState<SongDocument | null>(null);

useEffect(() => {
if (Hls.isSupported()) {
Expand Down Expand Up @@ -104,9 +104,9 @@ export function StreamPlayer({
<h4 className={styles.songTitle}>
<a
target="_blank"
href={currentlyPlaying?.src}
href={currentlyPlaying?.link}
>
{currentlyPlaying?.title}
{currentlyPlaying?.track_title}
</a>
</h4>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/server/@types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,4 @@ interface FissionTaskModel {
vs: string;
vf: string;
}

Loading

0 comments on commit ca9d883

Please sign in to comment.