Skip to content

Commit 2ae4c5e

Browse files
committed
Update the Dependencies and readme to make it easy to run it locally in a docker container
1 parent 44ba74a commit 2ae4c5e

14 files changed

+4032
-3694
lines changed

.env.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ TIKTOK_SESSION_ID=""
99

1010
# ImageMagick Binary Path
1111
# Download ImageMagick from https://imagemagick.org/script/download.php
12-
IMAGEMAGICK_BINARY=""
12+
IMAGEMAGICK_BINARY="/usr/bin/convert"
1313

1414
# Pexels API Key
1515
# Register at https://www.pexels.com/api/ to get your API key.

Backend/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def check_env_vars() -> None:
104104
SystemExit: If any required environment variables are missing.
105105
"""
106106
try:
107-
required_vars = ["PEXELS_API_KEY", "TIKTOK_SESSION_ID", "IMAGEMAGICK_BINARY"]
107+
required_vars = ["PEXELS_API_KEY", "IMAGEMAGICK_BINARY"]
108108
missing_vars = [var + os.getenv(var) for var in required_vars if os.getenv(var) is None or (len(os.getenv(var)) == 0)]
109109

110110
if missing_vars:

Dockerfile

-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ COPY Backend/ Backend/
3737
RUN pip install --no-cache-dir --upgrade pip && \
3838
pip install --no-cache-dir -r requirements.txt
3939

40-
# Create necessary directories
41-
RUN mkdir -p Backend/static/assets/{temp,subtitles,music,fonts} Backend/static/generated_videos
4240

4341
WORKDIR /home/app/Backend
4442
# copy the .env file

Dockerfile.FE.Nuxt

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ RUN corepack enable && corepack prepare pnpm@latest --activate
1515
WORKDIR /app
1616

1717
# Copy package files first for better caching
18-
COPY ./UI/package.json ./UI/pnpm-lock.yaml ./
18+
COPY ./UI/package.json ./
1919

2020
# Set npm registry and install dependencies
2121
RUN npm config set registry https://registry.npmjs.org/
2222

2323
# Install dependencies with pnpm
24-
RUN pnpm install --frozen-lockfile
24+
RUN pnpm i
2525

2626
# Copy the rest of the application
2727
COPY ./UI .

README.md

+29
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,37 @@
11
## ShortsGenerator
22
![ShortGenerator](/logo.jpeg)
3+
### How to run locally 🚀 Docker is required
4+
---
5+
6+
2. Clone the repository
7+
8+
```sh
9+
git clone git@github.com:leamsigc/ShortsGenerator.git video Generator
10+
11+
```
12+
13+
14+
15+
3. Go to the folder:"
16+
17+
```sh
18+
cd videoGenerator
19+
20+
```
21+
22+
4. Copy the `.env-example` to `.env`
23+
5. Update the Pexel API key if you want to use Video from Pexel
24+
6. The TikTok key is not needed anymore
25+
7. `docker compose up -d `
26+
8. Go to 'http://localhost:5000/generate' to start generating videos
27+
9. Click on the Setting `...` to get images and videos to use in the video
28+
---
29+
330

431
Automate the creation of YouTube Shorts locally with a couple of simple steps.
532

33+
34+
635
1. Give a video subject
736
1. Add extra prompt information if needed
837
2. Review the script

UI/components/HeaderLayout.vue

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts" setup>
2+
import { useFullscreen } from '@vueuse/core'
23
/**
34
*
45
* Component Description:Desc
@@ -29,11 +30,8 @@ const { toggle: toggleFullScreen } = useFullscreen();
2930
<SearchTrigger />
3031
<div class="flex items-center justify-center">
3132
<NSpace>
32-
<ActionIcon
33-
:tooltip-text="t('layouts.header.toggleFullScreen')"
34-
icon="i-tabler-maximize"
35-
@click="toggleFullScreen"
36-
/>
33+
<ActionIcon :tooltip-text="t('layouts.header.toggleFullScreen')" icon="i-tabler-maximize"
34+
@click="toggleFullScreen" />
3735
<NaiveColorModeSwitch size="large" class="pt-1" />
3836
</NSpace>
3937
</div>

UI/components/SearchDialog.vue

+31-94
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* @todo [ ] Integration test.
1111
* @todo [✔] Update the typescript.
1212
*/
13-
13+
import { useFullscreen } from '@vueuse/core'
1414
import type { ScrollbarInst } from "naive-ui";
1515
import { isWindows } from "~/utils/PlatformUtils";
1616
import type {
@@ -254,74 +254,33 @@ onMounted(() => {
254254

255255
<template>
256256
<NModal v-model:show="isDialogVisible" class="search-dialog">
257-
<NCard
258-
class="w-[650px]"
259-
content-style="padding: 0;"
260-
:bordered="false"
261-
size="huge"
262-
role="dialog"
263-
aria-modal="true"
264-
>
265-
<div
266-
class="search-dialog-action-bar rounded-2xl"
267-
@keydown.up="movePrevItem()"
268-
@keydown.down="moveNextItem()"
269-
>
257+
<NCard class="w-[650px]" content-style="padding: 0;" :bordered="false" size="huge" role="dialog" aria-modal="true">
258+
<div class="search-dialog-action-bar rounded-2xl" @keydown.up="movePrevItem()" @keydown.down="moveNextItem()">
270259
<div class="search-input flex items-center gap-5 px-5 h-12">
271260
<Icon :name="SearchIcon" size="16" />
272-
<input
273-
v-model="search"
274-
:placeholder="t('searchDialog.searchPlaceholder')"
275-
class="grow bg-transparent outline-none border-none"
276-
/>
261+
<input v-model="search" :placeholder="t('searchDialog.searchPlaceholder')"
262+
class="grow bg-transparent outline-none border-none" />
277263
<NText code> ESC </NText>
278-
<Icon
279-
:name="CloseIcon"
280-
size="20"
281-
class="cursor-pointer"
282-
@click="closeDialog()"
283-
/>
264+
<Icon :name="CloseIcon" size="20" class="cursor-pointer" @click="closeDialog()" />
284265
</div>
285266
<NDivider />
286267
<NScrollbar ref="scrollContent" style="height: 400px">
287268
<div class="content-wrap">
288-
<div
289-
v-for="group of filteredGroups"
290-
:key="group.name"
291-
class="group"
292-
>
269+
<div v-for="group of filteredGroups" :key="group.name" class="group">
293270
<div class="group-title">
294271
{{ group.name }}
295272
</div>
296273
<NEl class="group-list">
297-
<div
298-
v-for="item of group.items"
299-
:id="item.key.toString()"
300-
:key="item.key"
301-
class="item flex items-center my-2"
302-
:class="{ active: item.key === activeItem }"
303-
@click="executeAction(item.action)"
304-
>
274+
<div v-for="item of group.items" :id="item.key.toString()" :key="item.key"
275+
class="item flex items-center my-2" :class="{ active: item.key === activeItem }"
276+
@click="executeAction(item.action)">
305277
<NEl class="icon">
306-
<NAvatar
307-
v-if="item.iconImage"
308-
round
309-
:size="28"
310-
:src="item.iconImage"
311-
/>
312-
<Icon
313-
v-if="item.iconName"
314-
:name="item.iconName"
315-
size="18"
316-
/>
278+
<NAvatar v-if="item.iconImage" round :size="28" :src="item.iconImage" />
279+
<Icon v-if="item.iconName" :name="item.iconName" size="18" />
317280
</NEl>
318281
<div class="title grow">
319-
<Highlighter
320-
highlight-class-name="highlight"
321-
:search-words="keywords"
322-
:auto-escape="true"
323-
:text-to-highlight="item.title"
324-
/>
282+
<Highlighter highlight-class-name="highlight" :search-words="keywords" :auto-escape="true"
283+
:text-to-highlight="item.title" />
325284
</div>
326285
<div class="label">
327286
{{ item.label }}
@@ -362,45 +321,41 @@ onMounted(() => {
362321
.search-dialog .search-dialog-action-bar .search-input .ca-text--code {
363322
white-space: nowrap;
364323
}
324+
365325
.search-dialog .search-dialog-action-bar .ca-divider {
366326
margin-top: 0;
367327
margin-bottom: 0;
368328
}
329+
369330
.search-dialog .search-dialog-action-bar .content-wrap {
370331
padding-bottom: 30px;
371332
}
333+
372334
.search-dialog .search-dialog-action-bar .content-wrap .group-empty {
373335
text-align: center;
374336
padding: 30px 0 40px 0;
375337
}
338+
376339
.search-dialog .search-dialog-action-bar .content-wrap .group {
377340
padding: 0 10px;
378341
}
342+
379343
.search-dialog .search-dialog-action-bar .content-wrap .group .group-title {
380344
opacity: 0.6;
381345
margin-bottom: 5px;
382346
padding: 20px 10px 5px;
383347
}
384-
.search-dialog
385-
.search-dialog-action-bar
386-
.content-wrap
387-
.group
388-
.group-list
389-
.item {
348+
349+
.search-dialog .search-dialog-action-bar .content-wrap .group .group-list .item {
390350
padding: 7px 10px;
391351
gap: 10px;
392352
cursor: pointer;
393353
border-radius: 10px;
394354
width: 100%;
395355
text-align: left;
396356
}
397-
.search-dialog
398-
.search-dialog-action-bar
399-
.content-wrap
400-
.group
401-
.group-list
402-
.item
403-
.icon {
357+
358+
.search-dialog .search-dialog-action-bar .content-wrap .group .group-list .item .icon {
404359
width: 28px;
405360
height: 28px;
406361
border-radius: 50%;
@@ -409,39 +364,21 @@ onMounted(() => {
409364
justify-content: center;
410365
align-items: center;
411366
}
412-
.search-dialog
413-
.search-dialog-action-bar
414-
.content-wrap
415-
.group
416-
.group-list
417-
.item
418-
.title {
367+
368+
.search-dialog .search-dialog-action-bar .content-wrap .group .group-list .item .title {
419369
font-weight: bold;
420370
}
421-
.search-dialog
422-
.search-dialog-action-bar
423-
.content-wrap
424-
.group
425-
.group-list
426-
.item
427-
.label {
371+
372+
.search-dialog .search-dialog-action-bar .content-wrap .group .group-list .item .label {
428373
opacity: 0.8;
429374
font-size: 0.9em;
430375
}
431-
.search-dialog
432-
.search-dialog-action-bar
433-
.content-wrap
434-
.group
435-
.group-list
436-
.item.active {
376+
377+
.search-dialog .search-dialog-action-bar .content-wrap .group .group-list .item.active {
437378
background-color: var(--hover-color);
438379
}
439-
.search-dialog
440-
.search-dialog-action-bar
441-
.content-wrap
442-
.group
443-
.group-list
444-
.item:hover {
380+
381+
.search-dialog .search-dialog-action-bar .content-wrap .group .group-list .item:hover {
445382
box-shadow: 0 0 0 1px var(--primary-color-hover) inset;
446383
}
447384
</style>

UI/composables/useGlobalSettings.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
import { useStorage } from "@vueuse/core";
2+
13

24
export const useApiSettings = () => {
3-
const API_SETTINGS = useLocalStorage("API_SETTINGS", {
4-
URL:"http://localhost:8080",
5+
const API_SETTINGS = useStorage("API_SETTINGS", {
6+
URL: "http://localhost:8080",
57
})
68
return {
79
API_SETTINGS
810
}
911
}
1012
export const useGlobalSettings = () => {
11-
const globalSettings = useLocalStorage("globalSettings", {
13+
const globalSettings = useStorage("globalSettings", {
1214
font: "Roboto",
1315
color: "#000",
1416
subtitles_position: "center,bottom",

UI/composables/useVideoSetings.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import { useStorage } from '@vueuse/core'
2+
3+
14
export interface VideoResultFormat {
25
url: string;
36
image: string;
@@ -10,7 +13,7 @@ export interface VideoResultFormat {
1013
}
1114

1215
export const useVideoSettings = () => {
13-
const video = useLocalStorage<{
16+
const video = useStorage<{
1417
script: string;
1518
voice: string;
1619
videoSubject: string;
File renamed without changes.

UI/package.json

+16-19
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,32 @@
33
"private": true,
44
"type": "module",
55
"scripts": {
6-
"build": "nuxt build",
6+
"build": "nuxt build --dotenv .env ",
77
"dev": "nuxt dev --dotenv ../.env ",
88
"generate": "nuxt generate",
99
"preview": "nuxt preview",
1010
"postinstall": "nuxt prepare",
1111
"start": "node .output/server/index.mjs"
1212
},
1313
"dependencies": {
14-
"@pinia/nuxt": "^0.5.1",
15-
"@unocss/nuxt": "^0.58.5",
16-
"nuxt": "^3.10.1",
17-
"tabulator-tables": "^5.6.0",
18-
"vue": "^3.4.15",
19-
"vue-router": "^4.2.5"
14+
"@pinia/nuxt": "^0.9.0",
15+
"@unocss/nuxt": "^0.65.2",
16+
"nuxt": "^3.14.1592",
17+
"tabulator-tables": "^6.3.0",
18+
"vue": "^3.5.13",
19+
"vue-router": "^4.5.0"
2020
},
2121
"devDependencies": {
22-
"@bg-dev/nuxt-naiveui": "^1.10.1",
23-
"@nuxt/content": "^2.12.0",
24-
"@nuxt/devtools": "^1.0.8",
25-
"@nuxtjs/i18n": "^8.1.1",
26-
"@nuxtjs/tailwindcss": "^6.11.3",
27-
"@tailwindcss/typography": "^0.5.10",
28-
"@types/tabulator-tables": "^5.5.9",
29-
"@vueuse/nuxt": "^10.7.2",
30-
"nuxt-icon": "^0.6.8",
22+
"@bg-dev/nuxt-naiveui": "^1.14.0",
23+
"@nuxt/content": "^2.13.4",
24+
"@nuxt/devtools": "^1.6.4",
25+
"@nuxtjs/i18n": "^9.1.1",
26+
"@nuxtjs/tailwindcss": "^6.12.2",
27+
"@tailwindcss/typography": "^0.5.15",
28+
"@types/tabulator-tables": "^6.2.3",
29+
"@vueuse/nuxt": "^12.0.0",
30+
"nuxt-icon": "^0.6.10",
3131
"nuxt-lodash": "^2.5.3",
3232
"sass": "^1.71.0"
33-
},
34-
"resolutions": {
35-
"vue": "3.3.13"
3633
}
3734
}

0 commit comments

Comments
 (0)