-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_plexmediafixup.bat
73 lines (58 loc) · 1.95 KB
/
run_plexmediafixup.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
@rem Run the plexmediafixup script after setting up the environment if needed.
@setlocal
@echo off
rem Customize these variables as needed
rem Name of Python virtualenv that is created:
set venv_name=plexmediafixup
rem Python command to use (with absolute path or in PATH):
set venv_python=python
rem plexmediafixup config file to be used:
set config_file=%HOMEDRIVE%%HOMEPATH%\.config\plexmediafixup.yml
rem Package source to install from:
rem set package_source=git+https://github.com/andy-maier/plexmediafixup.git@master#egg=plexmediafixup
set package_source=plexmediafixup
rem End of customization variables
where virtualenv >nul
if errorlevel 1 (
echo Error: The virtualenv command is not available. Install the Python virtualenv package
exit /b 1
)
where ffprobe >nul
if errorlevel 1 (
echo Error: The ffprobe command is not available. Install the ffmpeg OS-level package
exit /b 1
)
if "%WORKON_HOME%"=="" (
echo Error: The WORKON_HOME environment variable is not set. Set it to the virtualenv directory
exit /b 1
)
set venv_dir=%WORKON_HOME%\%venv_name%
set activate=%venv_dir%\Scripts\activate.bat
set package_name=plexmediafixup
if not exist %activate% (
echo Creating virtualenv %venv_name% with Python command %venv_python%
virtualenv %venv_dir% -p %venv_python%
if errorlevel 1 exit /b 1
)
if "%VIRTUAL_ENV%"=="" (
echo Activating virtualenv %venv_name%
call %activate%
if errorlevel 1 exit /b 1
)
pip show %package_name% >nul 2>&1
if errorlevel 1 (
echo Installing Python package %package_name% from %package_source%
pip install %package_source%
if errorlevel 1 exit /b 1
) else (
echo Upgrading Python package %package_name% from %package_source%
pip install --upgrade %package_source%
if errorlevel 1 exit /b 1
)
if not exist %config_file% (
echo Cannot find plexmediafixup config file: %config_file%
exit /b 1
)
echo Running plexmediafixup with config file %config_file%
plexmediafixup %config_file%
if errorlevel 1 exit /b 1