Skip to content

Commit

Permalink
utf-8, also easier versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
ozankaraali committed Jun 7, 2024
1 parent edc19f7 commit 161f05c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,23 @@ jobs:
needs: [build-linux, build-windows, build-macos-universal, build-macos-intel]
runs-on: ubuntu-latest
steps:
- name: Get shortened SHA
id: short-sha
- name: Checkout code
uses: actions/checkout@v4
- name: Get Version
id: get_version
run: |
echo ${GITHUB_SHA:0:7} > short_sha.txt
echo "SHORT_SHA=$(cat short_sha.txt)" >> $GITHUB_ENV
version=$(grep -oP '(?<=CURRENT_VERSION = ")[^"]*' config_manager.py)
echo "VERSION=$version" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: release-${{ env.SHORT_SHA }}
release_name: Release ${{ env.SHORT_SHA }}
tag_name: v${{ env.VERSION }}
release_name: v${{ env.VERSION }}
draft: false
prerelease: false
prerelease: true
- name: Download all artifacts
uses: actions/download-artifact@v3
- name: Upload Linux Release Asset
Expand Down
4 changes: 2 additions & 2 deletions channel_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def export_channels(self):

def save_m3u_channels(self, channels_data, file_path):
try:
with open(file_path, 'w') as file:
with open(file_path, 'w', encoding='utf-8') as file:
file.write('#EXTM3U\n')
count = 0
for channel in channels_data:
Expand All @@ -272,7 +272,7 @@ def save_m3u_channels(self, channels_data, file_path):

def save_channel_list(self, base_url, channels_data, mac, file_path) -> None:
try:
with open(file_path, 'w') as file:
with open(file_path, 'w', encoding='utf-8') as file:
file.write('#EXTM3U\n')
count = 0
for channel in channels_data:
Expand Down
13 changes: 9 additions & 4 deletions config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class ConfigManager:
CURRENT_VERSION = "1.4.1" # Set your current version here
CURRENT_VERSION = "1.4.2" # Set your current version here

def __init__(self):
self.config = {}
Expand Down Expand Up @@ -44,7 +44,7 @@ def _migrate_old_config(self):

def load_config(self):
try:
with open(self.config_path, "rb") as f:
with open(self.config_path, "r", encoding="utf-8") as f:
self.config = json.loads(f.read())
if self.config is None:
self.config = self.default_config()
Expand Down Expand Up @@ -109,6 +109,11 @@ def apply_window_settings(self, window_name, window):
settings["x"], settings["y"], settings["width"], settings["height"]
)

# def save_config(self):
# with open(self.config_path, "wb") as f:
# f.write(json.dumps(self.config, option=json.OPT_INDENT_2))

def save_config(self):
with open(self.config_path, "wb") as f:
f.write(json.dumps(self.config, option=json.OPT_INDENT_2))
serialized_config = json.dumps(self.config, option=json.OPT_INDENT_2)
with open(self.config_path, "w", encoding="utf-8") as f:
f.write(serialized_config.decode("utf-8"))

0 comments on commit 161f05c

Please sign in to comment.