コード例 #1
0
    def test_add_talks_from_rss(self):
        """Test that talks are retrieved from the RSS feed"""

        feed1 = "http://fosslc.org/drupal/presentations_rss/summercamp2010"
        feed2 = "http://fosslc.org/drupal/presentations_rss/sc2011"

        presentation1 = Presentation("Managing map data in a database", "Andrew Ross")
        presentation2 = Presentation("Building NetBSD", "David Maxwell")

        self.db.add_talks_from_rss(feed1)
        self.assertTrue(self.db.presentation_exists(presentation1))

        self.db.add_talks_from_rss(feed2)
        self.assertTrue(self.db.presentation_exists(presentation2))
コード例 #2
0
 def setUpClass(cls):
     cls.presentations = []
     cls.presentations.append(
         Presentation(
             "test title 1",
             "test speaker",
             "test room",
             "test event",
         ))
     cls.presentations.append(
         Presentation(
             "test title 2",
             "test speaker",
             "test room",
             "test event",
         ))
コード例 #3
0
ファイル: talkeditor.py プロジェクト: riolowry/freeseer
    def add_talk(self):
        date = self.addTalkWidget.dateEdit.date()
        time = self.addTalkWidget.timeEdit.time()
        datetime = QDateTime(date, time)
        presentation = Presentation(
            unicode(self.addTalkWidget.titleLineEdit.text()),
            unicode(self.addTalkWidget.presenterLineEdit.text()),
            "",  # description
            "",  # level
            unicode(self.addTalkWidget.eventLineEdit.text()),
            unicode(self.addTalkWidget.roomLineEdit.text()),
            unicode(datetime.toString(Qt.ISODate)))

        # Do not add talks if they are empty strings
        if (len(presentation.title) == 0):
            return

        self.db.insert_presentation(presentation)

        # cleanup
        self.addTalkWidget.titleLineEdit.clear()
        self.addTalkWidget.presenterLineEdit.clear()

        self.presentationModel.select()

        self.hide_add_talk_widget()

        # If this is launched from the recording app
        # refresh the talk list
        if self.recordapp:
            self.recordapp.load_event_list()
コード例 #4
0
ファイル: talkeditor.py プロジェクト: mtomwing/freeseer
    def add_talk(self):
        date = self.talkDetailsWidget.dateEdit.date()
        time = self.talkDetailsWidget.timeEdit.time()
        #datetime = QtCore.QDateTime(date, time)
        presentation = Presentation(
            unicode(self.talkDetailsWidget.titleLineEdit.text()).strip(),
            unicode(self.talkDetailsWidget.presenterLineEdit.text()).strip(),
            unicode(self.talkDetailsWidget.descriptionTextEdit.toPlainText()).strip(),
            unicode(self.talkDetailsWidget.categoryLineEdit.text()).strip(),
            unicode(self.talkDetailsWidget.eventLineEdit.text()).strip(),
            unicode(self.talkDetailsWidget.roomLineEdit.text()).strip(),
            unicode(date.toString(QtCore.Qt.ISODate)),
            unicode(time.toString(QtCore.Qt.ISODate)))

        # Do not add talks if they are empty strings
        if (len(presentation.title) == 0):
            return
        self.db.insert_presentation(presentation)

        # Update Model, Refreshes TableView
        self.presentationModel.select()

        # Select Last Row
        self.tableView.selectRow(self.presentationModel.rowCount() - 1)
        self.tableView.setCurrentIndex(self.proxy.index(self.proxy.rowCount() - 1, 0))
        self.talk_selected(self.proxy.index(self.proxy.rowCount() - 1, 0))

        self.update_autocomple_fields()
        self.talkDetailsWidget.disable_input_fields()
コード例 #5
0
ファイル: reporteditor.py プロジェクト: bossjones/freeseer
    def add_talk(self):
        date = self.addTalkWidget.dateEdit.date()
        startTime = self.addTalkWidget.startTimeEdit.time()
        datetime = QDateTime(date,
                             startTime)  # original "time" is now "startTime"
        presentation = Presentation(
            unicode(self.addTalkWidget.titleLineEdit.text()),
            unicode(self.addTalkWidget.presenterLineEdit.text()),
            "",  # description
            "",  # level
            unicode(self.addTalkWidget.eventLineEdit.text()),
            unicode(self.addTalkWidget.roomLineEdit.text()),
            unicode(datetime.toString()),
            unicode(self.addTalkWidget.endTimeEdit.text()))

        # Do not add talks if they are empty strings
        if (len(presentation.title) == 0):
            return

        self.db.insert_presentation(presentation)

        # cleanup
        self.addTalkWidget.titleLineEdit.clear()
        self.addTalkWidget.presenterLineEdit.clear()

        self.failureModel.select()

        self.hide_add_talk_widget()
