def on_toggle(self, a): engine = self.controls.media_engine if engine.radio_recording: engine.stop_radio_record() if os.path.isfile(engine.radio_path): name = os.path.splitext(os.path.basename( engine.radio_path))[0] + ".ogg" else: name = "radio_record.ogg" temp_file = os.path.join("/tmp", name) if not os.path.exists(temp_file): logging.warning( _("So file doesn't exist. Pehaps it wasn't create yet.")) return def func(filename, folder): try: shutil.move(temp_file, os.path.join(folder, filename)) except IOError as e: logging.error(e) FileSavingDialog(_("Save file as ..."), func, args=None, current_folder=os.path.expanduser("~"), current_name=name) else: bean = self.controls.notetabs.get_current_tree( ).get_current_bean_by_UUID() engine.record_radio(bean)
def on_save_playlist(self, tab_child): name = self.get_text_label_from_tab(tab_child) current_name = name + ".m3u" tree = tab_child.get_child() def func(filename, folder): beans = tree.get_all_beans() if beans: paths = [bean.path for bean in beans if bean.is_file] else: logging.warning(_("It's need not empty playlist")) m3u_writer(filename, folder, paths) FileSavingDialog(_("Choose folder to save playlist"), func, current_folder=FCache().last_music_path, current_name=current_name)
def on_save_playlist(self, tab_child): name = self.get_text_label_from_tab(tab_child) current_name = name.strip() + ".m3u" tree = tab_child.get_child() def func(filename, folder): beans = tree.get_all_beans() paths = [] if beans: for bean in beans: if bean.is_file: if not bean.path or bean.path.startswith("http://"): paths.append("##" + bean.text) else: paths.append(bean.path) else: logging.warning(_("It's need not empty playlist")) m3u_writer(filename, folder, paths) FileSavingDialog(_("Choose folder to save playlist"), func, current_folder=FCache().last_music_path, current_name=current_name)
def on_toggle(self, a): engine = self.controls.media_engine if hasattr(engine, 'pipeline'): if gst.STATE_PLAYING in engine.pipeline.get_state()[1:]: engine.pipeline.set_state(gst.STATE_NULL) if os.path.isfile(engine.radio_path): name = os.path.splitext(os.path.basename(engine.radio_path))[0] + ".ogg" else: name = "radio_record.ogg" temp_file = os.path.join("/tmp", name) if not os.path.exists(temp_file): logging.warning(_("So file doesn't exist. Pehaps it wasn't create yet.")) return def func(filename, folder): try: shutil.move(temp_file, os.path.join(folder, filename)) except IOError, e: logging.error(e) FileSavingDialog(_("Save file as ..."), func, args = None, current_folder=os.path.expanduser("~"), current_name=name) return