import conduit.utils as Utils import conduit.dataproviders.DataProvider as DataProvider import conduit.Exceptions as Exceptions import conduit.datatypes.File as File import conduit.datatypes.Audio as Audio import conduit.datatypes.Video as Video import conduit.datatypes.Photo as Photo from gettext import gettext as _ try: import feedparser MODULES = { "RSSSource" : { "type": "dataprovider" } } log.info("Module Information: %s" % Utils.get_module_information(feedparser, "__version__")) #work around a bug in feedparser where it incorrectly detects #media enclosures #http://code.google.com/p/feedparser/issues/detail?id=100 if feedparser.__version__ <= '4.1': log.info("Patching feedparser issue #100") def _start_media_content(self, attrsD): context = self._getContext() context.setdefault('media_content', []) context['media_content'].append(attrsD) def _start_media_thumbnail(self, attrsD): context = self._getContext() context.setdefault('media_thumbnail', [])
import conduit.Exceptions as Exceptions import conduit.datatypes.Contact as Contact import conduit.datatypes.Event as Event import conduit.datatypes.Note as Note MODULES = {} try: import evolution if evolution.__version__ >= (0,0,4): MODULES = { "EvoContactTwoWay" : { "type": "dataprovider" }, "EvoCalendarTwoWay" : { "type": "dataprovider" }, "EvoTasksTwoWay" : { "type": "dataprovider" }, "EvoMemoTwoWay" : { "type": "dataprovider" }, } log.info("Module Information: %s" % Utils.get_module_information(evolution, '__version__')) except ImportError: log.info("Evolution support disabled") class EvoBase(DataProvider.TwoWay): _configurable_ = True def __init__(self, sourceURI, *args): DataProvider.TwoWay.__init__(self) self.defaultSourceURI = sourceURI self.selectedSourceURI = sourceURI self.allSourceURIs = [] self.uids = None def _get_object(self, uid): raise NotImplementedError
import gobject import gudev import logging log = logging.getLogger("dataproviders.HalFactory") import conduit.utils as Utils import conduit.utils.UDev as UDev import conduit.dataproviders.SimpleFactory as SimpleFactory log.info("Module Information: %s" % Utils.get_module_information(gudev, "__version__")) class HalFactory(SimpleFactory.SimpleFactory): """ Base class for Factories that wish to be notified upon changes to the udev subsystem(s) specified in the UDEV_SUBSYSTEMS class attribute HalFactory.UDEV_SUBSYSTEMS is a list of strings """ UDEV_SUBSYSTEMS = None def __init__(self, **kwargs): SimpleFactory.SimpleFactory.__init__(self, **kwargs) assert hasattr(self.UDEV_SUBSYSTEMS, "__iter__") self.gudev = UDev.UDevHelper(*self.UDEV_SUBSYSTEMS) self.gudev.connect("uevent", self._on_uevent) def _print_device(self, device):
from conduit.datatypes import Rid import conduit.datatypes.File as File from gettext import gettext as _ try: import pyfacebook except ImportError: Utils.dataprovider_add_dir_to_path(__file__) import pyfacebook if pyfacebook.VERSION < '0.1': log.info("Facebook support disabled") MODULES = {} else: log.info("Module Information: %s" % Utils.get_module_information(pyfacebook, 'VERSION')) log.info("Facebook parsing using: %s (%s)" % (pyfacebook.RESPONSE_FORMAT, getattr(pyfacebook, "JSON_MODULE", "N/A"))) MODULES = { "FacebookSink" : { "type": "dataprovider" } } class FacebookSink(Image.ImageSink): _name_ = _("Facebook") _description_ = _("Synchronize your Facebook photos") _module_type_ = "sink" _icon_ = "facebook" _configurable_ = True API_KEY="6ce1868c3292471c022c771c0d4d51ed" SECRET="20e2c82829f1884e40efc616a44e5d1f"
import conduit import conduit.utils as Utils import conduit.TypeConverter as TypeConverter import conduit.datatypes.File as File import conduit.datatypes.Audio as Audio import conduit.datatypes.Video as Video import gobject try: import gst from gst import Pipeline MODULES = {"AudioVideoConverter": {"type": "converter"}} log.info("Module Information: %s" % Utils.get_module_information(gst, "pygst_version")) except ImportError: class Pipeline: pass MODULES = {} log.info("GStreamer transcoding disabled") ''' GStreamer Conversion properties The parameteres to a GStreamer conversion usually require the name of an GStreamer element. All of the availiable elements in a GStreamer installation can be found with the "gst-inspect" command, usually found in the gstreamer-tools package. If an element is missing, it probably requires the bad or ugly packages from
import conduit.datatypes.File as File from gettext import gettext as _ try: import pyfacebook except ImportError: Utils.dataprovider_add_dir_to_path(__file__) import pyfacebook if pyfacebook.VERSION < '0.1': log.info("Facebook support disabled") MODULES = {} else: log.info("Module Information: %s" % Utils.get_module_information(pyfacebook, 'VERSION')) log.info("Facebook parsing using: %s (%s)" % (pyfacebook.RESPONSE_FORMAT, getattr(pyfacebook, "JSON_MODULE", "N/A"))) MODULES = {"FacebookSink": {"type": "dataprovider"}} class FacebookSink(Image.ImageSink): _name_ = _("Facebook") _description_ = _("Synchronize your Facebook photos") _module_type_ = "sink" _icon_ = "facebook" _configurable_ = True API_KEY = "6ce1868c3292471c022c771c0d4d51ed"
MODULES = { "EvoContactTwoWay": { "type": "dataprovider" }, "EvoCalendarTwoWay": { "type": "dataprovider" }, "EvoTasksTwoWay": { "type": "dataprovider" }, "EvoMemoTwoWay": { "type": "dataprovider" }, } log.info("Module Information: %s" % Utils.get_module_information(evolution, '__version__')) if evolution.__version__ <= (2, 2, 2): #Work around bug #561354 import bonobo except ImportError: log.info( "Evolution support disabled (please install evolution bindings)") else: log.info("Evolution not installed") class EvoBase(DataProvider.TwoWay): _configurable_ = True def __init__(self, sourceURI, *args): DataProvider.TwoWay.__init__(self)
import logging log = logging.getLogger("modules.Backpack") import conduit import conduit.utils as Utils import conduit.dataproviders.DataProvider as DataProvider import conduit.Exceptions as Exceptions from conduit.datatypes import Rid import conduit.datatypes.Note as Note Utils.dataprovider_add_dir_to_path(__file__, "backpack") import backpack MODULES = {"BackpackNoteSink": {"type": "dataprovider"}} log.info("Module Information: %s" % Utils.get_module_information(backpack, None)) class BackpackBase(DataProvider.DataProviderBase): _configurable_ = True def __init__(self, *args): DataProvider.DataProviderBase.__init__(self) self.update_configuration(username="", apikey="") self.ba = None self.loggedIn = False def initialize(self): return True def is_configured(self, isSource, isTwoWay):
import conduit.datatypes.Note as Note import conduit.datatypes.Contact as Contact import conduit.datatypes.Event as Event import conduit.datatypes.File as File import conduit.datatypes.Audio as Audio import conduit.datatypes.Video as Video from gettext import gettext as _ errormsg = "" try: import gpod if gpod.version_info >= (0, 6, 0): MODULES = {"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: errormsg = "iPod support disabled" except locale.Error: errormsg = "iPod support disabled (Incorrect locale)" if errormsg: MODULES = {} log.info(errormsg) MEDIATYPE_MUSICVIDEO = 0 MEDIATYPE_MOVIE = 1
import conduit import conduit.utils as Utils import conduit.dataproviders.DataProvider as DataProvider import conduit.Exceptions as Exceptions import conduit.datatypes.File as File import conduit.datatypes.Audio as Audio import conduit.datatypes.Video as Video import conduit.datatypes.Photo as Photo from gettext import gettext as _ try: import feedparser MODULES = {"RSSSource": {"type": "dataprovider"}} log.info("Module Information: %s" % Utils.get_module_information(feedparser, "__version__")) #work around a bug in feedparser where it incorrectly detects #media enclosures #http://code.google.com/p/feedparser/issues/detail?id=100 if feedparser.__version__ <= '4.1': log.info("Patching feedparser issue #100") def _start_media_content(self, attrsD): context = self._getContext() context.setdefault('media_content', []) context['media_content'].append(attrsD) def _start_media_thumbnail(self, attrsD): context = self._getContext() context.setdefault('media_thumbnail', [])
import gobject import gudev import logging log = logging.getLogger("dataproviders.HalFactory") import conduit.utils as Utils import conduit.utils.UDev as UDev import conduit.dataproviders.SimpleFactory as SimpleFactory log.info("Module Information: %s" % Utils.get_module_information(gudev, "__version__")) class HalFactory(SimpleFactory.SimpleFactory): """ Base class for Factories that wish to be notified upon changes to the udev subsystem(s) specified in the UDEV_SUBSYSTEMS class attribute HalFactory.UDEV_SUBSYSTEMS is a list of strings """ UDEV_SUBSYSTEMS = None def __init__(self, **kwargs): SimpleFactory.SimpleFactory.__init__(self, **kwargs) assert hasattr(self.UDEV_SUBSYSTEMS, "__iter__") self.gudev = UDev.UDevHelper(*self.UDEV_SUBSYSTEMS) self.gudev.connect("uevent", self._on_uevent)
import conduit import conduit.utils as Utils import conduit.TypeConverter as TypeConverter import conduit.datatypes.File as File import conduit.datatypes.Audio as Audio import conduit.datatypes.Video as Video import gobject try: import gst from gst import Pipeline MODULES = { "AudioVideoConverter" : { "type": "converter" } } log.info("Module Information: %s" % Utils.get_module_information(gst, "pygst_version")) except ImportError: class Pipeline: pass MODULES = {} log.info("GStreamer transcoding disabled") ''' GStreamer Conversion properties The parameteres to a GStreamer conversion usually require the name of an GStreamer element. All of the availiable elements in a GStreamer installation can be found with the "gst-inspect" command, usually found in the gstreamer-tools package. If an element is missing, it probably requires the bad or ugly packages from GStreamer.
VmSize,VmRSS,VmStack = m.calculate() ok("Memstats: size:%s rss:%s stack:%s" % (VmSize,VmRSS,VmStack), VmSize > 0 and VmRSS > 0 and VmStack > 0) # Test the shiny command line executer conv = CommandLineConverter.CommandLineConverter() conv.build_command("ls %s %s") cmdok,output = conv.convert("/tmp","/dev/null",callback=None,save_output=True) ok("Command executed ok", cmdok == True and len(output) > 0) ok("Simple xml tag extractor", Utils.xml_extract_value_from_tag("tag", "<tag>foo tag bar</tag>") == "foo tag bar") ok("Simple xml tag extractor", Utils.xml_extract_value_from_tag("tag", "<nottag>tag</nottag>") == None) info = Utils.get_module_information(os, None) ok("Library Information: %s" % info, len(info) > 0) info = Utils.get_module_information(sys, 'version_info') ok("System Information: %s" % info, len(info) > 0) class A(Singleton.Singleton): def __init__(self): Singleton.Singleton.__init__(self) self.i = random.random() def num(self): return self.i a1 = A() a2 = A()
log = logging.getLogger("modules.Backpack") import conduit import conduit.utils as Utils import conduit.dataproviders.DataProvider as DataProvider import conduit.Exceptions as Exceptions from conduit.datatypes import Rid import conduit.datatypes.Note as Note Utils.dataprovider_add_dir_to_path(__file__, "backpack") import backpack MODULES = { "BackpackNoteSink" : { "type": "dataprovider" } } log.info("Module Information: %s" % Utils.get_module_information(backpack, None)) class BackpackBase(DataProvider.DataProviderBase): _configurable_ = True def __init__(self, *args): DataProvider.DataProviderBase.__init__(self) self.update_configuration( username = "", apikey = "" ) self.ba = None self.loggedIn = False def initialize(self): return True
import conduit.datatypes.Event as Event import conduit.datatypes.File as File import conduit.datatypes.Audio as Audio import conduit.datatypes.Video as Video from gettext import gettext as _ errormsg = "" try: import gpod if gpod.version_info >= (0,7,0): MODULES = { "iPodFactory" : { "type": "dataprovider-factory" }, "iPhoneFactory" : { "type": "dataprovider-factory" }, } log.info("Module Information: %s" % Utils.get_module_information(gpod, 'version_info')) except ImportError: errormsg = "iPod support disabled (python-gpod not availiable)" except locale.Error: errormsg = "iPod support disabled (Incorrect locale)" PROPS_KEY_MOUNT = "CONDUIT_MOUNTPOINT" PROPS_KEY_NAME = "CONDUIT_NAME" PROPS_KEY_ICON = "CONDUIT_ICON" if errormsg: MODULES = {} log.warn(errormsg) #Solve the initialization problem without gpod class gpod(): ITDB_MEDIATYPE_MUSICVIDEO = 0