Skip to content

Commit

Permalink
chore: fetch contributions
Browse files Browse the repository at this point in the history
  • Loading branch information
altaywtf committed Sep 19, 2024
2 parents 0c5bab3 + ed4db3c commit 80b6752
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 1 deletion.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.16.0
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# put.io Changelog

## [Enhancement] - 2024-05-05

- Add VLC streaming support for both regular and MP4 streams

## [Initial Version] - 2023-06-04

### Files
Expand Down
24 changes: 24 additions & 0 deletions src/components/FileListItemActions.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { exec } from "child_process";
import { ActionPanel, Action, Icon, confirmAlert, showToast, Toast, Alert } from "@raycast/api";
import { useCachedPromise } from "@raycast/utils";
import type { IFile } from "@putdotio/api-client";
import { getPutioAccountInfo, getPutioClient } from "../api/withPutioClient";
import { Files } from "../files";
import { RenameFile } from "../rename-file";
import { deleteFile } from "../api/files";
import { useIsVlcInstalled } from "../utils";

const fetchFileDownloadURL = async (file: IFile) => {
try {
Expand Down Expand Up @@ -35,6 +37,7 @@ const fetchFileURLs = async (file: IFile) => {
};

export const FileListItemNavigationActions = ({ file }: { file: IFile }) => {
const isVlcInstalled = useIsVlcInstalled();
const { data: urls } = useCachedPromise(fetchFileURLs, [file]);

return (
Expand Down Expand Up @@ -63,7 +66,28 @@ export const FileListItemNavigationActions = ({ file }: { file: IFile }) => {
)}

{urls?.stream && <Action.CopyToClipboard title="Copy Stream URL" content={urls.stream} />}

{urls?.mp4Stream && <Action.CopyToClipboard title="Copy Mp4 Stream URL" content={urls.mp4Stream} />}

{isVlcInstalled && urls?.stream && (
<Action
icon={Icon.AppWindow}
onAction={() => {
exec(`vlc "${urls.stream}"`);
}}
title="Open in Vlc"
/>
)}

{isVlcInstalled && urls?.mp4Stream && (
<Action
icon={Icon.AppWindow}
onAction={() => {
exec(`vlc "${urls.mp4Stream}"`);
}}
title="Open Mp4 in Vlc"
/>
)}
</>
);
};
Expand Down
1 change: 0 additions & 1 deletion src/transfers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export const Transfers = () => {
return (
<List isLoading={isLoading} searchBarPlaceholder="Search in transfers">
<EmptyView title={data && data?.transfers.length === 0 ? "No transfers" : "Transfers"} />

{data?.transfers.map((transfer) => <TransferListItem key={transfer.id} transfer={transfer} />)}
</List>
);
Expand Down
19 changes: 19 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { useEffect, useState } from "react";
import { getApplications } from "@raycast/api";

export const useIsVlcInstalled = () => {
const [isVlcInstalled, setIsVlcInstalled] = useState(false);

useEffect(() => {
const checkIfVlcInstalled = async () => {
const applications = await getApplications();
const vlcIsInstalled = applications.some(({ bundleId }) => bundleId === "org.videolan.vlc");

setIsVlcInstalled(vlcIsInstalled);
};

checkIfVlcInstalled();
}, []);

return isVlcInstalled;
};

0 comments on commit 80b6752

Please sign in to comment.