windows dev support scripts

This commit is contained in:
faush01
2020-01-24 15:16:57 +11:00
parent cd93bac9fc
commit 754ff22990
4 changed files with 61 additions and 0 deletions

15
scripts/check_strings.ps1 Normal file
View File

@@ -0,0 +1,15 @@
$string_ids = @()
Select-String -path resources\language\resource.language.en_gb\strings.po -pattern "msgctxt " | select Line | ForEach {
$id = [regex]::match($_.Line.ToString(), '\"#([0-9]+)\"').Groups[1].Value
if($string_ids -contains $id)
{
Write-Host "ERROR: String ID Already Exists : " $id
}
else
{
$string_ids += $id
Get-ChildItem *.py,settings.xml,resources\language\resource.language.en_gb\strings.po -recurse | Select-String -pattern $id | group Pattern | where {$_.Count -eq 1} | select Name, Count
}
}

15
scripts/copy_embycon.bat Normal file
View File

@@ -0,0 +1,15 @@
del /F /Q /S %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.embycon
rmdir /Q /S %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.embycon
xcopy /Y addon.xml %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.embycon\
xcopy /Y default.py %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.embycon\
xcopy /Y fanart.jpg %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.embycon\
xcopy /Y icon.png %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.embycon\
xcopy /Y kodi.png %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.embycon\
xcopy /Y service.py %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.embycon\
xcopy /E /Y resources %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.embycon\resources\
cd "%programfiles%\Kodi"
kodi.exe

45
scripts/process_addon.py Normal file
View File

@@ -0,0 +1,45 @@
import xml.etree.ElementTree as ET
import subprocess
from shutil import copy2, copytree, rmtree
import os
import sys
package_path = "package"
def ignore_files(path, item_list):
return [".idea", ".git", ".gitignore", "scripts", package_path]
zip_path = "c:\\Program Files\\7-Zip\\7z.exe"
addon_path = sys.argv[1]
tree = ET.parse(addon_path + "\\addon.xml")
root = tree.getroot()
id = root.attrib["id"]
version = root.attrib["version"]
print (package_path + " - " + version)
try:
rmtree(package_path + "\\" + id)
except FileNotFoundError as err:
pass
copytree(addon_path, package_path + "\\" + id, ignore=ignore_files)
zip_name = id + "-" + version + ".zip"
os.chdir(package_path)
cmd_7zip = [zip_path, "a", zip_name, id]
sp = subprocess.Popen(cmd_7zip, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
sp.wait()
os.chdir("..")
copy2(package_path + "\\" + id + "\\addon.xml", package_path + "\\addon.xml")
try:
rmtree(package_path + "\\" + id)
except FileNotFoundError as err:
pass