Remove pytiger; select next track at end

This commit is contained in:
Keith Edmunds 2021-03-27 16:27:48 +00:00
parent 2bd96ad1a6
commit ddce8f2391
4 changed files with 17 additions and 14 deletions

View File

@ -8,8 +8,9 @@ class Config(object):
DBFS_SILENCE = -50
DISPLAY_SQL = False
ERRORS_TO = ['kae@midnighthax.com']
LOG_LEVEL_STDERR = logging.INFO
LOG_LEVEL_STDERR = logging.DEBUG
LOG_LEVEL_SYSLOG = logging.DEBUG
LOG_NAME = "musicmuster"
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
MAIL_PORT = int(os.environ.get('MAIL_PORT') or 25)
MAIL_SERVER = os.environ.get('MAIL_SERVER') or "woodlands.midnighthax.com"

View File

@ -18,7 +18,7 @@ class LevelTagFilter(logging.Filter):
return True
log = logging.getLogger("musicmuster")
log = logging.getLogger(Config.LOG_NAME)
log.setLevel(logging.DEBUG)
# stderr

View File

@ -1,11 +1,8 @@
#!/usr/bin/python3
import logging
import os
import sqlalchemy
import pytiger.logging.config
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Float, DateTime, Integer, String
from sqlalchemy.orm.exc import NoResultFound
@ -13,20 +10,15 @@ from sqlalchemy.orm import sessionmaker
from config import Config
from log import ERROR, DEBUG
# from log import INFO, ERROR, DEBUG
from log import DEBUG, ERROR, INFO
# "Constants"
# Instantiate logging
pytiger.logging.config.basic_config(stderr=False, level=logging.INFO)
log = logging.getLogger(__name__)
log.info("Starting")
INFO("Starting")
# Create session at the global level as per
# https://docs.sqlalchemy.org/en/13/orm/session_basics.html
# Set up database connection
log.info("Connect to database")
INFO("Connect to database")
engine = sqlalchemy.create_engine(f"{Config.MYSQL_CONNECT}?charset=utf8",
encoding='utf-8',
echo=Config.DISPLAY_SQL)

View File

@ -284,6 +284,17 @@ class Window(QMainWindow, Ui_MainWindow):
ms_to_mmss(self.music.get_current_silence_at() - playtime))
self.label_end_timer.setText(
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):
"""
@ -318,7 +329,6 @@ class Window(QMainWindow, Ui_MainWindow):
self.actionPlay_next.setEnabled(True)
class DbDialog(QDialog):
def __init__(self, parent=None):
super().__init__(parent)