Fwd: extragear/multimedia/amarok/src/podcasts

Ian Monroe ian at monroe.nu
Wed Mar 12 00:24:58 CET 2008


I think Bart ccmailed the wrong list. :)

It sounds like a bad idea to have something like the podcast depend on
the local collection. But it has to get access to SQL from somewhere.

Ian


---------- Forwarded message ----------
From: Bart Cerneels <bart.cerneels at kde.org>
Date: Tue, Mar 11, 2008 at 6:03 PM
Subject: extragear/multimedia/amarok/src/podcasts
To: kde-commits at kde.org
Cc: kde-devel at kde.org


SVN commit 784657 by shanachie:

 Start of the SQL implementation for the PodcastCollection. I plan to
hijack the local collection and create these tables in there,
toghether with the other local stuff. Please speak up if anyone thinks
that is a bad idea.
 CCMAIL:kde-devel at kde.org


  M  +41 -0     PodcastCollection.cpp
  M  +6 -0      PodcastCollection.h


 --- trunk/extragear/multimedia/amarok/src/podcasts/PodcastCollection.cpp
#784656:784657
 @@ -24,6 +24,7 @@
  #include "debug.h"
  #include "PodcastReader.h"
  #include "support/MemoryQueryMaker.h"
 +#include "SqlStorage.h"
  #include "TheInstances.h"

  #include <kurl.h>
 @@ -252,4 +253,44 @@
     return playlistList;
  }

 +//SQL storage stuff
 +void
 +PodcastCollection::createTables() const
 +{
 +    DEBUG_BLOCK
 +
 +    m_sqlStorage->query( QString( "CREATE TABLE podcastchannels "
 +                    "(id " + m_sqlStorage->idType() + ","
 +                    "url " + m_sqlStorage->exactTextColumnType() + " UNIQUE,"
 +                    "title " + m_sqlStorage->textColumnType() + ","
 +                    "weblink " + m_sqlStorage->exactTextColumnType() + ","
 +                    "image " + m_sqlStorage->exactTextColumnType() + ","
 +                    "comment " + m_sqlStorage->longTextColumnType() + ","
 +                    "copyright "  + m_sqlStorage->textColumnType() + ","
 +                    "directory "  + m_sqlStorage->textColumnType() + ","
 +                    "labels" + m_sqlStorage->textColumnType() + ","
 +                    "autoscan BOOL, fetchtype INTEGER, "
 +                    "autotransfer BOOL, haspurge BOOL, purgecount
INTEGER );" ) );
 +
 +    m_sqlStorage->query( QString( "CREATE TABLE podcastepisodes ("
 +                    "id " + m_sqlStorage->idType() + ","
 +                    "url " + m_sqlStorage->exactTextColumnType() + " UNIQUE,"
 +                    "localurl " + m_sqlStorage->exactTextColumnType() + ","
 +                    "parent " + m_sqlStorage->exactTextColumnType() + ","
 +                    "guid " + m_sqlStorage->exactTextColumnType() + ","
 +                    "title " + m_sqlStorage->textColumnType() + ","
 +                    "subtitle " + m_sqlStorage->textColumnType() + ","
 +                    "composer " + m_sqlStorage->textColumnType() + ","
 +                    "comment " + m_sqlStorage->longTextColumnType() + ","
 +                    "filetype "  + m_sqlStorage->textColumnType() + ","
 +                    "createdate "  + m_sqlStorage->textColumnType() + ","
 +                    "length INTEGER,"
 +                    "size INTEGER,"
 +                    "isNew BOOL );" ));
 +
 +    m_sqlStorage->query( "CREATE INDEX url_podchannel ON
podcastchannels( url );" );
 +    m_sqlStorage->query( "CREATE INDEX url_podepisode ON
podcastepisodes( url );" );
 +    m_sqlStorage->query( "CREATE INDEX localurl_podepisode ON
podcastepisodes( localurl );" );
 +}
 +
  #include "PodcastCollection.moc"
 --- trunk/extragear/multimedia/amarok/src/podcasts/PodcastCollection.h
#784656:784657
 @@ -30,6 +30,7 @@
  class KUrl;
  class PodcastReader;
  class PodcastChannelProvider;
 +class SqlStorage;

  /**
        @author Bart Cerneels <bart.cerneels at gmail.com>
 @@ -79,6 +80,11 @@
     private:
         static PodcastCollection *s_instance;

 +        /** creates all the necessary tables, indexes etc. for the database */
 +        void createTables() const;
 +
 +        SqlStorage *m_sqlStorage;
 +
         Meta::PodcastChannelList m_channels;
         PodcastChannelProvider *m_channelProvider;


More information about the Amarok-devel mailing list