Skip to content

Выбор статуса: Артист/Трек - #168

Open
Burenov wants to merge 2 commits into
FozerG:mainfrom
Burenov:main
Open

Выбор статуса: Артист/Трек#168
Burenov wants to merge 2 commits into
FozerG:mainfrom
Burenov:main

Conversation

@Burenov

@Burenov Burenov commented Jun 29, 2026

Copy link
Copy Markdown

Навайбкодил изменение статуса, чтобы можно было выбирать: Артист; Артист - Трек; Трек

Тут только Клауди нейронка и больше ничего, имейте ввиду, я слишком туп, но всё прекрасно работает у меня
image
image
image
image

@Burenov

Burenov commented Jun 29, 2026

Copy link
Copy Markdown
Author

Коммиты не стал обзывать, в первом чисто добавил вариант, который был, потом понял, что там нейронка насрала отступами и исправил

@Burenov

Burenov commented Jun 29, 2026

Copy link
Copy Markdown
Author

Хотя и тут он вроде как накакал отступами, но вроде и нет. Надеюсь разберётесь, у меня работает прекрасно

@Geardung Geardung left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Есть пара критичных моментов и один стилистический. Но в целом функционал нормик и задумка гуд

Comment thread main.py
'activity_type': activityType_config,
'details': ongoing_track['title'],
'state': ongoing_track['artist'],
'name': namef,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Переменная вычисляется только при новом треке, но используется в presence_args при паузе. При первом попадании на паузу (до обновления трека) будет NameError.

Comment thread main.py
Comment on lines 533 to 552
def Handle_exception(exception): # Обработка json ошибок из Yandex Music

json_str = str(exception).replace("'", '"')
match = re.search(r'({.*?})', json_str)
if match:
json_str = match.group(1)

try:
data = json.loads(json_str)
error_name = data.get('name')
if error_name:
if error_name == 'Unavailable For Legal Reasons':
log("You are using Yandex music in a country where it is not available without authorization! Turn off VPN or login using a Yandex token.", LogType.Error)
elif error_name == 'session-expired':
log("Your Yandex token is out of date or incorrect, login again.", LogType.Error)
try:
data = json.loads(json_str)
error_name = data.get('name')
if error_name:
if error_name == 'Unavailable For Legal Reasons':
log("You are using Yandex music in a country where it is not available without authorization! Turn off VPN or login using a Yandex token.", LogType.Error)
elif error_name == 'session-expired':
log("Your Yandex token is out of date or incorrect, login again.", LogType.Error)
else:
log(f"Something happened: {exception}", LogType.Error)
else:
log(f"Something happened: {exception}", LogType.Error)
else:
except Exception:
log(f"Something happened: {exception}", LogType.Error)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON-парсинг теперь только внутри if match:
Если regex не найдёт JSON в строке ошибки, функция просто молча завершится без логирования. Раньше хотя бы логировалось "Something happened".

Comment thread main.py
Comment on lines +153 to +157
class DisplayFormatConfig(Enum):

Artist = 0
Artist_Track = 1
Track = 2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Artist, Artist_Track, Track не соответствуют UPPER_SNAKE_CASE (ARTIST, ARTIST_TRACK, TRACK), как у остальных enum в проекте (PLAYING, LISTENING, ENGLISH, RUSSIAN). Вопрос стиля, не баг.

Suggested change
class DisplayFormatConfig(Enum):
Artist = 0
Artist_Track = 1
Track = 2
class DisplayFormatConfig(Enum):
ARTIST = 0
ARTIST_TRACK = 1
TRACK = 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants