extragear/multimedia/amarok/src

Dan hydrogen at notyetimplemented.com
Wed Nov 28 07:11:07 CET 2007


Jamie Faris wrote:
> SVN commit 742474 by jfaris:
>
> Port the bundlesToSync method of MediaDevice to the Meta framework.
>
> My first commit!
>
>   
Hi,

Yay first commit!

Any reason you didn't use PlaylistHandler to load the playlist rather 
than PlaylistFileSupport (for that matter.. what is PlaylistFileSupport 
for? Can we port it or punt it?)

Dan,
>
>  M  +16 -35    MediaDevice.cpp  
>
>
> --- trunk/extragear/multimedia/amarok/src/MediaDevice.cpp #742473:742474
> @@ -18,6 +18,7 @@
>  #include "mediabrowser.h"
>  #include "MediaItem.h"
>  #include "meta/file/File.h"
> +#include "meta/PlaylistFileSupport.h"
>  #include "mountpointmanager.h"
>  #include "pluginmanager.h"
>  #include "podcastbundle.h"
> @@ -170,47 +171,27 @@
>          m_orphanedItem->setVisible(m_orphanedItem->childCount() > 0);
>  }
>  
> -//BundleList
> -//MediaDevice::bundlesToSync( const QString &name, const KUrl &url )
> -//{
> -    //PORT 2.0
> -//    BundleList bundles;
> -//    if( !PlaylistFile::isPlaylistFile( url ) )
> -//    {
> -//        Amarok::ContextStatusBar::instance()->longMessage( i18n( "Not a playlist file: %1", url.path() ),
> -//                KDE::StatusBar::Sorry );
> -//        return bundles;
> -//    }
> -// 
> -//    PlaylistFile playlist( url.path() );
> -//    if( playlist.isError() )
> -//    {
> -//        Amarok::ContextStatusBar::instance()->longMessage( i18n( "Failed to load playlist: %1", url.path() ),
> -//                KDE::StatusBar::Sorry );
> -//        return bundles;
> -//    }
> -//
> -//    for( BundleList::iterator it = playlist.bundles().begin();
> -//            it != playlist.bundles().end();
> -//            ++it )
> -//    {
> -//        bundles += MetaBundle( (*it).url() );
> -//    }
> -//    preparePlaylistForSync( name, bundles );
> -//    return bundles;
> -//}
> -
>  Meta::TrackList
>  MediaDevice::tracksToSync( const QString &name, const KUrl &url )
>  {
> -    //TODO
> -    //get list of tracks in the playlist file at url
> -    //see comment above for implementation of old bundlesToSync()
> +    QFile file( url.url() );
>  
> -    return Meta::TrackList();
> +    if( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
> +    {
> +        Amarok::ContextStatusBar::instance()->longMessageThreadSafe( i18n( "Cannot read playlist (%1).", url.url() ) );
> +        return Meta::TrackList();
> +    }
> +
> +    QTextStream stream( &file );
> +
> +    Meta::TrackList tracks = Meta::loadM3u( stream, url.directory() );
> +
> +    preparePlaylistForSync( name, tracks );
> +
> +    return tracks;
>  }
>  
> -//TODO port to meta
> +//TODO port to meta & new collection interface
>  //BundleList
>  //MediaDevice::bundlesToSync( const QString &name, const QString &query )
>  //{
>   



More information about the Amarok-devel mailing list