X-Git-Url: http://git.maemo.org/git/?p=jamaendo;a=blobdiff_plain;f=jamaui%2Futil.py;h=3c82f1776c5be751bf9a09e6d552a2ea43f9b0c3;hp=09904d7a82992fe2d130bedb2e4a37755fcd6df5;hb=e671a4f6b6ab6f73f4052222c259570b8d31567b;hpb=43cb92f722b7710c22d59725cb0adcddcadc0458
diff --git a/jamaui/util.py b/jamaui/util.py
index 09904d7..3c82f17 100644
--- a/jamaui/util.py
+++ b/jamaui/util.py
@@ -1,3 +1,26 @@
+#!/usr/bin/env python
+#
+# This file is part of Jamaendo.
+# Copyright (c) 2010 Kristoffer Gronlund
+#
+# Jamaendo is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Jamaendo is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Jamaendo. If not, see .
+#
+# Player code heavily based on http://thpinfo.com/2008/panucci/:
+# A resuming media player for Podcasts and Audiobooks
+# Copyright (c) 2008-05-26 Thomas Perl
+# (based on http://pygstdocs.berlios.de/pygst-tutorial/seeking.html)
+#
import os
import simplejson
@@ -21,5 +44,15 @@ def get_platform():
platform = get_platform()
-def jsonprint(x):
- print simplejson.dumps(x, sort_keys=True, indent=4)
+#def jsonprint(x):
+# print simplejson.dumps(x, sort_keys=True, indent=4)
+
+def find_resource(name):
+ if os.path.isfile(os.path.join('data', name)):
+ return os.path.join('data', name)
+ elif os.path.isfile(os.path.join('/opt/jamaendo', name)):
+ return os.path.join('/opt/jamaendo', name)
+ elif os.path.isfile(os.path.join('/usr/share/jamaendo', name)):
+ return os.path.join('/usr/share/jamaendo', name)
+ else:
+ return None