| @echo off |
| setlocal enabledelayedexpansion |
| |
| |
| set /p REPO_URL="Introduce la URL del repositorio (por ejemplo, https://github.com/Armando287/pg.git): " |
| set /p videoBatchSize="Introduce el número de archivos de video .ts a enviar en cada lote (por ejemplo, 50 o 100): " |
| set /p audioBatchSize="Introduce el número de archivos de audio .ts a enviar en cada lote (por ejemplo, 50 o 100): " |
|
|
| set BRANCH=main |
| set WORK_DIR=%~dp0 |
| |
| |
| cd /d "%WORK_DIR%" |
| |
| |
| if not exist .git ( |
| echo Inicializando el repositorio Git... |
| git init |
| git remote add origin %REPO_URL% |
| git fetch origin %BRANCH% |
| git checkout -b %BRANCH% |
| ) |
| |
| |
| echo Procesando archivos .m3u8... |
| set /a m3u8Counter=0 |
| |
| |
| for /f "delims=" %%f in ('dir /b /a-d *.m3u8') do ( |
| set "file=%%f" |
| echo Archivo .m3u8 detectado: "!file!" |
| git add "!file!" |
| set /a m3u8Counter+=1 |
| ) |
| |
| |
| if %m3u8Counter% gtr 0 ( |
| echo Haciendo commit y push para archivos .m3u8... |
| git commit -m "Subida automática de archivos .m3u8" |
| if !ERRORLEVEL! neq 0 ( |
| echo Error al hacer commit. Error nivel: !ERRORLEVEL! |
| exit /b 1 |
| ) |
| git push origin %BRANCH% |
| if !ERRORLEVEL! neq 0 ( |
| echo Error al hacer push. Intentando hacer pull para resolver conflictos... |
| git pull origin %BRANCH% |
| echo Intentando hacer push nuevamente... |
| git push origin %BRANCH% |
| ) |
| ) |
| |
| |
| echo Procesando archivos .ts con "video" en el nombre en lotes... |
| set /a videoCounter=0 |
| set /a videoBatchCount=0 |
| |
| |
| for /f "delims=" %%f in ('dir /b /a-d *video*.ts') do ( |
| set "file=%%f" |
| echo Archivo de video .ts detectado: "!file!" |
| git add "!file!" |
| set /a videoCounter+=1 |
| |
| |
| if !videoCounter! geq %videoBatchSize% ( |
| echo Haciendo commit y push de %videoBatchSize% archivos de video .ts... |
| git commit -m "Subida automática de lote de archivos de video .ts" |
| if !ERRORLEVEL! neq 0 ( |
| echo Error al hacer commit. Error nivel: !ERRORLEVEL! |
| exit /b 1 |
| ) |
| git push origin %BRANCH% |
| if !ERRORLEVEL! neq 0 ( |
| echo Error al hacer push. Intentando hacer pull para resolver conflictos... |
| git pull origin %BRANCH% |
| echo Intentando hacer push nuevamente... |
| git push origin %BRANCH% |
| ) |
| set /a videoCounter=0 |
| set /a videoBatchCount+=1 |
| ) |
| ) |
| |
| |
| if !videoCounter! gtr 0 ( |
| echo Haciendo commit y push para los archivos de video .ts restantes... |
| git commit -m "Subida automática de los archivos de video .ts restantes" |
| if !ERRORLEVEL! neq 0 ( |
| echo Error al hacer commit. Error nivel: !ERRORLEVEL! |
| exit /b 1 |
| ) |
| git push origin %BRANCH% |
| if !ERRORLEVEL! neq 0 ( |
| echo Error al hacer push. Intentando hacer pull para resolver conflictos... |
| git pull origin %BRANCH% |
| echo Intentando hacer push nuevamente... |
| git push origin %BRANCH% |
| ) |
| ) |
| |
| |
| echo Procesando archivos .ts con "audio" en el nombre en lotes... |
| set /a audioCounter=0 |
| set /a audioBatchCount=0 |
| |
| |
| for /f "delims=" %%f in ('dir /b /a-d *audio*.ts') do ( |
| set "file=%%f" |
| echo Archivo de audio .ts detectado: "!file!" |
| git add "!file!" |
| set /a audioCounter+=1 |
| |
| |
| if !audioCounter! geq %audioBatchSize% ( |
| echo Haciendo commit y push de %audioBatchSize% archivos de audio .ts... |
| git commit -m "Subida automática de lote de archivos de audio .ts" |
| if !ERRORLEVEL! neq 0 ( |
| echo Error al hacer commit. Error nivel: !ERRORLEVEL! |
| exit /b 1 |
| ) |
| git push origin %BRANCH% |
| if !ERRORLEVEL! neq 0 ( |
| echo Error al hacer push. Intentando hacer pull para resolver conflictos... |
| git pull origin %BRANCH% |
| echo Intentando hacer push nuevamente... |
| git push origin %BRANCH% |
| ) |
| set /a audioCounter=0 |
| set /a audioBatchCount+=1 |
| ) |
| ) |
| |
| |
| if !audioCounter! gtr 0 ( |
| echo Haciendo commit y push para los archivos de audio .ts restantes... |
| git commit -m "Subida automática de los archivos de audio .ts restantes" |
| if !ERRORLEVEL! neq 0 ( |
| echo Error al hacer commit. Error nivel: !ERRORLEVEL! |
| exit /b 1 |
| ) |
| git push origin %BRANCH% |
| if !ERRORLEVEL! neq 0 ( |
| echo Error al hacer push. Intentando hacer pull para resolver conflictos... |
| git pull origin %BRANCH% |
| echo Intentando hacer push nuevamente... |
| git push origin %BRANCH% |
| ) |
| ) |
|
|
| echo Subida completada. |
| pause |
|
|