コード例 #6
0
    def test_add_talks_from_csv(self):
        """Test that talks are retrieved from the CSV file"""

        fname = self._csvfile

        presentation = Presentation("Building NetBSD", "David Maxwell")

        self.db.add_talks_from_csv(fname)
        self.assertTrue(self.db.presentation_exists(presentation))
コード例 #7
0
ファイル: database.py プロジェクト: michaelbrawn/freeseer
    def add_talks_from_csv(self, fname):
        """Adds talks from a csv file.

        Title and speaker must be present.
        """
        file = open(fname, 'r')
        try:
            reader = csv.DictReader(file)
            for row in reader:
                try:
                    title   = unicode(row['Title'], 'utf-8')
                    speaker = unicode(row['Speaker'], 'utf-8')
                except KeyError:
                    log.error("Missing Key in Row: %s", row)
                    return

                try:
                    abstract = unicode(row['Abstract'], 'utf-8')  # Description
                except KeyError:
                    abstract = ''

                try:
                    level = unicode(row['Level'], 'utf-8')
                except KeyError:
                    level = ''

                try:
                    event = unicode(row['Event'], 'utf-8')
                except KeyError:
                    event = ''

                try:
                    room = unicode(row['Room'], 'utf-8')
                except KeyError:
                    room = ''

                try:
                    time = unicode(row['Time'], 'utf-8')
                except KeyError:
                    time = ''

                talk = Presentation(title,
                                    speaker,
                                    abstract,
                                    level,
                                    event,
                                    room,
                                    time)
                self.insert_presentation(talk)

        except IOError:
            log.error("CSV: File %s not found", file)

        finally:
            file.close()
コード例 #8
0
ファイル: database.py プロジェクト: michaelbrawn/freeseer
 def __insert_default_talk(self):
     """
     Insert the default talk data into the database.
     """
     presentation = Presentation("Intro to Freeseer",
                                 "Thanh Ha",
                                 "",
                                 "",
                                 "SC2011",
                                 "T105",
                                 "")
     self.insert_presentation(presentation)
コード例 #9
0
 def update_talk_by_prompt(self, id): 
     presentation = self.db.get_presentation(id)
     if presentation:                  
         print "#### You have choosen to edit the following talk ###"
         
         self.show_talk_by_id(id)     
                             
         new_title = raw_input("Type the new presentation title (<ENTER> to keep old data): ")
         title = new_title if len(new_title) > 0 else presentation.title
             
         new_speaker = raw_input("Type the new presentation speaker (<ENTER> to keep old data): ")
         speaker = new_speaker if len(new_speaker) > 0 else presentation.speaker
             
         new_room = raw_input("Type the new room where the presentation will be performed (<ENTER> to keep old data): ")  
         room = new_room if len(new_room) > 0 else presentation.room
         
         new_event = raw_input("Type the new event that held the presentation (<ENTER> to keep old data): ")
         event = new_event if len(new_event) > 0 else presentation.event
             
         
         
         new_presentation = Presentation("")
         
         new_presentation.talk_id = id
         new_presentation.title = title
         new_presentation.speaker = speaker
         new_presentation.event = event
         new_presentation.room = room
         
         self.db.update_presentation(id, new_presentation)
         
         print "### Talk Updated! ###"
         
     else:
         print "There's no such presentation"
コード例 #10
0
    def load_backend(self):
        """Prepares the backend for recording"""
        if self.current_presentation():
            presentation = self.current_presentation()

        # If current presentation is no existant (empty talk database)
        # use a default recording name.
        else:
            presentation = Presentation(title=unicode("default"))

        if self.controller.load_backend(presentation):
            return True
        else:
            return False  # Error something failed while loading the backend
コード例 #11
0
ファイル: database.py プロジェクト: yiqideren/freeseer
    def add_talks_from_csv(self, fname):
        """Adds talks from a csv file.

        Title and speaker must be present.
        """
        plugin = self.plugman.get_plugin_by_name("CSV Importer", "Importer")
        importer = plugin.plugin_object
        presentations = importer.get_presentations(fname)

        if presentations:
            for presentation in presentations:
                if presentation['Time']:
                    talk = Presentation(
                        presentation["Title"],
                        presentation["Speaker"],
                        presentation["Abstract"],  # Description
                        presentation["Level"],
                        presentation["Event"],
                        presentation["Room"],
                        presentation["Time"],
                        presentation["Time"]
                    )  # Presentation using legacy time field
                else:
                    talk = Presentation(
                        presentation["Title"],
                        presentation["Speaker"],
                        presentation["Abstract"],  # Description
                        presentation["Level"],
                        presentation["Event"],
                        presentation["Room"],
                        presentation["Date"],
                        presentation["StartTime"],
                        presentation["EndTime"])
                self.insert_presentation(talk)

        else:
            log.info("CSV: No data found.")
コード例 #12
0
 def get_presentation(self, talk_id):
     """Returns a Presentation object associated to a talk_id"""
     result = QtSql.QSqlQuery('''SELECT * FROM presentations WHERE Id="%s"''' % talk_id)
     if result.next():
         return Presentation(title=unicode(result.value(1).toString()),
                          speaker=unicode(result.value(2).toString()),
                          description=unicode(result.value(3).toString()),
                          category=unicode(result.value(4).toString()),
                          event=unicode(result.value(5).toString()),
                          room=unicode(result.value(6).toString()),
                          date=unicode(result.value(7).toString()),
                          startTime=unicode(result.value(8).toString()),
                          endTime=unicode(result.value(9).toString()))
     else:
         return None
コード例 #13
0
ファイル: database.py プロジェクト: michaelbrawn/freeseer
    def get_presentation(self, talk_id):
        """
        Return a Presentation object associated to a talk_id.
        """
        result = QtSql.QSqlQuery('''SELECT * FROM presentations WHERE Id="%s"''' % talk_id)
        if result.next():
            p = Presentation(unicode(result.value(1).toString()),    # title
                             unicode(result.value(2).toString()),    # speaker
                             unicode(result.value(3).toString()),    # description
                             unicode(result.value(4).toString()),    # level
                             unicode(result.value(5).toString()),    # event
                             unicode(result.value(6).toString()),    # room
                             unicode(result.value(7).toString()))    # time
        else:
            p = None

        return p
コード例 #14
0
ファイル: talkeditor.py プロジェクト: Noodle1550/freeseer
    def create_presentation(self, talkDetailsWidget):
        """Creates and returns an instance of Presentation using data from the input fields"""
        date = talkDetailsWidget.dateEdit.date()
        startTime = talkDetailsWidget.startTimeEdit.time()
        endTime = talkDetailsWidget.endTimeEdit.time()

        title = unicode(talkDetailsWidget.titleLineEdit.text()).strip()
        if title:
            return Presentation(
                unicode(talkDetailsWidget.titleLineEdit.text()).strip(),
                unicode(talkDetailsWidget.presenterLineEdit.text()).strip(),
                unicode(talkDetailsWidget.descriptionTextEdit.toPlainText()).strip(),
                unicode(talkDetailsWidget.categoryLineEdit.text()).strip(),
                unicode(talkDetailsWidget.eventLineEdit.text()).strip(),
                unicode(talkDetailsWidget.roomLineEdit.text()).strip(),
                unicode(date.toString(Qt.ISODate)),
                unicode(startTime.toString(Qt.ISODate)),
                unicode(endTime.toString(Qt.ISODate)))
コード例 #15
0
ファイル: database.py プロジェクト: michaelbrawn/freeseer
    def add_talks_from_rss(self, rss):
        """Adds talks from an rss feed."""
        entry = str(rss)
        feedparser = FeedParser(entry)

        if len(feedparser.build_data_dictionary()) == 0:
            log.info("RSS: No data found.")

        else:
            for presentation in feedparser.build_data_dictionary():
                talk = Presentation(presentation["Title"],
                                    presentation["Speaker"],
                                    presentation["Abstract"],  # Description
                                    presentation["Level"],
                                    presentation["Event"],
                                    presentation["Room"],
                                    presentation["Time"])
                self.insert_presentation(talk)
コード例 #16
0
ファイル: database.py プロジェクト: mtomwing/freeseer
    def add_talks_from_rss(self, feed_url):
        """Adds talks from an rss feed."""
        plugin = self.plugman.get_plugin_by_name("Rss FeedParser", "Importer")
        feedparser = plugin.plugin_object
        presentations = feedparser.get_presentations(feed_url)

        if presentations:
            for presentation in presentations:
                talk = Presentation(
                    presentation["Title"],
                    presentation["Speaker"],
                    presentation["Abstract"],  # Description
                    presentation["Level"],
                    presentation["Event"],
                    presentation["Room"],
                    presentation["Time"])
                self.insert_presentation(talk)

        else:
            log.info("RSS: No data found.")
コード例 #17
0
    def setUp(self):
        '''
        Generic unittest.TestCase.setUp()
        '''

        self.pres = Presentation("John Doe", event="haha", time="NOW")
コード例 #18
0
ファイル: multimedia.py プロジェクト: Cryspia/freeseer
    def load_backend(self, presentation=None, filename=None):
        log.debug("Loading Output plugins...")

        filename_for_frontend = None

        load_plugins = []

        if self.config.record_to_file:
            p = self.plugman.get_plugin_by_name(self.config.record_to_file_plugin, "Output")
            load_plugins.append(p)

        if self.config.record_to_stream:
            p = self.plugman.get_plugin_by_name(self.config.record_to_stream_plugin, "Output")
            load_plugins.append(p)

        if self.config.audio_feedback and not self.cli:
            p = self.plugman.get_plugin_by_name("Audio Feedback", "Output")
            load_plugins.append(p)

        if self.config.video_preview and not self.cli:
            p = self.plugman.get_plugin_by_name("Video Preview", "Output")
            load_plugins.append(p)

        plugins = []
        for plugin in load_plugins:
            log.debug("Loading Output: %s", plugin.plugin_object.get_name())

            extension = plugin.plugin_object.get_extension()

            # Create a filename to record to.
            if presentation is None and filename is not None:
                record_name = get_record_name(extension, filename=filename, path=self.config.videodir)
                presentation = Presentation(filename)
            elif presentation is not None:
                record_name = get_record_name(extension, presentation=presentation, path=self.config.videodir)
            else:
                # Invalid combination you must pass in a presentation or a filename
                logging.error("Failed to configure recording name. No presentation or filename provided.")
                return False

            # This is to ensure that we don't log a message when extension is None
            if extension is not None:
                log.info('Set record name to %s', record_name)
                filename_for_frontend = record_name

            # Prepare metadata.
            metadata = self.prepare_metadata(presentation)
            #self.populate_metadata(data)

            record_location = os.path.abspath(self.config.videodir + '/' + record_name)
            plugin.plugin_object.set_recording_location(record_location)

            plugin.plugin_object.load_config(self.plugman)
            plugins.append(plugin.plugin_object)

        if not self.load_output_plugins(plugins,
                                        self.config.enable_audio_recording,
                                        self.config.enable_video_recording,
                                        metadata):
            # Loading Output plugins failed, abort
            return False

        if self.config.enable_audio_recording:
            log.debug("Loading Audio Recording plugins...")
            audiomixer = self.plugman.get_plugin_by_name(self.config.audiomixer, "AudioMixer").plugin_object
            if audiomixer is not None:
                audiomixer.load_config(self.plugman)

                # Get audio mixer inputs bins.
                audiomixer_inputs = []

                audioinputs = audiomixer.get_inputs()
                for name, instance in audioinputs:
                    log.debug("Loading Audio Mixer Input: %s-%d", name, instance)
                    audio_input = self.plugman.get_plugin_by_name(name, "AudioInput").plugin_object
                    audio_input.set_instance(instance)
                    audio_input.load_config(self.plugman)
                    audiomixer_inputs.append(audio_input.get_audioinput_bin())

                if not self.load_audiomixer(audiomixer, audiomixer_inputs):
                    # Loading AudioMixer failed, abort
                    self.unload_output_plugins()
                    return False

        if self.config.enable_video_recording:
            log.debug("Loading Video Recording plugins...")
            videomixer = self.plugman.get_plugin_by_name(self.config.videomixer, "VideoMixer").plugin_object
            if videomixer is not None:
                videomixer.load_config(self.plugman)

                # Get video mixer inputs bins.
                videomixer_inputs = []

                videoinputs = videomixer.get_inputs()
                for name, instance in videoinputs:
                    log.debug("Loading Video Mixer Input: %s-%d", name, instance)
                    video_input = self.plugman.get_plugin_by_name(name, "VideoInput").plugin_object
                    video_input.set_instance(instance)
                    video_input.load_config(self.plugman)
                    videomixer_inputs.append(video_input.get_videoinput_bin())

                if not self.load_videomixer(videomixer, videomixer_inputs):
                    # Loading VideoMixer failed, abort
                    self.unload_output_plugins()
                    self.unload_audiomixer()
                    return False

        if filename_for_frontend is not None:
            self.file_path = os.path.join(self.config.videodir, filename_for_frontend)
        return True, filename_for_frontend
