Skip to content

Commit

Permalink
ci: Automate excluded device section in README
Browse files Browse the repository at this point in the history
  • Loading branch information
cyb3rko committed Dec 21, 2023
1 parent a14c5ae commit d603f81
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 8 deletions.
52 changes: 52 additions & 0 deletions .github/device-catalog-manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import csv
import os


def get_file_line_count():
if os.name == "posix":
return int(os.popen("wc -l < excluded-devices.csv").read()[:-1])
elif os.name == "nt":
return int(os.popen("type excluded-devices.csv | find /v /c \"\"").read()[:-1]) - 1
else:
raise Exception("Who are you?")


output = ""
print(f"Reading CSV file in {os.getcwd()}")
with open("excluded-devices.csv", "r", encoding="utf-8") as file:
reader = csv.reader(file, delimiter=',')
row_count = get_file_line_count()
print(f"Found {row_count} entries")
if row_count < 1:
raise Exception("Empty CSV file")
next(reader)
name = None
models = []
for row in reader:
print("Entry:", row)
if name == row[0]: # multiple technical names
if not models.__contains__(row[1]):
models.append(row[1])
else: # new model entry
if name is not None:
output += "- " + name + " (" + ", ".join(models) + ")\n"
name = row[0]
models = [row[1]]
output += "- " + name + " (" + ", ".join(models) + ")\n"

print("Calculated output:")
print(output)

readme = open("../README.md", "r", encoding="utf-8").read()
marker1 = "<!--- marker1 -->"
marker2 = "<!--- marker2 -->"
list_first_index = readme.find(marker1) + len(marker1) + 1
list_last_index = readme.find(marker2)
print(f"Markers found at {list_first_index} and {list_last_index}")

if list_first_index == -1 or list_last_index == -1:
raise Exception("Position markers not found")

