mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-15 02:24:50 +02:00
* AudioEngine::play( QUrl ) to directly start playback of a local file (or in the future network urls).
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "filemetadata/MusicScanner.h"
|
||||||
#include "jobview/JobStatusView.h"
|
#include "jobview/JobStatusView.h"
|
||||||
#include "jobview/JobStatusModel.h"
|
#include "jobview/JobStatusModel.h"
|
||||||
#include "jobview/ErrorStatusMessage.h"
|
#include "jobview/ErrorStatusMessage.h"
|
||||||
@@ -36,6 +37,7 @@
|
|||||||
#include "Artist.h"
|
#include "Artist.h"
|
||||||
#include "Pipeline.h"
|
#include "Pipeline.h"
|
||||||
#include "PlaylistEntry.h"
|
#include "PlaylistEntry.h"
|
||||||
|
#include "SourceList.h"
|
||||||
#include "TomahawkSettings.h"
|
#include "TomahawkSettings.h"
|
||||||
#include "UrlHandler.h"
|
#include "UrlHandler.h"
|
||||||
|
|
||||||
@@ -193,7 +195,6 @@ AudioEnginePrivate::onAudioDataArrived( QMap<Phonon::AudioDataOutput::Channel, Q
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AudioEngine* AudioEnginePrivate::s_instance = 0;
|
AudioEngine* AudioEnginePrivate::s_instance = 0;
|
||||||
|
|
||||||
|
|
||||||
@@ -929,6 +930,41 @@ AudioEngine::loadNextTrack()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
AudioEngine::play( const QUrl& url )
|
||||||
|
{
|
||||||
|
tDebug() << Q_FUNC_INFO << url;
|
||||||
|
|
||||||
|
result_ptr result = Result::get( url.toString() );
|
||||||
|
const QVariantMap tags = MusicScanner::readTags( QFileInfo( url.toLocalFile() ) ).toMap();
|
||||||
|
|
||||||
|
track_ptr t;
|
||||||
|
if ( !tags.isEmpty() )
|
||||||
|
{
|
||||||
|
t = Track::get( tags["artist"].toString(), tags["track"].toString(), tags["album"].toString(),
|
||||||
|
tags["duration"].toInt(), tags["composer"].toString(),
|
||||||
|
tags["albumpos"].toUInt(), tags["discnumber"].toUInt() );
|
||||||
|
|
||||||
|
result->setSize( tags["size"].toUInt() );
|
||||||
|
result->setBitrate( tags["bitrate"].toUInt() );
|
||||||
|
result->setModificationTime( tags["mtime"].toUInt() );
|
||||||
|
result->setMimetype( tags["mimetype"].toString() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
t = Tomahawk::Track::get( "Unknown Artist", "Unknown Track" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
result->setTrack( t );
|
||||||
|
result->setScore( 1.0 );
|
||||||
|
result->setCollection( SourceList::instance()->getLocal()->collections().first(), false );
|
||||||
|
|
||||||
|
// Tomahawk::query_ptr qry = Tomahawk::Query::get( t );
|
||||||
|
playItem( playlistinterface_ptr(), result, query_ptr() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::result_ptr& result, const Tomahawk::query_ptr& fromQuery )
|
AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::result_ptr& result, const Tomahawk::query_ptr& fromQuery )
|
||||||
{
|
{
|
||||||
|
@@ -136,6 +136,7 @@ public slots:
|
|||||||
void mute();
|
void mute();
|
||||||
void toggleMute();
|
void toggleMute();
|
||||||
|
|
||||||
|
void play( const QUrl& url );
|
||||||
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::result_ptr& result, const Tomahawk::query_ptr& fromQuery = Tomahawk::query_ptr() );
|
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::result_ptr& result, const Tomahawk::query_ptr& fromQuery = Tomahawk::query_ptr() );
|
||||||
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::query_ptr& query );
|
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::query_ptr& query );
|
||||||
void playItem( const Tomahawk::artist_ptr& artist );
|
void playItem( const Tomahawk::artist_ptr& artist );
|
||||||
|
Reference in New Issue
Block a user