QML: QML mussorgsky in its own folder
authorIvan Frade <ivan.frade@nokia.com>
Tue, 5 Apr 2011 07:51:43 +0000 (10:51 +0300)
committerIvan Frade <ivan.frade@nokia.com>
Tue, 5 Apr 2011 07:53:04 +0000 (10:53 +0300)
src/mussorgsky-qml.py [deleted file]
src/qml/__init__.py [deleted file]
src/qml/aa_search.py
src/qml/aa_spec.py [new file with mode: 0644]
src/qml/album_art_spec.py [deleted file]
src/qml/controller.py
src/qml/mussorgsky-qml.py [new file with mode: 0644]

diff --git a/src/mussorgsky-qml.py b/src/mussorgsky-qml.py
deleted file mode 100644 (file)
index 223fd7a..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-import sys
-from PySide.QtCore import *
-from PySide.QtGui import *
-from PySide.QtDeclarative import QDeclarativeView
-
-from qml.albumModel import AlbumModel
-from qml.controller import MussorgskyController
-from qml.coverModel import CoversModel
-
-# Create Qt application and the QDeclarative view
-app = QApplication(sys.argv)
-view = QDeclarativeView()
-
-
-#MOCK_DATA = [
-#     AlbumItem ("Are you experienced?", "Jimy Hendrix", None),
-#     AlbumItem ("Bring them all back home", "Bob dylan", None),
-#     AlbumItem ("OK computer", "Radiohead", None),
-#     AlbumItem ("Absolution", "Muse", None),
-#     AlbumItem ("Come with us", "Chemical brothers", None)
-#    ]
-
-
-controller = MussorgskyController ()
-albumModel = AlbumModel (controller.get_all_albums())
-print "Model with", albumModel.rowCount(), "rows"
-
-coverModel = CoversModel ()
-
-rc = view.rootContext ()
-rc.setContextProperty ('albumModel', albumModel)
-rc.setContextProperty ('missionControl', controller)
-rc.setContextProperty ('coversModel', coverModel)
-# Create an URL to the QML file
-#url = QUrl('view.qml')
-url = QUrl ("../ui/main.qml")
-# Set the QML file and show
-view.setSource(url)
-
-
-view.show()
-# Enter Qt main loop
-sys.exit(app.exec_())
diff --git a/src/qml/__init__.py b/src/qml/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
index 4a92b40..ba65244 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python2.5
 import os
-from album_art_spec import getCoverArtFileName, getCoverArtThumbFileName, get_thumb_filename_for_path
+from aa_spec import getCoverArtFileName, getCoverArtThumbFileName, get_thumb_filename_for_path
 from utils import UrllibWrapper
 import dbus, time
 import string
diff --git a/src/qml/aa_spec.py b/src/qml/aa_spec.py
new file mode 100644 (file)
index 0000000..512a9d0
--- /dev/null
@@ -0,0 +1,55 @@
+import os
+import md5
+import unicodedata
+import string
+
+COVERS_LOCATION = os.getenv ("HOME") + "/.cache/media-art/"
+THUMBS_LOCATION = os.getenv ("HOME") + "/.thumbnails/cropped/"
+
+# Hardcoded locations for testing in scratchbox 
+#
+#COVERS_LOCATION = "/home/user/.cache/media-art/"
+#THUMBS_LOCATION = "/home/user/.thumbnails/cropped/"
+
+# Do this only once...
+import ctypes
+clib = ctypes.CDLL ("libhildonthumbnail.so.0")
+
+album_art_func = clib.hildon_albumart_get_path
+album_art_func.restype = ctypes.c_char_p
+
+def getCoverArtFileName (album):
+    return album_art_func (None, album, "album")
+    
+def getCoverArtThumbFileName (album):
+    artFile = getCoverArtFileName (album)
+    if not artFile.startswith ("file://"):
+        artFile = "file://" + artFile
+    thumbFile = THUMBS_LOCATION + md5.new (artFile).hexdigest() + ".jpeg"
+    return thumbFile
+
+def get_thumb_filename_for_path (path):
+    if not path.startswith ("file://"):
+        path = "file://" + path
+    thumbnail = THUMBS_LOCATION + md5.new (path).hexdigest () + ".jpeg"
+    return thumbnail
+
+if __name__ == "__main__":
+    import sys
+    from optparse import OptionParser
+
+    parser = OptionParser()
+    parser.add_option ("-a", "--artist", dest="artist", type="string",
+                       help="ARTIST to look for", metavar="ARTIST")
+    parser.add_option ("-b", "--album", dest="album", type="string",
+                       help="ALBUM to look for", metavar="ALBUM")
+
+    (options, args) = parser.parse_args ()
+    print options
+    if (not options.artist and not options.album):
+        parser.print_help ()
+        sys.exit (-1)
+
+    print "Album art        :", getCoverArtFileName (options.album)
+    print "Thumbnail (album):", getCoverArtThumbFileName (options.album)
+    print "Thumbnail (path) :", get_thumb_filename_for_path (getCoverArtFileName(options.album))
diff --git a/src/qml/album_art_spec.py b/src/qml/album_art_spec.py
deleted file mode 100644 (file)
index 512a9d0..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-import os
-import md5
-import unicodedata
-import string
-
-COVERS_LOCATION = os.getenv ("HOME") + "/.cache/media-art/"
-THUMBS_LOCATION = os.getenv ("HOME") + "/.thumbnails/cropped/"
-
-# Hardcoded locations for testing in scratchbox 
-#
-#COVERS_LOCATION = "/home/user/.cache/media-art/"
-#THUMBS_LOCATION = "/home/user/.thumbnails/cropped/"
-
-# Do this only once...
-import ctypes
-clib = ctypes.CDLL ("libhildonthumbnail.so.0")
-
-album_art_func = clib.hildon_albumart_get_path
-album_art_func.restype = ctypes.c_char_p
-
-def getCoverArtFileName (album):
-    return album_art_func (None, album, "album")
-    
-def getCoverArtThumbFileName (album):
-    artFile = getCoverArtFileName (album)
-    if not artFile.startswith ("file://"):
-        artFile = "file://" + artFile
-    thumbFile = THUMBS_LOCATION + md5.new (artFile).hexdigest() + ".jpeg"
-    return thumbFile
-
-def get_thumb_filename_for_path (path):
-    if not path.startswith ("file://"):
-        path = "file://" + path
-    thumbnail = THUMBS_LOCATION + md5.new (path).hexdigest () + ".jpeg"
-    return thumbnail
-
-if __name__ == "__main__":
-    import sys
-    from optparse import OptionParser
-
-    parser = OptionParser()
-    parser.add_option ("-a", "--artist", dest="artist", type="string",
-                       help="ARTIST to look for", metavar="ARTIST")
-    parser.add_option ("-b", "--album", dest="album", type="string",
-                       help="ALBUM to look for", metavar="ALBUM")
-
-    (options, args) = parser.parse_args ()
-    print options
-    if (not options.artist and not options.album):
-        parser.print_help ()
-        sys.exit (-1)
-
-    print "Album art        :", getCoverArtFileName (options.album)
-    print "Thumbnail (album):", getCoverArtThumbFileName (options.album)
-    print "Thumbnail (path) :", get_thumb_filename_for_path (getCoverArtFileName(options.album))
index 1393d98..c0f8d16 100644 (file)
@@ -10,7 +10,7 @@ from aa_search import MussorgskyAlbumArt
 from tracker_backend_gi import TrackerBackendGI
 
 from albumItem import AlbumItem
-from album_art_spec import getCoverArtThumbFileName
+from aa_spec import getCoverArtThumbFileName
 
 
 class DownloadThread (QtCore.QThread):
diff --git a/src/qml/mussorgsky-qml.py b/src/qml/mussorgsky-qml.py
new file mode 100644 (file)
index 0000000..cf099a5
--- /dev/null
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+import sys
+from PySide.QtCore import *
+from PySide.QtGui import *
+from PySide.QtDeclarative import QDeclarativeView
+
+from albumModel import AlbumModel
+from controller import MussorgskyController
+from coverModel import CoversModel
+
+# Create Qt application and the QDeclarative view
+app = QApplication(sys.argv)
+view = QDeclarativeView()
+
+
+#MOCK_DATA = [
+#     AlbumItem ("Are you experienced?", "Jimy Hendrix", None),
+#     AlbumItem ("Bring them all back home", "Bob dylan", None),
+#     AlbumItem ("OK computer", "Radiohead", None),
+#     AlbumItem ("Absolution", "Muse", None),
+#     AlbumItem ("Come with us", "Chemical brothers", None)
+#    ]
+
+
+controller = MussorgskyController ()
+albumModel = AlbumModel (controller.get_all_albums())
+print "Model with", albumModel.rowCount(), "rows"
+
+coverModel = CoversModel ()
+
+rc = view.rootContext ()
+rc.setContextProperty ('albumModel', albumModel)
+rc.setContextProperty ('missionControl', controller)
+rc.setContextProperty ('coversModel', coverModel)
+# Create an URL to the QML file
+#url = QUrl('view.qml')
+url = QUrl ("../../ui/main.qml")
+# Set the QML file and show
+view.setSource(url)
+
+
+view.show()
+# Enter Qt main loop
+sys.exit(app.exec_())