branding: Move from timestamp to build counter

This commit is contained in:
ave 2019-01-25 16:19:05 +03:00
parent eb1f1ff8ac
commit e57d1ff8ae
No known key found for this signature in database
GPG Key ID: 09356ABAA42C842B
2 changed files with 24 additions and 5 deletions

View File

@ -45,7 +45,7 @@ diff -crB -x dist -x build com.discord-835-base/AndroidManifest.xml com.discord-
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.faketouch" android:required="false"/>
--- 1,4 ----
! <?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:compileSdkVersion="28" android:compileSdkVersionCodename="9" android:installLocation="auto" package="com.cutthecord.CTCBRANCH" platformBuildVersionCode="835CTCTIMESTAMP" platformBuildVersionName="8.3.5g-cutthecord">
! <?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:compileSdkVersion="28" android:compileSdkVersionCodename="9" android:installLocation="auto" package="com.cutthecord.CTCBRANCH" platformBuildVersionCode="835CTCBUILD" platformBuildVersionName="8.3.5g-cutthecord">
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.faketouch" android:required="false"/>

View File

@ -1,25 +1,44 @@
#!/bin/env python3
import os
import sys
import time
fname = sys.argv[1]
persistdir = "/home/ave/distokrepos/versionlogs/"
def counterup():
# HACKY
cfname = persistdir + fname.split("/")[-1].replace(".patch", "")
if os.path.isfile(fname):
with open(cfname, 'r') as file:
countdata = file.read()
else:
countdata = 0
countdata = int(countdata) + 1
with open(cfname, 'w') as file:
file.write(str(countdata))
return countdata
# Read in the file
with open(fname, 'r') as file:
filedata = file.read()
timestamp = str(time.time()).split(".")[0]
buildnum = counterup()
name = "CutTheCord"
branch = "base"
if "customtheme" in sys.argv:
branch = "themed"
name += " Themed"
# name += " Themed"
# Replace the target string
filedata = filedata.replace("CTCBRANCH", branch)\
.replace("CTCTIMESTAMP", timestamp)\
.replace("CTCBUILD", buildnum)\
.replace("CTCNAME", name)
# Write the file out again