org.musicontroller.rss
Class RssDAO

java.lang.Object
  extended by org.musicontroller.rss.RssDAO

public class RssDAO
extends java.lang.Object

Class for reading and writing PodCast-RSS.

Author:
Varienaja

Constructor Summary
RssDAO()
           
 
Method Summary
 void merge(Playlist original, Playlist fromrss)
          Merges two Playlists.
 Playlist readPlaylistFromRss(java.io.InputStream in)
          Reads an InputStream (which has to contain a podcast-rss stream), converts it into a Playlist.
 Playlist readPlaylistFromRss(java.lang.String url)
          Reads a Playlist from a URL, which contains a podcast-rss.
 void setDao(Dao dao)
          Set the MusiController-dao, which is used for looking up songs and playlists.
 void updatePlaylist(long playlistid)
          Updates a Playlist with the latest info from the Podcast.
 void writePlaylistRSS(Playlist playlist, java.io.OutputStream out, MetadataProvider provider)
          Writes a Playlist to an Outputstream as a Podcast-xml.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RssDAO

public RssDAO()
Method Detail

readPlaylistFromRss

public Playlist readPlaylistFromRss(java.io.InputStream in)
Reads an InputStream (which has to contain a podcast-rss stream), converts it into a Playlist.

Parameters:
in - The inputstream to read the rss from.
Returns:
The resulting Playlist, or null if this method could make no sense of the input.

readPlaylistFromRss

public Playlist readPlaylistFromRss(java.lang.String url)
Reads a Playlist from a URL, which contains a podcast-rss.

Parameters:
url - The URL to read from.
Returns:
The Playlist, or null if nothing could be read.

writePlaylistRSS

public void writePlaylistRSS(Playlist playlist,
                             java.io.OutputStream out,
                             MetadataProvider provider)
Writes a Playlist to an Outputstream as a Podcast-xml.

Parameters:
playlist - The Playlist to export.
out - The Stream to write the XML data to.
provider - The Provider for metadata to this Playlist and its Songs.

setDao

public void setDao(Dao dao)
Set the MusiController-dao, which is used for looking up songs and playlists.

Parameters:
dao - The Dao.

merge

public void merge(Playlist original,
                  Playlist fromrss)
Merges two Playlists. The original Playlist will be modified such, that afterwards it has the same Songs in it as the fromrss-Playlist. Songs in the fromrss-Playlist that were already known in the Dao, are reused. This means, that the modified original Playlist can be safely persisted to the Database.

Parameters:
original - The original-Playlist.
fromrss - The Playlist that resulted from downloading a Podcast.

updatePlaylist

public void updatePlaylist(long playlistid)
Updates a Playlist with the latest info from the Podcast. This method only succeeds when the parameter points to a Playlist that is a Podcast. Playlists are Podcasts when their Link-property points to a valid URL.

Parameters:
playlistid - The id of the Playlist to update.


Copyright © 2010 A.J.V.. All Rights Reserved.