コード例 #1
0
ファイル: crawler.py プロジェクト: moonwatcher/mp4pack.py
 def _load_ogg_chapters(self):
     if self.ontology["kind"] == "chp":
         content = self._read()
         if content:
             content = content.splitlines()
             menu = Menu(self.env)
             for index in range(len(content) - 1):
                 menu.add(Chapter.from_raw(content[index], content[index + 1], Chapter.OGG))
             menu.normalize()
             if menu.valid:
                 self._execution["crawl"]["menu"].append(menu)
コード例 #2
0
ファイル: crawler.py プロジェクト: moonwatcher/mp4pack.py
    def _load_mediainfo(self):
        command = self.env.initialize_command("mediainfo", self.log)
        if command:
            command.extend([u"--Language=raw", u"--Output=XML", u"--Full", self.ontology["path"]])
            proc_mediainfo = Popen(command, stdout=PIPE, stderr=PIPE)
            proc_grep = Popen([u"grep", u"-v", u"Cover_Data"], stdin=proc_mediainfo.stdout, stdout=PIPE)
            raw_xml = proc_grep.communicate()[0]

            # parse the DOM
            element = ElementTree.fromstring(raw_xml)
            if element is not None:
                for node in element.findall(u"File/track"):
                    if "type" in node.attrib:
                        mtype = self.env.enumeration["mediainfo stream type"].search(node.attrib["type"])
                        if mtype is not None:
                            if mtype.node["namespace"]:
                                # initialize an ontology with the correct namespace
                                o = Ontology(self.env, mtype.node["namespace"])

                                # iterate over the properties and populate the ontology
                                for item in list(node):
                                    text = item.text

                                    # decode base64 encoded element
                                    if "dt" in item.attrib and item.attrib["dt"] == "binary.base64":
                                        text = base64.b64decode(text)
                                        text = unicode(text, "utf8")

                                    # set the concept on the ontology
                                    o.decode(item.tag, text)

                                # fix the video encoder settings on video tracks
                                if mtype.key == "video":
                                    self._fix_mediainfo_encoder_settings(o)

                                # add the ontology to the stream stack
                                self._execution["crawl"]["stream"].append(o)

                            elif mtype.key == "menu":
                                menu = Menu(self.env)
                                for item in list(node):
                                    menu.add(Chapter.from_raw(item.tag, item.text, Chapter.MEDIAINFO))
                                menu.normalize()
                                if menu.valid:
                                    self._execution["crawl"]["menu"].append(menu)

            # Release resources held by the element, we no longer need it
            element.clear()
コード例 #3
0
ファイル: album.py プロジェクト: kassiopea/tests_imgbb
    def move_to_album(self, album, file=None, param=None):
        wd = self.app.wd
        wait = WebDriverWait(wd, 10)
        info_about_album = self.info_about_albums_by_name(album)
        self.app.menu.user_menu("My Profile")
        self.app.navigation.profile_page()
        if param == "all":
            self.app.file.select_all_files()
        else:
            self.app.file.select_files(file)
        self.app.menu.open_action_menu(Menu(active_menu_item="move"))

        wait.until(EC.visibility_of_element_located((By.ID, "fullscreen-modal-box")))
        selection_album_field = wd.find_element_by_css_selector("div#fullscreen-modal-box select#form-album-id")

        Select(selection_album_field).select_by_value(info_about_album[0].id_album)

        save_changes = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR,
                                                                    "#fullscreen-modal-box button[type='submit']")))
        if wd.capabilities["browserName"] == "firefox":
            ActionChains(wd).move_to_element(save_changes).perform()
            time.sleep(1)
            ActionChains(wd).click_and_hold(save_changes).release(save_changes).perform()
        else:
            ActionChains(wd).move_to_element(save_changes).pause(2).click_and_hold().release().perform()

        wait.until(EC.invisibility_of_element((By.ID, "fullscreen-modal-box")))
        # проверка будет включена, если перемещение из альбома в тот же альбом будет запрещено. Сообщение об удачном
        # перемещении появляется только если альбомы различны
        # wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "#growl")))
        wd.refresh()
