@echo off
:=== Parameters ===

python get_version.py Contents\Code\__init__.py >Contents\VERSION
set /p ver=<Contents\VERSION
echo VERSION = %ver%

set prog=PlayStream
set pack_name=PlayStream.bundle
set desc=Play online streams from various sources, mostly Latvian

set release_dir=release\
set feed_dir=q:\web\files\

rem set ZIP=\Program Files (x86)\Gow\bin\zip.exe
set ZIP="C:\Program Files\WinRAR\winrar.exe"
:=== data files ===
if exist "%pack_name%" rm -r -f "%pack_name%"
mkdir "%pack_name%""
if not exist %release_dir% mkdir %release_dir%
if not exist %feed_dir% mkdir %feed_dir%

for %%f in (
readme.md
changelog.md
Contents\*.*
Contents\Resources\*.*
Contents\Code\*.py
Contents\Libraries\Shared\*.py
Contents\Libraries\Shared\content\__init__.py
Contents\Libraries\Shared\content\ContentSources.py
Contents\Libraries\Shared\content\playstreamproxy.py
Contents\Libraries\Shared\content\Downloader.py
Contents\Libraries\Shared\content\resolver.py
Contents\Libraries\Shared\content\util.py
Contents\Libraries\Shared\content\demjson.py
Contents\Libraries\Shared\content\ordereddict.py
Contents\Libraries\Shared\content\sources\__init__.py
Contents\Libraries\Shared\content\sources\SourceBase.py
Contents\Libraries\Shared\content\sources\cinemalive.py
Contents\Libraries\Shared\content\sources\config.py
Contents\Libraries\Shared\content\sources\euronews.py
Contents\Libraries\Shared\content\sources\filmix.py
Contents\Libraries\Shared\content\sources\filmon.py
Contents\Libraries\Shared\content\sources\iplayer.py
Contents\Libraries\Shared\content\sources\movieplace.py
Contents\Libraries\Shared\content\sources\ltc.py
Contents\Libraries\Shared\content\sources\mtgplay.py
Contents\Libraries\Shared\content\sources\play24.py
Contents\Libraries\Shared\content\sources\replay.py
Contents\Libraries\Shared\content\sources\lmt.py
Contents\Libraries\Shared\content\sources\serialguru.py
Contents\Libraries\Shared\content\sources\tvdom.py
Contents\Libraries\Shared\content\sources\ustvnow.py
Contents\Libraries\Shared\content\sources\viaplay.py
Contents\Libraries\Shared\content\sources\YouTubeVideoUrl.py
Contents\Libraries\Shared\content\sources\jsinterp.py
Contents\Libraries\Shared\content\sources\swfinterp.py
Contents\Libraries\Shared\content\sources\streams.cfg
Contents\Libraries\Shared\content\resolvers\__init__.py
Contents\Libraries\Shared\content\resolvers\aadecode.py
Contents\Libraries\Shared\content\resolvers\hqqresolver.py
Contents\Libraries\Shared\content\resolvers\openload3.py
Contents\Libraries\Shared\content\resolvers\hdgo.py
Contents\Libraries\Shared\content\resolvers\kapnob.py
Contents\Libraries\Shared\content\resolvers\kodik.py
Contents\Libraries\Shared\content\resolvers\youtuberesolver.py
) do echo f| xcopy %%f %pack_name%\%%f

"%ProgramFiles%\WinRAR\winrar.exe" x -ibck requests.zip *.* %pack_name%\Contents\Libraries\Shared

if exist  %release_dir%%pack_name%-%ver%.zip rm %release_dir%%pack_name%-%ver%.zip
rem zip  -r %release_dir%%pack_name%-%ver%.zip %pack_name%
"%ProgramFiles%\WinRAR\winrar.exe" a -afzip -r %release_dir%%pack_name%-%ver%.zip %pack_name%

git add %release_dir%%pack_name%-%ver%.zip
if not ()==(%1%) (
git commit -m %ver%
git tag %ver%
git push
)

copy  %release_dir%%pack_name%-%ver%.zip  %feed_dir%%pack_name%\%pack_name%-%ver%.zip /Y
pause
