Открыть боковую панель
cgfrosty
school-ringer
Коммиты
20774ce5
Коммит
20774ce5
создал
Дек 20, 2023
по автору
Леляев Петр Алексеевич
Просмотр файлов
Bug fix: get current music folder
владелец
db927c08
Изменения
2
Скрыть пробелы
Построчно
Рядом
school_ringer_modules/design.py
Просмотр файла @
20774ce5
from
PyQt5.QtCore
import
Qt
from
PyQt5.QtWidgets
import
QInputDialog
,
QGridLayout
,
QLabel
,
QDialog
,
QPushButton
,
QCheckBox
from
school_ringer_modules.config
import
config_path
from
school_ringer_modules.system
import
run_command
,
get_current_user_on_x
...
...
@@ -7,7 +9,7 @@ class PlayMusicOnBreaksDialog(QDialog):
def
__init__
(
self
,
flags
,
*
args
,
**
kwargs
):
super
().
__init__
(
flags
,
*
args
,
**
kwargs
)
self
.
initUI
()
self
.
music_folder
=
''
self
.
music_folder
=
run_command
(
f
'py-ini-config get
{
config_path
}
/school-ringer.conf Main music_folder'
)
def
choose_music_folder
(
self
):
self
.
music_folder
=
run_command
(
f
'kdialog --getexistingdirectory /home/
{
get_current_user_on_x
()
}
'
...
...
school_ringer_modules/sound.py
Просмотр файла @
20774ce5
...
...
@@ -64,13 +64,13 @@ def ring_the_call(filename: str, play_music=False) -> None:
def
get_music_for_breaks
():
ans
=
[]
music_path
=
run_command
(
'py-ini-config get {config_path}/school-ringer.conf Main music_folder'
)
music_path
=
run_command
(
f
'py-ini-config get
{
config_path
}
/school-ringer.conf Main music_folder'
)
if
music_path
:
music_path
=
music_path
.
lstrip
(
'"'
).
rstrip
(
'"'
)
for
file
in
os
.
listdir
(
f
'"music_path"'
):
if
file
.
split
(
'.'
)[
-
1
]
in
(
'mp3'
,
'wav'
,
'ogg'
):
ans
.
append
(
f
'"
{
music_path
}
/
{
file
}
"'
)
if
run_command
(
'py-ini-config get {config_path}/school-ringer.conf Main music_shuffle'
).
strip
()
==
'true'
:
if
run_command
(
f
'py-ini-config get
{
config_path
}
/school-ringer.conf Main music_shuffle'
).
strip
()
==
'true'
:
shuffle
(
ans
)
logging
.
info
(
'Список музыки для перемен: '
)
logging
.
info
(
ans
)
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать