m8chaa commited on
Commit
94a17c4
·
verified ·
1 Parent(s): d68bbde

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -838,7 +838,7 @@ class DriveWatcher:
838
  'id': f'channel-{folder_id}-{int(time.time())}',
839
  'type': 'web_hook',
840
  'address': 'https://m8chaa-re-sheet-develop.hf.space/notifications',
841
- 'expiration': int((datetime.now() + timedelta(days=7)).timestamp() * 1000) # Set expiration to 7 days
842
  }
843
  response = app.state.drive_service.files().watch(fileId=folder_id, body=body).execute()
844
  logging.info(f"Created channel for folder {folder_id}: {response['id']}")
@@ -910,18 +910,18 @@ async def startup_event():
910
  app.state.drive_service = build('drive', 'v3', credentials=APICredential)
911
 
912
  # Fetch all users and initialize the watch list
913
- users = users_collection_ref.get()
914
- for user in users:
915
- user_data = user.to_dict()
916
- if 'gDrive_metadata' in user_data and 'uploaded' in user_data['gDrive_metadata']:
917
- app.state.drive_watcher.watch_list[user.id] = user_data['gDrive_metadata']['uploaded']
918
-
919
 
920
  # Initial update of watch list channels
921
- app.state.drive_watcher.update_watch_list()
922
 
923
  # Set up the Firebase listener
924
- app.state.users_watch = users_collection_ref.on_snapshot(app.state.drive_watcher.on_user_change)
925
 
926
  logging.info("Application startup completed")
927
 
 
838
  'id': f'channel-{folder_id}-{int(time.time())}',
839
  'type': 'web_hook',
840
  'address': 'https://m8chaa-re-sheet-develop.hf.space/notifications',
841
+ # 'expiration': int((datetime.now() + timedelta(days=7)).timestamp() * 1000) # Set expiration to 7 days
842
  }
843
  response = app.state.drive_service.files().watch(fileId=folder_id, body=body).execute()
844
  logging.info(f"Created channel for folder {folder_id}: {response['id']}")
 
910
  app.state.drive_service = build('drive', 'v3', credentials=APICredential)
911
 
912
  # Fetch all users and initialize the watch list
913
+ # users = users_collection_ref.get()
914
+ # for user in users:
915
+ # user_data = user.to_dict()
916
+ # if 'gDrive_metadata' in user_data and 'uploaded' in user_data['gDrive_metadata']:
917
+ # app.state.drive_watcher.watch_list[user.id] = user_data['gDrive_metadata']['uploaded']
918
+ app.state.drive_watcher.watch_list["xJs8nDUdbVWvq1QIKY3VYmFkidn1"] = "1paIWJDmlLyWaGsB_eXrpP7ILZiw3Xb70"
919
 
920
  # Initial update of watch list channels
921
+ # app.state.drive_watcher.update_watch_list()
922
 
923
  # Set up the Firebase listener
924
+ # app.state.users_watch = users_collection_ref.on_snapshot(app.state.drive_watcher.on_user_change)
925
 
926
  logging.info("Application startup completed")
927