diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 8ae6dac63..19f0af2fc 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -317,6 +317,8 @@ class ServiceItem(RegistryProperties): :param path: The title of the slide in the service item. :param file_name: The title of the slide in the service item. :param image: The command of/for the slide. + :param display_title: Title to show in gui/webinterface, optional. + :param notes: Notes to show in the webinteface, optional. """ self.service_item_type = ServiceItemType.Command self._raw_frames.append({'title': file_name, 'image': image, 'path': path, diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 36df55dac..82bf55477 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -551,6 +551,7 @@ class ImageMediaItem(MediaManagerItem): service_item.add_capability(ItemCapabilities.CanLoop) service_item.add_capability(ItemCapabilities.CanAppend) service_item.add_capability(ItemCapabilities.CanEditTitle) + service_item.add_capability(ItemCapabilities.HasThumbnails) # force a nonexistent theme service_item.theme = -1 missing_items_file_names = [] diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index f7d924651..bfaf63b62 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -295,6 +295,7 @@ class PresentationMediaItem(MediaManagerItem): i += 1 image_file = 'mainslide%03d.png' % i image = os.path.join(doc.get_temp_folder(), image_file) + service_item.add_capability(ItemCapabilities.HasThumbnails) doc.close_presentation() return True else: diff --git a/openlp/plugins/remotes/html/stage.js b/openlp/plugins/remotes/html/stage.js index 921deba79..e63025b80 100644 --- a/openlp/plugins/remotes/html/stage.js +++ b/openlp/plugins/remotes/html/stage.js @@ -111,7 +111,7 @@ window.OpenLP = { } // use thumbnail if available if (slide["img"]) { - text += "

"; + text += "

"; } // use notes if available if (slide["notes"]) { diff --git a/openlp/plugins/remotes/lib/httprouter.py b/openlp/plugins/remotes/lib/httprouter.py index 3f1131ca1..e08befbd3 100644 --- a/openlp/plugins/remotes/lib/httprouter.py +++ b/openlp/plugins/remotes/lib/httprouter.py @@ -159,7 +159,7 @@ class HttpRouter(RegistryProperties): ('^/(stage)$', {'function': self.serve_file, 'secure': False}), ('^/(main)$', {'function': self.serve_file, 'secure': False}), (r'^/files/(.*)$', {'function': self.serve_file, 'secure': False}), - (r'^/(.*)/thumbnails([^/]+)?/(.*)$', {'function': self.serve_thumbnail, 'secure': False}), + (r'^/(\w+)/thumbnails([^/]+)?/(.*)$', {'function': self.serve_thumbnail, 'secure': False}), (r'^/api/poll$', {'function': self.poll, 'secure': False}), (r'^/main/poll$', {'function': self.main_poll, 'secure': False}), (r'^/main/image$', {'function': self.main_image, 'secure': False}), @@ -387,7 +387,7 @@ class HttpRouter(RegistryProperties): Serve an image file. If not found return 404. """ log.debug('serve thumbnail %s/thumbnails%s/%s' % (controller_name, dimensions, file_name)) - supported_controllers = ['presentations'] + supported_controllers = ['presentations', 'images'] if not dimensions: dimensions = '' content = '' @@ -496,6 +496,12 @@ class HttpRouter(RegistryProperties): item['tag'] = str(index + 1) item['text'] = str(frame['text']) item['html'] = str(frame['html']) + elif current_item.is_image(): + item['tag'] = str(index + 1) + thumbnail_path = os.path.sep + os.path.join('images', 'thumbnails', frame['title']) + item['img'] = urllib.request.pathname2url(thumbnail_path) + item['text'] = str(frame['title']) + item['html'] = str(frame['title']) else: item['tag'] = str(index + 1) if current_item.is_capable(ItemCapabilities.HasDisplayTitle): @@ -503,8 +509,7 @@ class HttpRouter(RegistryProperties): if current_item.is_capable(ItemCapabilities.HasNotes): item['notes'] = str(frame['notes']) if current_item.is_capable(ItemCapabilities.HasThumbnails): - # If the file is under our app directory tree send the - # portion after the match + # If the file is under our app directory tree send the portion after the match data_path = AppLocation.get_data_path() if frame['image'][0:len(data_path)] == data_path: item['img'] = urllib.request.pathname2url(frame['image'][len(data_path):])