Skip to content

Commit

Permalink
更新 code 生成方式
Browse files Browse the repository at this point in the history
  • Loading branch information
lemisky committed Mar 19, 2024
1 parent bd9af7a commit 74c68a9
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/wilk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import json
import os
import time
import re
import subprocess
from dataclasses import dataclass, field, asdict
from pathlib import Path
from typing import List, Tuple
Expand All @@ -17,6 +18,24 @@

SOUNDS_PATH = '/storage/emulated/0/Android/data/com.tencent.mm/files/WechatXposed/sounds/'

# adb shell ls /storage/emulated/0/Android/data/com.tencent.mm/files/WechatXposed/sounds/
START_CODE = None


def get_code():
global START_CODE
if START_CODE is None:
a = subprocess.run('adb shell ls /storage/emulated/0/Android/data/com.tencent.mm/files/WechatXposed/sounds/',
capture_output=True)
b = a.stdout.decode('utf8').replace('\r', '').split('\n')
for i in b:
if re.match(r'sf_(\d+).json', i):
code = int(re.match(r'sf_(\d+).json', i).group(1))
if START_CODE is None or code > START_CODE:
START_CODE = code
START_CODE += 1
return START_CODE


@dataclass
class Sound:
Expand Down Expand Up @@ -99,7 +118,7 @@ def start(start_durations, files):
silk_file = convert_to_silk(silk_file)
print(silk_file)

code = time.time_ns()
code = get_code()

# 4.2 获取分段数据及信息
duration = 0
Expand Down

0 comments on commit 74c68a9

Please sign in to comment.