conduit r1805 - in trunk: . conduit/modules/iPodModule
- From: jstowers svn gnome org
- To: svn-commits-list gnome org
- Subject: conduit r1805 - in trunk: . conduit/modules/iPodModule
- Date: Sun, 18 Jan 2009 23:50:58 +0000 (UTC)
Author: jstowers
Date: Sun Jan 18 23:50:58 2009
New Revision: 1805
URL: http://svn.gnome.org/viewvc/conduit?rev=1805&view=rev
Log:
2009-01-19 John Stowers <john stowers gmail com>
* conduit/modules/iPodModule/iPodModule.py: Dont crash when
python-gpod is not installed
Modified:
trunk/ChangeLog
trunk/conduit/modules/iPodModule/iPodModule.py
Modified: trunk/conduit/modules/iPodModule/iPodModule.py
==============================================================================
--- trunk/conduit/modules/iPodModule/iPodModule.py (original)
+++ trunk/conduit/modules/iPodModule/iPodModule.py Sun Jan 18 23:50:58 2009
@@ -35,6 +35,7 @@
from gettext import gettext as _
+errormsg = ""
try:
import gpod
if gpod.version_info >= (0,6,0):
@@ -42,12 +43,24 @@
"iPodFactory" : { "type": "dataprovider-factory" },
}
log.info("Module Information: %s" % Utils.get_module_information(gpod, 'version_info'))
+ MEDIATYPE_MUSICVIDEO = gpod.ITDB_MEDIATYPE_MUSICVIDEO
+ MEDIATYPE_MOVIE = gpod.ITDB_MEDIATYPE_MOVIE
+ MEDIATYPE_TVSHOW = gpod.ITDB_MEDIATYPE_TVSHOW
+ MEDIATYPE_AUDIO = gpod.ITDB_MEDIATYPE_AUDIO
+ MEDIATYPE_PODCAST = gpod.ITDB_MEDIATYPE_PODCAST
except ImportError:
- MODULES = {}
- log.info("iPod support disabled")
+ errormsg = "iPod support disabled"
except locale.Error:
+ errormsg = "iPod support disabled (Incorrect locale)"
+
+if errormsg:
MODULES = {}
- log.info("iPod support disabled (Incorrect locale)")
+ log.info(errormsg)
+ MEDIATYPE_MUSICVIDEO = 0
+ MEDIATYPE_MOVIE = 1
+ MEDIATYPE_TVSHOW = 2
+ MEDIATYPE_AUDIO = 3
+ MEDIATYPE_PODCAST = 4
def _string_to_unqiue_file(txt, base_uri, prefix, postfix=''):
for i in range(1, 10000):
@@ -574,7 +587,7 @@
def set_info_from_audio(self, audio):
self.set_info_from_file(audio)
- self.track['mediatype'] = gpod.ITDB_MEDIATYPE_AUDIO
+ self.track['mediatype'] = MEDIATYPE_AUDIO
cover_location = audio.get_audio_cover_location()
if cover_location:
self.track.set_coverart_from_file(str(cover_location))
@@ -589,10 +602,10 @@
def set_info_from_video(self, video):
self.set_info_from_file(video)
- self.track['mediatype'] = {'movie': gpod.ITDB_MEDIATYPE_MOVIE,
- 'musicvideo': gpod.ITDB_MEDIATYPE_MUSICVIDEO,
- 'tvshow': gpod.ITDB_MEDIATYPE_TVSHOW,
- 'podcast': gpod.ITDB_MEDIATYPE_PODCAST
+ self.track['mediatype'] = {'movie': MEDIATYPE_MOVIE,
+ 'musicvideo': MEDIATYPE_MUSICVIDEO,
+ 'tvshow': MEDIATYPE_TVSHOW,
+ 'podcast': MEDIATYPE_PODCAST
} [self.video_kind]
class DBCache:
@@ -812,7 +825,7 @@
_icon_ = "audio-x-generic"
_configurable_ = True
- _mediatype_ = (gpod.ITDB_MEDIATYPE_AUDIO,)
+ _mediatype_ = (MEDIATYPE_AUDIO,)
_mediafile_ = Audio.Audio
_ipodmedia_ = IPodAudio
@@ -847,9 +860,7 @@
_icon_ = "video-x-generic"
_configurable_ = True
- _mediatype_ = (gpod.ITDB_MEDIATYPE_MUSICVIDEO,
- gpod.ITDB_MEDIATYPE_MOVIE,
- gpod.ITDB_MEDIATYPE_TVSHOW)
+ _mediatype_ = (MEDIATYPE_MUSICVIDEO, MEDIATYPE_MOVIE, MEDIATYPE_TVSHOW)
_mediafile_ = Video.Video
_ipodmedia_ = IPodVideo
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]