diff --git a/app.py b/app.py index 433afb0..de05938 100644 --- a/app.py +++ b/app.py @@ -353,20 +353,6 @@ async def post_to_socials(req: SocialPostRequest): "Authorization": f"Apikey {req.api_key}" } - data = { - "user": req.user_id, - "title": final_title, - "privacy_level": "PUBLIC_TO_EVERYONE", # TikTok - "privacyStatus": "public", # YouTube - "media_type": "REELS", # Instagram - } - - # Add platforms - for p in req.platforms: - data.update({f"platform[{len(data.get('platform', [])) if 'platform' in data else 0}]": p}) - # Wait, httpx/requests handling of list params can be tricky. - # Usually list of tuples [('platform[]', 'tiktok'), ('platform[]', 'instagram')] works. - # Prepare data as dict (httpx handles lists for multiple values) data_payload = { "user": req.user_id, @@ -376,17 +362,18 @@ async def post_to_socials(req: SocialPostRequest): # Add Platform specifics if "tiktok" in req.platforms: - desc = req.tiktok_description or clip.get('social_descriptions', {}).get('tiktok', final_title) + desc = req.tiktok_description or clip.get('video_description_for_tiktok', final_title) data_payload["tiktok_title"] = desc if "instagram" in req.platforms: - desc = req.instagram_description or clip.get('social_descriptions', {}).get('instagram', final_title) + desc = req.instagram_description or clip.get('video_description_for_instagram', final_title) data_payload["instagram_title"] = desc data_payload["media_type"] = "REELS" if "youtube" in req.platforms: - desc = req.youtube_description or clip.get('social_descriptions', {}).get('instagram', final_title) # Fallback - data_payload["youtube_title"] = final_title + yt_title = req.title or clip.get('video_title_for_youtube_short', final_title) + desc = req.youtube_description or clip.get('video_description_for_instagram', final_title) # Fallback + data_payload["youtube_title"] = yt_title data_payload["youtube_description"] = desc data_payload["privacyStatus"] = "public" diff --git a/dashboard/public/logo-openshorts.png b/dashboard/public/logo-openshorts.png new file mode 100644 index 0000000..09972bd Binary files /dev/null and b/dashboard/public/logo-openshorts.png differ diff --git a/dashboard/src/App.jsx b/dashboard/src/App.jsx index a159e88..a4777de 100644 --- a/dashboard/src/App.jsx +++ b/dashboard/src/App.jsx @@ -3,6 +3,7 @@ import { Upload, FileVideo, Sparkles, Youtube, Instagram, Share2, LogOut, Chevro import KeyInput from './components/KeyInput'; import MediaInput from './components/MediaInput'; import ResultCard from './components/ResultCard'; +import ProcessingAnimation from './components/ProcessingAnimation'; // Simple TikTok icon sine Lucide might not have it or it varies const TikTokIcon = ({ size = 16, className = "" }) => ( @@ -100,6 +101,7 @@ function App() { const [results, setResults] = useState(null); const [logs, setLogs] = useState([]); const [logsVisible, setLogsVisible] = useState(false); + const [processingMedia, setProcessingMedia] = useState(null); useEffect(() => { if (apiKey) localStorage.setItem('gemini_key', apiKey); @@ -179,6 +181,7 @@ function App() { setStatus('processing'); setLogs(["Starting process..."]); setResults(null); + setProcessingMedia(data); try { let body; @@ -303,6 +306,10 @@ function App() {
+ {status === 'processing' && processingMedia && ( + + )} + {(status === 'processing' || status === 'error') && (
diff --git a/dashboard/src/components/ProcessingAnimation.jsx b/dashboard/src/components/ProcessingAnimation.jsx new file mode 100644 index 0000000..94db6a9 --- /dev/null +++ b/dashboard/src/components/ProcessingAnimation.jsx @@ -0,0 +1,110 @@ +import React, { useEffect, useState } from 'react'; +import { Scan, Scissors, Activity, Radio } from 'lucide-react'; + +const ProcessingAnimation = ({ media }) => { + const [videoSrc, setVideoSrc] = useState(null); + const [isYouTube, setIsYouTube] = useState(false); + + useEffect(() => { + if (!media) return; + + if (media.type === 'file') { + const url = URL.createObjectURL(media.payload); + setVideoSrc(url); + return () => URL.revokeObjectURL(url); + } else if (media.type === 'url') { + setIsYouTube(true); + const videoId = getYouTubeId(media.payload); + setVideoSrc(videoId); + } + }, [media]); + + const getYouTubeId = (url) => { + const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/; + const match = url.match(regExp); + return (match && match[2].length === 11) ? match[2] : null; + }; + + return ( +
+ {/* Video Layer */} +
+ {isYouTube && videoSrc ? ( +