print("Writing README file")
with open("../README.md", "w", encoding="utf-8") as file:
file.write(readme[:list_first_index] + output + readme[list_last_index:])
73 changes: 73 additions & 0 deletions .github/excluded-devices.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
gplay-name,gplay-technical-name,branding,device
Asus ROG Phone 5,asus ASUS_I005_1,Asus,ASUS_I005_1
Asus ROG Phone 6,asus ASUS_AI2201,Asus,ASUS_AI2201
Blu G33,BLU G0890,Blu,G0890
Blu G33,BLU G0892,Blu,G0892
Blu G33,BLU G0892,Blu,G0892_SP
Google Pixel 4,google flame,Google,flame
Google Pixel 4 XL,google coral,Google,coral
Google Pixel 4a,google sunfish,Google,sunfish
Google Pixel 4a 5G,google bramble,Google,bramble
Google Pixel 5,google redfin,Google,redfin
Google Pixel 5a 5G,google barbet,Google,barbet
Lava Blaze 5G,LAVA LXX503,Lava,LXX503
Motorola motorola edge 20,motorola berlin,Motorola,berlin
Motorola motorola edge 30,motorola dubai,Motorola,dubai
Motorola motorola edge 30 ultra,motorola eqs,Motorola,eqs
Motorola motorola edge 40,motorola lyriq,Motorola,lyriq
Nothing Phone 1,Nothing Spacewar,Nothing,Spacewar
Nothing Phone 2,Nothing Pong,Nothing,Pong
OnePlus 8T,OnePlus OnePlus8T,OnePlus,OnePlus8T
OnePlus 9 5G,OnePlus OnePlus9,OnePlus,OnePlus9
OnePlus 9 5G,OnePlus OnePlus9TMO,OnePlus,OnePlus9TMO
OnePlus 9 Pro 5G,OnePlus OnePlus9Pro,OnePlus,OnePlus9Pro
OnePlus 9 Pro 5G,OnePlus OnePlus9ProTMO,OnePlus,OnePlus9ProTMO
OnePlus 9RT 5G,OnePlus OP5154L1,OnePlus,OP5154L1
OnePlus 9RT 5G,OnePlus OP5155L1,OnePlus,OP5155L1
OnePlus 10T 5G,OnePlus OP5552L1,OnePlus,OP5552L1
OnePlus 11 5G,OnePlus OP594DL1,OnePlus,OP594DL1
OnePlus 11R 5G,OnePlus OP5961L1,OnePlus,OP5961L1
OnePlus Nord CE 2,OnePlus OP555BL1,OnePlus,OP555BL1
OnePlus Nord CE 2 Lite 5G,OnePlus OP535DL1,OnePlus,OP535DL1
OnePlus Nord CE 5G,OnePlus OnePlusNordCE,OnePlus,OnePlusNordCE
Oppo CPH2145,OPPO OP4F1BL1,Oppo,OP4F1BL1
Oppo CPH2249,OPPO OP4F81L1,Oppo,OP4F81L1
Oppo CPH2251,OPPO OP4F83L1,Oppo,OP4F83L1
Oppo CPH2293,OPPO OP52E1L1,Oppo,OP52E1L1
Oppo OPPO Reno6 Z 5G,OPPO OP4FA7L1,Oppo,OP4FA7L1
Oppo OPPO Reno7,OPPO OP533FL1,Oppo,OP533FL1
POCO F4,POCO munch,POCO,munch
POCO M5,POCO stone,POCO,stone
POCO X2,POCO phoenixin,POCO,phoenixin
Redmi 10C,Redmi rain,Redmi,rain
Redmi 12 5G,Redmi XIG03,Redmi,XIG03
Redmi 12 5G,Redmi river,Redmi,river
Redmi Note 10 Pro,POCO chopin,Redmi,chopin
Redmi Note 10 Pro,Redmi sweet,Redmi,sweet
Redmi Note 10 Pro,Redmi sweetin,Redmi,sweetin
Redmi Note 10S,Redmi secret,Redmi,secret
Redmi Note 12,Redmi tapas,Redmi,tapas
Redmi Note 12,Redmi topaz,Redmi,topaz
Redmi Note 12 Pro 5G,Redmi ruby,Redmi,ruby
Redmi Note 12 Pro+ 5G,Redmi rubypro,Redmi,rubypro
Redmi POCO F5,POCO marblein,Redmi,marblein
realme 9,realme RE54E2L1,realme,RE54E2L1
realme 10 Pro 5G,realme RE588BL1,realme,RE588BL1
realme 10 Pro 5G,realme RE58B8L1,realme,RE58B8L1
realme 10 Pro+ 5G,realme RE58A5L1,realme,RE58A5L1
realme 11 Pro+ 5G,realme RE58B6L1,realme,RE58B6L1
realme narzo 30 5G,realme RE513CL1,realme,RE513CL1
Realme realme GT Master Edition,realme RE54ABL1,Realme,RE54ABL1
Realme realme GT Neo2 5G,realme RE879AL1,Realme,RE879AL1
realme 真我GT 2,realme RE58B2L1,realme,RE58B2L1
Vivo I2011,iQOO 2011,Vivo,2011
Vivo I2012,iQOO 2012,Vivo,2012
Vivo I2017,iQOO 2017,Vivo,2017
Vivo T2x 5G,vivo V2225,Vivo,V2225
Vivo V2053,vivo 2041,Vivo,2041
Vivo V2130,vivo 2130,Vivo,2130
Vivo V2141,vivo 2141,Vivo,2141
Vivo V27,vivo V2231,Vivo,V2231
Vivo vivo 2018,vivo 2018,Vivo,2018
Xiaomi 12T Pro,Xiaomi diting,Xiaomi,diting
Xiaomi 13T,Xiaomi aristotle,Xiaomi,aristotle
1 change: 1 addition & 0 deletions .github/workflows/continuous_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- 'metadata/**'
- 'legal/**'
- '**.md'
- '**.csv'
- 'LICENSE'
- '.github/workflows/release-builder.yml'
- '.github/workflows/fossa.yml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/fossa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- 'metadata/**'
- 'legal/**'
- '**.md'
- '**.csv'
- '.github/workflows/**'
- '.github/FUNDING.yml'

Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/update-device-catalog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Device Catalog Updater
on:
workflow_dispatch:
push:
paths:
- '.github/excluded-devices.csv'

jobs:
update:
name: Device Catalog Updater
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 1
sparse-checkout: |
README.md
.github/excluded-devices.csv
.github/device-catalog-manager.py
- name: List root folder
run: |
pwd
ls -la
- name: List .github folder
run: |
cd .github
pwd
ls -la
- name: Update excluded devices in README via Python
shell: sh
run: |
cd .github
python device-catalog-manager.py
- name: Commit updated README.md
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git checkout main
git add README.md
git commit -m "repo: Fill README with excluded devices"
git push
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
- [Verification](#verification)
- [Screenshots](#screenshots)
- [Supported devices](#supported-devices)
- [Exluded devices (Play Store) / Unsupported devices](#exluded-devices-play-store--unsupported-devices)
- [Excluded devices (Play Store) / Unsupported devices](#excluded-devices-play-store--unsupported-devices)
- [Contribute](#contribute)
- [Used Icons](#used-icons)
- [License](#license)
Expand All @@ -43,6 +43,8 @@
Starting with Android 13, it's possible to control multiple brightness levels of the flashlight.
To be able to use this new feature I've developed this app.

📱 The full functionality of this app is ONLY AVAILABLE for devices which support the dim functionality of the flashlight (hardware limited). 📱

Inspired by [polodarb/Flashlight-Tiramisu](https://github.com/polodarb/Flashlight-Tiramisu) 💛
Custom SeekBar built with code from [massoudss/waveformSeekBar](https://github.com/massoudss/waveformSeekBar) 💛

Expand Down Expand Up @@ -125,19 +127,19 @@ Certificate Digests:
|<img src="https://i.imgur.com/lAkL2Cn.png" width="250">|<img src="https://i.imgur.com/R9LiPry.png" width="250">|

## Supported Devices
The full functionalizy of this app is ONLY AVAILABLE for devices which support the dim functionality of the flashlight (hardware limited).
Here's a list of devices I know of which do work FOR SURE. If you've used a device that works too please let me know so I can add it here.
The full functionality of this app is ONLY AVAILABLE for devices which support the dim functionality of the flashlight (hardware limited).
Here's a list of devices I know of which do support flashlight dimming.

- Google Pixel 6 series
- Google Pixel 7 series
- Google Pixel 6/7/8 series
- nearly every Samsung phone with Android 13
- many other phones from different manufacturers
- many other devices from different manufacturers

### Exluded devices (Play Store) / Unsupported devices
### Excluded devices (Play Store) / Unsupported devices

The following list shows phones, which were manually excluded by myself in the Google Play Store, because of unsupported flashlight dimming functionality.
If the list contains any phone which does has a dimmable flashlight, please let me know.

<!--- marker1 -->
- Asus ROG Phone 5 (asus ASUS_I005_1)
- Asus ROG Phone 6 (asus ASUS_AI2201)
- Blu G33 (BLU G0890 / BLU G0892)
Expand Down Expand Up @@ -194,9 +196,10 @@ If the list contains any phone which does has a dimmable flashlight, please let
- Vivo vivo 2018 (vivo 2018)
- Xiaomi 12T Pro (Xiaomi diting)
- Xiaomi 13T (Xiaomi aristotle)
<!--- marker2 -->

## Contribute
Of course I'm happy about any kind of contribution.
Of course, I'm happy about any kind of contribution.

For creating [issues](https://github.com/cyb3rko/flashdim/issues) there's no real guideline you should follow.
If you create [pull requests](https://github.com/cyb3rko/flashdim/pulls) please try to use the syntax I use.
Expand Down

0 comments on commit d603f81

Please sign in to comment.