[gnome-music/freeze-break: 67/107] playlists: Add method for parsing playlists



commit 178345af0af835cf1100ffb0869f60010f5f5f53
Author: Arnel A. Borja <arnelborja src gnome org>
Date:   Wed Sep 4 22:19:42 2013 +0800

    playlists: Add method for parsing playlists

 gnomemusic/playlists.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gnomemusic/playlists.py b/gnomemusic/playlists.py
index e471c38..6e007fc 100644
--- a/gnomemusic/playlists.py
+++ b/gnomemusic/playlists.py
@@ -1,4 +1,5 @@
 from gi.repository import TotemPlParser, GLib, Gio
+from gnomemusic.grilo import grilo
 
 import os
 
@@ -50,3 +51,14 @@ class Playlists:
 
     def get_path_to_playlist(self, playlist_name):
         return os.path.join(self.playlist_dir, playlist_name + ".pls")
+
+    def parse_playlist(self, playlist_name, callback):
+        parser = TotemPlParser.Parser()
+        parser.connect('entry-parsed', self._on_entry_parsed, callback)
+        parser.parse_async(
+            GLib.filename_to_uri(self.get_path_to_playlist(playlist_name), None),
+            False, None, None, None
+        )
+
+    def _on_entry_parsed(self, parser, uri, metadata, data=None):
+        grilo.get_media_from_uri(uri, data)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]