From 3c936414fd7d8ce4cc4d9a6e5b6e94bca87bec86 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser <muesli@gmail.com> Date: Mon, 21 Mar 2011 14:17:00 +0100 Subject: [PATCH] * Fixed QtScriptResolver's durationString parsing. --- src/resolvers/qtscriptresolver.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/resolvers/qtscriptresolver.cpp b/src/resolvers/qtscriptresolver.cpp index b7e7caa40..c14325f64 100644 --- a/src/resolvers/qtscriptresolver.cpp +++ b/src/resolvers/qtscriptresolver.cpp @@ -104,7 +104,6 @@ ScriptEngine::resolve( const Tomahawk::query_ptr& query ) rp->setArtist( ap ); rp->setAlbum( Tomahawk::Album::get( 0, m.value( "album" ).toString(), ap ) ); rp->setTrack( m.value( "track" ).toString() ); - rp->setDuration( m.value( "duration" ).toUInt() ); rp->setBitrate( m.value( "bitrate" ).toUInt() ); rp->setUrl( m.value( "url" ).toString() ); rp->setSize( m.value( "size" ).toUInt() ); @@ -112,6 +111,13 @@ ScriptEngine::resolve( const Tomahawk::query_ptr& query ) rp->setRID( uuid() ); rp->setFriendlySource( m_parent->name() ); + rp->setDuration( m.value( "duration", 0 ).toUInt() ); + if ( rp->duration() <= 0 && m.contains( "durationString" ) ) + { + QTime time = QTime::fromString( m.value( "durationString" ).toString(), "hh:mm:ss" ); + rp->setDuration( time.secsTo( QTime( 0, 0 ) ) * -1 ); + } + rp->setMimetype( m.value( "mimetype" ).toString() ); if ( rp->mimetype().isEmpty() ) {