Beispiel #1
0
 def cache_entries(self):
     """
         Cache entries referenced on the play list
     """
     for entry in self.entries:
         video_link = entry.get('video')
         if video_link:
             pivideo.cache_file(video_link)
         photo_link = entry.get('photo')
         if photo_link:
             pivideo.cache_file(photo_link)
Beispiel #2
0
 def cache_entries(self):
     """
         Cache entries referenced on the play list
     """
     for entry in self.entries:
         video_link = entry.get('video')
         if video_link:
             pivideo.cache_file(video_link)
         photo_link = entry.get('photo')
         if photo_link:
             pivideo.cache_file(photo_link)
Beispiel #3
0
def overlay():
    global photo_overlay

    # stop displaying the current photo if there's an active overlay
    if photo_overlay:
        photo_overlay.stop()

    photo = request.json.get('photo')
    title = request.json.get('title')
    x = request.json.get('x', 0)
    y = request.json.get('y', 0)

    if photo:
        photo_file_name = pivideo.cache_file(photo)
        photo_overlay = omx.PhotoOverlay(photo_file_name, x=x, y=y)
        return flask.jsonify(status='active')
    elif title:
        subtitle = request.json.get('subtitle')
        photo_overlay = omx.PhotoOverlay(title=title,
                                         subtitle=subtitle,
                                         x=x,
                                         y=y)
        return flask.jsonify(status='active')
    else:
        return flask.jsonify(status='stopped')
Beispiel #4
0
 def play(self):
     if self.player:
         self.player.stop()
     if len(self.video_queue) > 0:
         video_file_name = pivideo.cache_file(self.video_queue[0]['video'])
         self.player = Player(video_file_name,
                              finished_callback=self.next_video)
         self.stopped = False
Beispiel #5
0
 def play(self):
     if len(self.queue) > 0:
         entry = self.queue[0]
         if 'video' in entry:
             if 'title' in entry:
                 subtitle = entry.get('subtitle', '')
                 self.overlay = PhotoOverlay(title=entry['title'],
                                             subtitle=subtitle, duration=10)
             video_file_name = pivideo.cache_file(entry['video'])
             self.player = Player(video_file_name, finished_callback=self.next_entry)
             self.stopped = False
         elif 'photo' in entry:
             photo_file_name = pivideo.cache_file(entry['photo'])
             duration = entry.get('duration', 60)
             self.overlay = PhotoOverlay(photofile=photo_file_name,
                                         duration=duration,
                                         finished_callback=self.next_entry)
             self.stopped = False
     else:
         self.stopped = True
Beispiel #6
0
 def play(self):
     if len(self.queue) > 0:
         entry = self.queue[0]
         if 'video' in entry:
             if 'title' in entry:
                 subtitle = entry.get('subtitle', '')
                 self.overlay = PhotoOverlay(title=entry['title'],
                                             subtitle=subtitle, duration=10)
             video_file_name = pivideo.cache_file(entry['video'])
             self.player = Player(video_file_name, finished_callback=self.next_entry)
             self.stopped = False
         elif 'photo' in entry:
             photo_file_name = pivideo.cache_file(entry['photo'])
             duration = entry.get('duration', 60)
             self.overlay = PhotoOverlay(photofile=photo_file_name,
                                         duration=duration,
                                         finished_callback=self.next_entry)
             self.stopped = False
     else:
         self.stopped = True
Beispiel #7
0
def overlay():
    global photo_overlay

    # stop displaying the current photo if there's an active overlay
    if photo_overlay:
        photo_overlay.stop()

    photo = request.json.get('photo')
    title = request.json.get('title')
    x = request.json.get('x', 0)
    y = request.json.get('y', 0)

    if photo:
        photo_file_name = pivideo.cache_file(photo)
        photo_overlay = omx.PhotoOverlay(photo_file_name, x=x, y=y)
        return flask.jsonify(status='active')
    elif title:
        subtitle = request.json.get('subtitle')
        photo_overlay = omx.PhotoOverlay(title=title, subtitle=subtitle, x=x, y=y)
        return flask.jsonify(status='active')
    else:
        return flask.jsonify(status='stopped')