-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add naviagators to upload and tasks - minor tweak on packaging data upload to gdrive - cache user folders - minor tweaks for scheduling task
- Loading branch information
1 parent
82c495a
commit 1f3a3dd
Showing
5 changed files
with
71 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import os | ||
import json as pyjson | ||
from email import encoders | ||
from email.mime.multipart import MIMEMultipart | ||
from email.mime.application import MIMEApplication | ||
from email.mime.audio import MIMEAudio | ||
|
||
|
||
def prepare_package(file_path, destination_folder_id): | ||
related = MIMEMultipart('related') | ||
related.set_boundary("--foo_bar_baz--") | ||
|
||
fileinfo = MIMEApplication(pyjson.dumps( | ||
{ | ||
"name": os.path.split(file_path)[1], | ||
"parents": [destination_folder_id] | ||
}), "json", _encoder=encoders.encode_noop, charset='utf-8') | ||
related.attach(fileinfo) | ||
|
||
with open(file_path, 'rb') as f: | ||
upload_file = MIMEAudio(f.read(), 'mpeg') | ||
related.attach(upload_file) | ||
|
||
def write_empty_headers(self): pass | ||
related._write_headers = write_empty_headers # prevent writing headers | ||
|
||
return dict(related.items()), related.as_bytes() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters