Add file to db and playlist
This commit is contained in:
parent
67b3b804e1
commit
9068f46d40
@ -20,6 +20,7 @@ import helpers
|
||||
|
||||
from config import Config
|
||||
from model import Settings
|
||||
from songdb import add_path_to_db
|
||||
from ui.main_window_ui import Ui_MainWindow
|
||||
|
||||
|
||||
@ -81,23 +82,24 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
dlg.setNameFilter("Music files (*.flac *.mp3)")
|
||||
|
||||
if dlg.exec_():
|
||||
pass
|
||||
# TODO Add to database
|
||||
# for fname in dlg.selectedFiles():
|
||||
# trackwest = Track(fname)
|
||||
# self.add_to_playlist(track)
|
||||
for fname in dlg.selectedFiles():
|
||||
track = add_path_to_db(fname)
|
||||
|
||||
self.playlist.add_to_playlist(track)
|
||||
|
||||
def clear_selection(self):
|
||||
self.playlist.clearSelection()
|
||||
|
||||
def connect_signals_slots(self):
|
||||
self.actionAdd_file.triggered.connect(self.add_file)
|
||||
self.action_Clear_selection.triggered.connect(self.clear_selection)
|
||||
self.actionFade.triggered.connect(self.fade)
|
||||
self.actionNewPlaylist.triggered.connect(self.create_playlist)
|
||||
self.actionSelectPlaylist.triggered.connect(self.select_playlist)
|
||||
self.actionPlay_next.triggered.connect(self.play_next)
|
||||
self.actionSearch_database.triggered.connect(self.search_database)
|
||||
self.actionSelectPlaylist.triggered.connect(self.select_playlist)
|
||||
self.actionSkip_next.triggered.connect(self.play_next)
|
||||
self.btnAddFile.clicked.connect(self.add_file)
|
||||
self.btnInsertNote.clicked.connect(self.insert_note)
|
||||
self.btnPrevious.clicked.connect(self.play_previous)
|
||||
self.btnSearchDatabase.clicked.connect(self.search_database)
|
||||
|
||||
@ -513,11 +513,13 @@ class Playlist(QTableWidget):
|
||||
start = current_row + 1
|
||||
else:
|
||||
start = 0
|
||||
notes_rows = self.meta_get_notes()
|
||||
for row in range(start, self.rowCount()):
|
||||
if row in notes_rows:
|
||||
continue
|
||||
if self.item(row, self.COL_INDEX):
|
||||
if int(self.item(row, self.COL_INDEX).text()) > 0:
|
||||
self.meta_set_next(row)
|
||||
break
|
||||
self.meta_set_next(row)
|
||||
break
|
||||
|
||||
# Tell database to record it as played
|
||||
self.current_track.update_lastplayed()
|
||||
|
||||
@ -49,6 +49,8 @@ def add_path_to_db(path):
|
||||
track.mtime = os.path.getmtime(path)
|
||||
session.commit()
|
||||
|
||||
return track
|
||||
|
||||
|
||||
def get_audio_segment(path):
|
||||
try:
|
||||
|
||||
@ -803,6 +803,9 @@ border: 1px solid rgb(85, 87, 83);</string>
|
||||
<property name="text">
|
||||
<string>F&ade</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionS_top">
|
||||
<property name="icon">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user