Browse Source

fix gslide bug

ming 3 years ago
parent
commit
d0d6233c3d
2 changed files with 13 additions and 11 deletions
  1. BIN
      api/__pycache__/gSlide.cpython-39.pyc
  2. 13 11
      api/gSlide.py

BIN
api/__pycache__/gSlide.cpython-39.pyc


+ 13 - 11
api/gSlide.py

@@ -52,28 +52,30 @@ def parse_slide_url(slide_url,eng):
         
     for i, slide in enumerate(slides):
         # Check if the notes exists
+        print(slide['slideProperties']['notesPage']['pageElements'][1]['shape'].keys())
+        notes=''
         if 'text' in slide['slideProperties']['notesPage']['pageElements'][1]['shape'].keys():
             notes = slide['slideProperties']['notesPage']['pageElements'][1]['shape']['text']['textElements'][1]['textRun']['content']
-            if '[sub_title]' in notes:
-                sub_title = notes.split('[sub_title]')[1].strip()
-                print('Sub_title:',end='')
-                pprint.pprint(sub_title)
-                sub_title_list.append(sub_title)
-                notes = notes.split('[sub_title]')[0].strip()
-            pprint.pprint(notes)
-            notes_list.append(notes)  
         else:
-            notes_list.append("")
+            notes = slide['slideProperties']['notesPage']['pageElements'][0]['shape']['text']['textElements'][1]['textRun']['content']
+        if '[sub_title]' in notes:
+            sub_title = notes.split('[sub_title]')[1].strip()
+              
+            sub_title_list.append(sub_title)
+            notes = notes.split('[sub_title]')[0].strip()
+        
+        notes_list.append(notes)  
+
                 
         # Convert the content of the presentation to png
         thumbnail = service.presentations().pages().getThumbnail(presentationId=PRESENTATION_ID, pageObjectId=slide['objectId']).execute()
-        pprint.pprint(thumbnail)
+     
         img_list.append(thumbnail['contentUrl'])
             
     # data
     slide_content = { "name": presentation['title'], "text_content": notes_list, "image_urls": img_list, "avatar": "7", "client_id": calendar.timegm(time.gmtime()) }
     if eng:
         slide_content['sub_titles'] = sub_title_list
-    print(slide_content)
+
     return slide_content['name'],slide_content['text_content'],slide_content['image_urls']