Adding magazine covers
[watersofshiloah] / src / mormonchannel_gtk.py
index aa31895..7c570cd 100755 (executable)
@@ -2,22 +2,26 @@
 # -*- coding: utf-8 -*-
 
 """
-@todo Implement Jump TO
-@todo Implement highlighting of current track
-@todo Restructure so there is a windows/ folder with a file per source
-@todo Add additional sources
-@bug All connect's need disconnects or else we will leak a bunch of objects
-@todo Track recent
+@bug Fix segfault on closing of window while playing
+@todo Need to confirm id's are persistent (not just for todos but broken behavior on transition)
+       @todo Track recent
+       @todo Persisted Pause
+       @todo Favorites
+@todo Sleep timer
 @todo Reverse order option.  Toggle between playing ascending/descending chronological order
+@todo Podcast integration
 """
 
 from __future__ import with_statement
 
+import os
 import gc
 import logging
 import ConfigParser
 
 import gobject
+import dbus
+import dbus.mainloop.glib
 import gtk
 
 try:
@@ -31,7 +35,7 @@ import util.misc as misc_utils
 
 import imagestore
 import player
-import index
+import stream_index
 import windows
 
 
@@ -43,13 +47,15 @@ class MormonChannelProgram(hildonize.get_app_class()):
 
        def __init__(self):
                super(MormonChannelProgram, self).__init__()
-               self._store = imagestore.ImageStore("../data", "../data")
-               self._index = index.AudioIndex()
+               currentPath = os.path.abspath(__file__)
+               storePath = os.path.join(os.path.split(os.path.dirname(currentPath))[0], "data")
+               self._store = imagestore.ImageStore(storePath, constants._cache_path_)
+               self._index = stream_index.AudioIndex()
                self._player = player.Player(self._index)
 
+               self._store.start()
                self._index.start()
                try:
-
                        if not hildonize.IS_HILDON_SUPPORTED:
                                _moduleLogger.info("No hildonization support")
 
@@ -62,12 +68,13 @@ class MormonChannelProgram(hildonize.get_app_class()):
                                self._osso_c = None
                                self._deviceState = None
 
-                       self._sourceSelector = windows.SourceSelector(self._player, self._store, self._index)
+                       self._sourceSelector = windows.source.SourceSelector(self._player, self._store, self._index)
                        self._sourceSelector.window.connect("destroy", self._on_destroy)
                        self._sourceSelector.show()
                        self._load_settings()
                except:
                        self._index.stop()
+                       self._store.stop()
                        raise
 
        def _save_settings(self):
@@ -106,6 +113,7 @@ class MormonChannelProgram(hildonize.get_app_class()):
                        self._save_settings()
 
                        self._index.stop()
+                       self._store.stop()
 
                        try:
                                self._deviceState.close()
@@ -136,6 +144,7 @@ class MormonChannelProgram(hildonize.get_app_class()):
 def run():
        gobject.threads_init()
        gtk.gdk.threads_init()
+       l = dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 
        hildonize.set_application_title(constants.__pretty_app_name__)
        app = MormonChannelProgram()