[banshee] [PlaylistFileUtil] Fix importing of video playlists (bgo#617235)
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [PlaylistFileUtil] Fix importing of video playlists (bgo#617235)
- Date: Wed, 22 Sep 2010 18:00:25 +0000 (UTC)
commit 061ed027ff4c719bddf1f8b4b7888f4e6b9f03c7
Author: Zhou Ting <ting z zhou intel com>
Date: Wed Sep 22 12:59:07 2010 -0500
[PlaylistFileUtil] Fix importing of video playlists (bgo#617235)
Signed-off-by: Gabriel Burt <gabriel burt gmail com>
.../Banshee.Playlist/PlaylistFileUtil.cs | 33 +++++++++++++++++---
1 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs b/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs
index 0b1aea2..146201d 100644
--- a/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs
+++ b/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs
@@ -15,6 +15,7 @@ using Banshee.Sources;
using Banshee.Playlists.Formats;
using Banshee.Collection;
using Banshee.Collection.Database;
+using Banshee.Streaming;
namespace Banshee.Playlist
{
@@ -179,7 +180,7 @@ namespace Banshee.Playlist
public static void ImportPlaylistToLibrary (string path)
{
- ImportPlaylistToLibrary (path, ServiceManager.SourceManager.MusicLibrary, null);
+ ImportPlaylistToLibrary (path, null, null);
}
public static void ImportPlaylistToLibrary (string path, PrimarySource source, DatabaseImportManager importer)
@@ -198,10 +199,32 @@ namespace Banshee.Playlist
uris.Add (((Uri)element["uri"]).LocalPath);
}
- ImportPlaylistWorker worker = new ImportPlaylistWorker (
- parser.Title,
- uris.ToArray (), source, importer);
- worker.Import ();
+ if (source == null) {
+ if (uris.Count > 0) {
+ // Get the media attribute of the 1st Uri in Playlist
+ // and then determine whether the playlist belongs to Video or Music
+ SafeUri uri1 = new SafeUri (uris[0]);
+ var track = new TrackInfo ();
+ StreamTagger.TrackInfoMerge (track, uri1);
+
+ if (track.HasAttribute (TrackMediaAttributes.VideoStream))
+ source = ServiceManager.SourceManager.VideoLibrary;
+ else
+ source = ServiceManager.SourceManager.MusicLibrary;
+ }
+ }
+
+ // Give source a fallback value - MusicLibrary when it's null
+ if (source == null)
+ source = ServiceManager.SourceManager.MusicLibrary;
+
+ // Only import an non-empty playlist
+ if (uris.Count > 0) {
+ ImportPlaylistWorker worker = new ImportPlaylistWorker (
+ parser.Title,
+ uris.ToArray (), source, importer);
+ worker.Import ();
+ }
}
} catch (Exception e) {
Hyena.Log.Exception (e);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]