コード例 #4
0
ファイル: menu.py プロジェクト: AbdulHK/FYPAPI
def add_dish():
    dish = request.args['name']
    desc = request.args['desc']
    price = request.args['price']
    restid = request.args['restid']
    add = Menu(dish=dish, description=desc, price=price, restid=restid)
    db.session.add(add)
    db.session.commit()
    return jsonify({"Done": "all set"})
コード例 #5
0
ファイル: material.py プロジェクト: moonwatcher/mp4pack.py
 def menu(self):
     if self._menu is None:
         for stream in self.stream:
             if stream['stream kind'] == 'menu' and 'content' in stream:
                 self._menu_track = stream
                 self._menu = Menu.from_node(self.env, stream['content'])
                 
         if self._menu is None:
             self._menu = Menu(self.env)
     return self._menu
コード例 #6
0
ファイル: file.py プロジェクト: kassiopea/tests_imgbb
    def delete_all_files(self):
        wd = self.app.wd
        wait = WebDriverWait(wd, 10)
        self.select_all_files()
        self.app.menu.open_action_menu(Menu(active_menu_item="delete"))

        wait.until(
            EC.visibility_of_element_located((By.ID, "fullscreen-modal-box")))
        confirm = wd.find_elements_by_css_selector(
            "#fullscreen-modal-box button[type='submit']")
        confirm.click()

        wait.until(EC.visibility_of_element_located((By.ID, "growl")))
コード例 #7
0
ファイル: album.py プロジェクト: kassiopea/tests_imgbb
    def delete(self, list_album):
        wd = self.app.wd
        wait = WebDriverWait(wd, 10)

        self.app.navigation.open_albums_page()

        self.select(list_album)

        self.app.menu.open_action_menu(Menu(active_menu_item="delete"))

        confirm_delete = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "button[type='submit']")))

        confirm_delete.click()
        wait.until(EC.invisibility_of_element((By.CSS_SELECTOR, "#fullscreen-modal")))
        wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "#growl")))
        self.app.menu.user_menu("My Profile")

        self.album_cache = None
コード例 #8
0
ファイル: material.py プロジェクト: moonwatcher/mp4pack.py
 def explode(self, task):
     for pivot in task.transform.pivot.values():
         for stream in pivot.stream:
             if stream['enabled'] and stream['stream kind'] == 'menu':
                 stream['enabled'] = False
                 product = task.produce(stream)
                 if product:
                     if self.env.check_path_available(product.path, task.ontology['overwrite']):
                         if not task.ontology['debug']:
                             product.menu = Menu.from_node(self.env, stream['content'])
                             product.write(product.path)
                             
                             # push a task for transcoding
                             if 'tasks' in stream:
                                 for template in stream['tasks']:
                                     o = task.job.ontology.project('ns.system.task')
                                     for i in template: o[i] = template[i]
                                     t = queue.ResourceTask(task.job, o, product.path)
                                     t.group = task.key
                                     t.constrain({'scope':'task', 'reference':task.key, 'status':'completed'})
                                     task.job.push(t)
コード例 #9
0
ファイル: main.py プロジェクト: rogigs/run_away_from_fat
import pygame
from pygame.locals import *
from sys import exit
from model.menu import Menu

pygame.init()
pygame.display.set_caption("Run Away from Fat")
SCREEN_SIZE = (1280, 720)
SCREEN = pygame.display.set_mode(SCREEN_SIZE, 0, 32)

menu = Menu(SCREEN)
while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            exit()
        if event.type == MOUSEBUTTONDOWN:
            menu.detect_press(pygame.mouse.get_pos())
        elif event.type == MOUSEBUTTONUP:
            menu.detect_drop(pygame.mouse.get_pos())

    menu.show()
    pygame.display.update()