playlist: add basic m3u8 support

This commit is contained in:
2025-07-20 00:34:04 +08:00
parent 097b32c70d
commit 010e7162fd
3 changed files with 46 additions and 5 deletions

View File

@ -261,6 +261,15 @@ void MainWindow::dropEvent(QDropEvent *e)
return;
}
if (fileName.endsWith(".m3u") || fileName.endsWith(".m3u8")) {
const QModelIndex & modelIndex = m_playlistManager->loadM3U8Playlist(urls.constFirst());
if (modelIndex.isValid()) {
loadByModelIndex(modelIndex);
play();
}
return;
}
const QModelIndex & modelIndex = m_playlistManager->loadPlaylist(urls);
if (modelIndex.isValid()) {
loadByModelIndex(modelIndex);
@ -292,9 +301,8 @@ void MainWindow::loadFile()
urlList.append(QUrl::fromLocalFile(fileName));
}
m_playlistManager->loadPlaylist(urlList);
const QUrl & firstUrl = urlList.first();
loadFile(firstUrl);
const QModelIndex & modelIndex = m_playlistManager->loadPlaylist(urlList);
loadByModelIndex(modelIndex);
}
void MainWindow::loadFile(const QUrl &url)