Remove pytiger; select next track at end
This commit is contained in:
parent
2bd96ad1a6
commit
ddce8f2391
@ -8,8 +8,9 @@ class Config(object):
|
|||||||
DBFS_SILENCE = -50
|
DBFS_SILENCE = -50
|
||||||
DISPLAY_SQL = False
|
DISPLAY_SQL = False
|
||||||
ERRORS_TO = ['kae@midnighthax.com']
|
ERRORS_TO = ['kae@midnighthax.com']
|
||||||
LOG_LEVEL_STDERR = logging.INFO
|
LOG_LEVEL_STDERR = logging.DEBUG
|
||||||
LOG_LEVEL_SYSLOG = logging.DEBUG
|
LOG_LEVEL_SYSLOG = logging.DEBUG
|
||||||
|
LOG_NAME = "musicmuster"
|
||||||
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
|
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
|
||||||
MAIL_PORT = int(os.environ.get('MAIL_PORT') or 25)
|
MAIL_PORT = int(os.environ.get('MAIL_PORT') or 25)
|
||||||
MAIL_SERVER = os.environ.get('MAIL_SERVER') or "woodlands.midnighthax.com"
|
MAIL_SERVER = os.environ.get('MAIL_SERVER') or "woodlands.midnighthax.com"
|
||||||
|
|||||||
@ -18,7 +18,7 @@ class LevelTagFilter(logging.Filter):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger("musicmuster")
|
log = logging.getLogger(Config.LOG_NAME)
|
||||||
log.setLevel(logging.DEBUG)
|
log.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
# stderr
|
# stderr
|
||||||
|
|||||||
14
app/model.py
14
app/model.py
@ -1,11 +1,8 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import logging
|
|
||||||
import os
|
import os
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
|
|
||||||
import pytiger.logging.config
|
|
||||||
|
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
from sqlalchemy import Column, Float, DateTime, Integer, String
|
from sqlalchemy import Column, Float, DateTime, Integer, String
|
||||||
from sqlalchemy.orm.exc import NoResultFound
|
from sqlalchemy.orm.exc import NoResultFound
|
||||||
@ -13,20 +10,15 @@ from sqlalchemy.orm import sessionmaker
|
|||||||
|
|
||||||
from config import Config
|
from config import Config
|
||||||
|
|
||||||
from log import ERROR, DEBUG
|
from log import DEBUG, ERROR, INFO
|
||||||
# from log import INFO, ERROR, DEBUG
|
|
||||||
|
|
||||||
# "Constants"
|
INFO("Starting")
|
||||||
# Instantiate logging
|
|
||||||
pytiger.logging.config.basic_config(stderr=False, level=logging.INFO)
|
|
||||||
log = logging.getLogger(__name__)
|
|
||||||
log.info("Starting")
|
|
||||||
|
|
||||||
# Create session at the global level as per
|
# Create session at the global level as per
|
||||||
# https://docs.sqlalchemy.org/en/13/orm/session_basics.html
|
# https://docs.sqlalchemy.org/en/13/orm/session_basics.html
|
||||||
|
|
||||||
# Set up database connection
|
# Set up database connection
|
||||||
log.info("Connect to database")
|
INFO("Connect to database")
|
||||||
engine = sqlalchemy.create_engine(f"{Config.MYSQL_CONNECT}?charset=utf8",
|
engine = sqlalchemy.create_engine(f"{Config.MYSQL_CONNECT}?charset=utf8",
|
||||||
encoding='utf-8',
|
encoding='utf-8',
|
||||||
echo=Config.DISPLAY_SQL)
|
echo=Config.DISPLAY_SQL)
|
||||||
|
|||||||
@ -284,6 +284,17 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
ms_to_mmss(self.music.get_current_silence_at() - playtime))
|
ms_to_mmss(self.music.get_current_silence_at() - playtime))
|
||||||
self.label_end_timer.setText(
|
self.label_end_timer.setText(
|
||||||
ms_to_mmss(self.music.get_current_duration() - playtime))
|
ms_to_mmss(self.music.get_current_duration() - playtime))
|
||||||
|
else:
|
||||||
|
# When music ends, ensure next track is selected
|
||||||
|
if self.playlist.selectionModel().hasSelection():
|
||||||
|
row = self.playlist.currentRow()
|
||||||
|
track_id = int(self.playlist.item(row, 0).text())
|
||||||
|
if track_id == self.music.get_current_track_id():
|
||||||
|
# Current track highlighted: select next
|
||||||
|
try:
|
||||||
|
self.playlist.selectRow(row + 1)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
def add_to_playlist(self, track):
|
def add_to_playlist(self, track):
|
||||||
"""
|
"""
|
||||||
@ -318,7 +329,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
self.actionPlay_next.setEnabled(True)
|
self.actionPlay_next.setEnabled(True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DbDialog(QDialog):
|
class DbDialog(QDialog):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user