Compare commits

..

No commits in common. "41379efd1ba4af8f07c67b3113946d8bca1b9864" and "25add4239d19315b00d89091c558edc3706339a1" have entirely different histories.

3 changed files with 15 additions and 24 deletions

View File

@ -65,7 +65,6 @@ class Config(object):
MAIL_SERVER = os.environ.get('MAIL_SERVER') or "woodlands.midnighthax.com" MAIL_SERVER = os.environ.get('MAIL_SERVER') or "woodlands.midnighthax.com"
MAIL_USERNAME = os.environ.get('MAIL_USERNAME') MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS') is not None MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS') is not None
MAX_IMPORT_MATCHES = 5
MAX_INFO_TABS = 5 MAX_INFO_TABS = 5
MAX_MISSING_FILES_TO_REPORT = 10 MAX_MISSING_FILES_TO_REPORT = 10
MILLISECOND_SIGFIGS = 0 MILLISECOND_SIGFIGS = 0

View File

@ -10,7 +10,7 @@ from datetime import datetime, timedelta
from time import sleep from time import sleep
from typing import List, Optional from typing import List, Optional
from PyQt5.QtCore import pyqtSignal, QDate, QEvent, Qt, QSize, QTime, QTimer from PyQt5.QtCore import QDate, QEvent, Qt, QSize, QTime, QTimer
from PyQt5.QtGui import QColor, QFont, QPalette, QResizeEvent from PyQt5.QtGui import QColor, QFont, QPalette, QResizeEvent
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QApplication, QApplication,
@ -53,8 +53,6 @@ from utilities import check_db, update_bitrates
class CartButton(QPushButton): class CartButton(QPushButton):
"""Button for playing carts""" """Button for playing carts"""
progress = pyqtSignal(int)
def __init__(self, parent: QMainWindow, cart: Carts): def __init__(self, parent: QMainWindow, cart: Carts):
"""Create a cart pushbutton and set it disabled""" """Create a cart pushbutton and set it disabled"""
@ -87,8 +85,6 @@ class CartButton(QPushButton):
self.pgb.setMaximum(1) self.pgb.setMaximum(1)
self.pgb.setValue(0) self.pgb.setValue(0)
self.progress.connect(self.pgb.setValue)
def __repr__(self) -> str: def __repr__(self) -> str:
return ( return (
f"<CartButton(cart_id={self.cart_id} " f"<CartButton(cart_id={self.cart_id} "
@ -199,9 +195,9 @@ class Window(QMainWindow, Ui_MainWindow):
btn.player.play() btn.player.play()
btn.is_playing = True btn.is_playing = True
colour = Config.COLOUR_CART_PLAYING colour = Config.COLOUR_CART_PLAYING
thread = threading.Thread(target=self.cart_progressbar, # thread = threading.Thread(target=self.cart_progressbar,
args=(btn,)) # args=(btn,))
thread.start() # thread.start()
else: else:
colour = Config.COLOUR_CART_ERROR colour = Config.COLOUR_CART_ERROR
btn.setStyleSheet("background-color: " + colour + ";\n") btn.setStyleSheet("background-color: " + colour + ";\n")
@ -264,7 +260,7 @@ class Window(QMainWindow, Ui_MainWindow):
ms = 0 ms = 0
btn.pgb.setMaximum(btn.duration) btn.pgb.setMaximum(btn.duration)
while ms <= btn.duration: while ms <= btn.duration:
btn.progress.emit(ms) btn.pgb.setValue(ms)
ms += 100 ms += 100
sleep(0.1) sleep(0.1)
@ -668,18 +664,17 @@ class Window(QMainWindow, Ui_MainWindow):
new_tracks.append((fname, tags)) new_tracks.append((fname, tags))
title = tags['title'] title = tags['title']
artist = tags['artist'] artist = tags['artist']
count = 0
possible_matches = Tracks.search_titles(session, title) possible_matches = Tracks.search_titles(session, title)
if possible_matches: if possible_matches:
if len(possible_matches) > 5:
txt = "More than five tracks look similar to "
txt += f'"{title}" by "{artist} ({fname})":\n\n'
else:
txt += 'Similar to new track ' txt += 'Similar to new track '
txt += f'"{title}" by "{artist} ({fname})":\n\n' txt += f'"{title}" by "{artist} ({fname})":\n\n'
for track in possible_matches: for track in possible_matches:
txt += f' "{track.title}" by {track.artist}' txt += f' "{track.title}" by {track.artist}'
txt += f' ({track.path})\n\n' txt += f' ({track.path})\n\n'
count += 1
if count >= Config.MAX_IMPORT_MATCHES:
txt += "\nThere are more similar-looking tracks"
break
txt += "\n" txt += "\n"
# Check whether to proceed if there were potential matches # Check whether to proceed if there were potential matches
txt += "Proceed with import?" txt += "Proceed with import?"

View File

@ -1727,9 +1727,6 @@ class PlaylistTab(QTableWidget):
top. top.
""" """
if row is None:
return
padding_required = Config.SCROLL_TOP_MARGIN padding_required = Config.SCROLL_TOP_MARGIN
top_row = row top_row = row