extragear/multimedia/amarok/src

Maximilian Kossick maximilian.kossick at googlemail.com
Sun Jun 22 15:52:39 CEST 2008


is this really necessary? collections where a downloadable url is
different from a playable url can override getKIOCopyableUrl in
CollectionLocation(that's what that method is for after all). i'm not
convinced there's a need to add an implementation detail that can be
handled inside the collection itself (or the collection's
CollectionLocation, which is tightly coupled to the collection anyway)
to the Meta API, which should be kept as simple as possible.

max

On Sun, Jun 22, 2008 at 2:45 PM, Casey Link <unnamedrambler at gmail.com> wrote:
> SVN commit 823032 by link:
>
> Added a downloadUrl method to distingush between playableUrl and plain 'ol url. By default downloadUrl returns playableUrl.
>
>
>  M  +7 -1      meta/Meta.cpp
>  M  +4 -2      meta/Meta.h
>  M  +22 -0     servicebrowser/ServiceMetaBase.cpp
>  M  +4 -0      servicebrowser/ServiceMetaBase.h
>
>
> --- trunk/extragear/multimedia/amarok/src/meta/Meta.cpp #823031:823032
> @@ -1,7 +1,7 @@
>  /* This file is part of the Amarok project
>    Copyright (C) 2007 Maximilian Kossick <maximilian.kossick at googlemail.com>
>    Copyright (C) 2007 Ian Monroe <ian at monroe.nu>
> -   Copyright (C) 2008 Mark Kretschmann <kretschmann at kde.org>
> +   Copyright (C) 2008 Mark Kretschmann <kretschmann at kde.org>
>
>    This program is free software; you can redistribute it and/or
>    modify it under the terms of the GNU General Public License
> @@ -234,6 +234,12 @@
>
>  //Meta::Track
>
> +KUrl
> +Meta::Track::downloadUrl() const
> +{
> +    return playableUrl();
> +}
> +
>  bool
>  Meta::Track::inCollection() const
>  {
> --- trunk/extragear/multimedia/amarok/src/meta/Meta.h #823031:823032
> @@ -1,6 +1,6 @@
>  /* This file is part of the Amarok project
>    Copyright (C) 2007 Maximilian Kossick <maximilian.kossick at googlemail.com>
> -   Copyright (C) 2008 Mark Kretschmann <kretschmann at kde.org>
> +   Copyright (C) 2008 Mark Kretschmann <kretschmann at kde.org>
>
>    This program is free software; you can redistribute it and/or
>    modify it under the terms of the GNU General Public License
> @@ -78,7 +78,7 @@
>             void unsubscribeFrom( GenrePtr );
>             void subscribeTo( YearPtr );
>             void unsubscribeFrom( YearPtr );
> -
> +
>             /** This method is called when the metadata of a track has changed.
>                 The called class may not cache the pointer */
>             virtual void metadataChanged( Track *track );
> @@ -165,6 +165,8 @@
>             virtual KUrl playableUrl() const = 0;
>             /** an url for display purposes */
>             virtual QString prettyUrl() const = 0;
> +            /** an url to be used for downloading, not playing */
> +            virtual KUrl downloadUrl() const;
>             /** an url which is unique for this track. Use this if you need a key for the track */
>             virtual QString url() const = 0;
>
> --- trunk/extragear/multimedia/amarok/src/servicebrowser/ServiceMetaBase.cpp #823031:823032
> @@ -143,6 +143,7 @@
>     , m_length( 0 )
>     , m_displayUrl( 0 )
>     , m_playableUrl( 0 )
> +    , m_downloadUrl( 0 )
>     , m_albumId( 0 )
>     , m_albumName( 0 )
>     , m_artistId( 0 )
> @@ -166,6 +167,7 @@
>     m_trackNumber = resultRow[2].toInt();
>     m_length = resultRow[3].toInt();
>     m_displayUrl = resultRow[4];
> +    m_downloadUrl = resultRow[4];
>     m_playableUrl = resultRow[4];
>     m_albumId = resultRow[5].toInt();
>     //m_albumName = resultRow[6];
> @@ -241,6 +243,13 @@
>     return m_playableUrl;
>  }
>
> +KUrl
> +ServiceTrack::downloadUrl() const
> +{
> +    KUrl url( m_downloadUrl );
> +    return url;
> +}
> +
>  QString
>  ServiceTrack::prettyUrl() const
>  {
> @@ -251,9 +260,22 @@
>  ServiceTrack::setUrl(const QString & url)
>  {
>     m_playableUrl = url;
> +    m_downloadUrl = url;
>     m_displayUrl = url;
>  }
>
> +void
> +ServiceTrack::setPlayableUrl(const QString & url)
> +{
> +    m_playableUrl = url;
> +}
> +
> +void
> +ServiceTrack::setDownloadUrl(const QString & url)
> +{
> +    m_downloadUrl = url;
> +}
> +
>  bool
>  ServiceTrack::isPlayable() const
>  {
> --- trunk/extragear/multimedia/amarok/src/servicebrowser/ServiceMetaBase.h #823031:823032
> @@ -146,6 +146,7 @@
>
>         virtual KUrl playableUrl() const;
>         virtual QString url() const;
> +        virtual KUrl downloadUrl() const;
>         virtual QString prettyUrl() const;
>
>         virtual bool isPlayable() const;
> @@ -236,6 +237,8 @@
>         void setArtistId( int id );
>         int artistId() const;
>         void setUrl( const QString &url );
> +        void setDownloadUrl( const QString &url );
> +        void setPlayableUrl( const QString &url );
>
>     private:
>         ArtistPtr m_artist;
> @@ -249,6 +252,7 @@
>         int m_trackNumber;
>         int m_length;
>         QString m_displayUrl;
> +        QString m_downloadUrl;
>         QString m_playableUrl;
>         int m_albumId;
>         QString m_albumName;
>


More information about the Amarok-devel mailing list