コード例 #19
0
ファイル: database.py プロジェクト: yiqideren/freeseer
 def __insert_default_talk(self):
     """Inserts the required placeholder talk into the database.At least one talk must exist"""
     self.insert_presentation(
         Presentation("", "", "", "", "", "", "", "", ""))
コード例 #20
0
    def setUp(self):
        '''
        Generic unittest.TestCase.setUp()
        '''

        self.pres = Presentation("John Doe", event="haha", startTime="NOW", endTime="Later")
コード例 #21
0
def parse_args(parser, parse_args=None):
    if len(sys.argv) == 1:  # No arguments passed
        launch_recordapp()

    args = parser.parse_args(parse_args)

    if args.app == 'record':
        if len(sys.argv) == 2:  # No 'record' arguments passed
            launch_recordapp()

        import gobject
        # Must declare after argparse otherwise GStreamer will take over the cli help
        from freeseer.frontend.record.RecordingController import RecordingController

        # TODO: Abstract the database stuff away from here as it's only
        #       used in conjunction with talks.
        if args.profile is None:  # Profile is an optional parameter
            args.profile = 'default'
        profile = settings.profile_manager.get(args.profile)
        config = profile.get_config('freeseer.conf',
                                    settings.FreeseerConfig,
                                    storage_args=['Global'],
                                    read_only=False)
        # XXX: There should only be 1 database per user. Workaround for this
        #      is to put it in the 'default' profile.
        db = settings.profile_manager.get().get_database()

        app = RecordingController(profile, db, config, cli=True)

        if args.talk:
            if app.record_talk_id(args.talk):
                sys.exit(gobject.MainLoop().run())
        elif args.filename:
            if app.record_filename(args.filename):
                sys.exit(gobject.MainLoop().run())
        elif args.show_talks:
            app.print_talks()

    elif args.app == 'config':
        if len(sys.argv) == 2:  # No 'config' arguments passed
            launch_configtool()

        from freeseer.settings import configdir
        from freeseer.framework.util import reset
        from freeseer.framework.util import reset_configuration
        from freeseer.framework.util import reset_database
        from freeseer.framework.youtube import YoutubeService

        if args.reset:
            reset(configdir)
        elif args.reset_configuration:
            reset_configuration(configdir)
        elif args.reset_database:
            reset_database(configdir)
        elif args.config_service == "youtube":
            YoutubeService.acquire_token(args.client_secrets, args.token, args)

    elif args.app == 'talk':
        if len(sys.argv) == 2:  # No 'talk' arguments passed
            launch_talkeditor()

        from freeseer.framework.presentation import Presentation

        profile = settings.profile_manager.get()
        db = profile.get_database()

        if args.action == "add":
            presentation = Presentation(args.title,
                                        speaker=args.speaker,
                                        room=args.room,
                                        event=args.event)
            db.insert_presentation(presentation)

        elif args.action == "remove":
            db.delete_presentation(args.talk_id)

        elif args.action == "clear":
            db.clear_database()

        else:
            print("Invalid option.")

    elif args.app == 'report':
        if len(sys.argv) == 2:  # No 'report' arguments passed
            launch_reporteditor()

    elif args.app == 'upload':
        if args.upload_service == 'youtube':
            youtube = YoutubeFrontend()
            youtube.upload(args.files, args.token, args.yes)
コード例 #22
0
 def add_talk_by_prompt(self):
     print "------------------------------ Adding a Talk -------------------------------\n"
     presentation = Presentation("")
     
     presentation.title = raw_input("Type the presentation title: ").strip()
     
     while(not len(presentation.title) > 0):
         presentation.title = raw_input("Please, type the presentation title: ").strip() 
     
     presentation.speaker = raw_input("Type the presentation speaker: ").strip()
     
     while(not len(presentation.speaker) > 0):
         presentation.speaker = raw_input("Please, type the presentation speaker: ").strip()
     
     presentation.description = raw_input("Type the presentation description or press <ENTER> to pass: "******"Type the speaker level or press <ENTER> to pass: "******"Type the event that held the presentation or press <ENTER> to pass: "******"Type the room where the presentation will be performed or press <ENTER> to pass: "******"Type the presentation time (format: dd/MM/yyyy HH:mm) or press <ENTER> to pass: "******"Wrong date format, please type the presentation time (format: dd/MM/yyyy HH:mm) or press <ENTER> to pass: "******"###################### Talk Added ############################"
     else:
         print "############### Error: Talk Already Exists ###################"