~phill-ridout/openlp/pathlib4

« back to all changes in this revision

Viewing changes to openlp/core/api/endpoint/controller.py

  • Committer: Raoul Snyman
  • Author(s): Phill
  • Date: 2017-08-25 04:26:25 UTC
  • mfrom: (2758.2.6 pathlib3)
  • Revision ID: raoul@snyman.info-20170825042625-60l1i0uzq9lbxxl2
Part 3, converted some more utility methods

Fixed the problem TGC was having.

Superflys fix included (https://bin.snyman.info/mmm5sqj8)

lp:~phill-ridout/openlp/pathlib3 (revision 2764)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/2175/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/2079/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1966/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Code_Analysis/1336/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Test_C...

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
            elif current_item.is_image() and not frame.get('image', '') and Settings().value('api/thumbnails'):
65
65
                item['tag'] = str(index + 1)
66
66
                thumbnail_path = os.path.join('images', 'thumbnails', frame['title'])
67
 
                full_thumbnail_path = os.path.join(AppLocation.get_data_path(), thumbnail_path)
 
67
                full_thumbnail_path = str(AppLocation.get_data_path() / thumbnail_path)
68
68
                # Create thumbnail if it doesn't exists
69
69
                if not os.path.exists(full_thumbnail_path):
70
70
                    create_thumb(current_item.get_frame_path(index), full_thumbnail_path, False)
82
82
                if current_item.is_capable(ItemCapabilities.HasThumbnails) and \
83
83
                        Settings().value('api/thumbnails'):
84
84
                    # If the file is under our app directory tree send the portion after the match
85
 
                    data_path = AppLocation.get_data_path()
 
85
                    data_path = str(AppLocation.get_data_path())
86
86
                    if frame['image'][0:len(data_path)] == data_path:
87
87
                        item['img'] = urllib.request.pathname2url(frame['image'][len(data_path):])
88
88
                    Registry().get('image_manager').add_image(frame['image'], frame['title'], None, 88, 88)