Skip to content
GitLab
Next
Projects
Groups
Snippets
Help
Loading...
Help
See what's new at GitLab
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zoom Sync
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
GitLab.com
Zoom Sync
Commits
5b36d10c
Commit
5b36d10c
authored
Jul 13, 2020
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GOOGLE_DRIVE_ID support
parent
6f96980e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
9 deletions
+27
-9
Gemfile
Gemfile
+1
-0
Gemfile.lock
Gemfile.lock
+2
-0
README.md
README.md
+1
-0
zoom-sync.rb
zoom-sync.rb
+23
-9
No files found.
Gemfile
View file @
5b36d10c
...
...
@@ -6,4 +6,5 @@ gem 'mediainfo', '= 1.3.3'
group
:development
,
:test
do
gem
'
rubocop
'
,
'~> 0.87'
gem
'
byebug
'
end
Gemfile.lock
View file @
5b36d10c
...
...
@@ -4,6 +4,7 @@ GEM
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
ast (2.4.1)
byebug (11.1.3)
declarative (0.0.10)
declarative-option (0.1.0)
faraday (0.15.4)
...
...
@@ -81,6 +82,7 @@ PLATFORMS
ruby
DEPENDENCIES
byebug
google_drive (= 3.0.3)
httparty (= 0.17.0)
mediainfo (= 1.3.3)
...
...
README.md
View file @
5b36d10c
...
...
@@ -25,6 +25,7 @@ variables do not exist, Zoom will attempt to load them from config files.
|ZOOM_API_KEY|Zoom API client key|
|ZOOM_API_SECRET|Zoom API secret key|
|GOOGLE_DRIVE_SERVICE_ACCOUNT_KEY|Google Drive credentials|
|GOOGLE_DRIVE_ID|Google Drive ID for destination folder (e.g.
`0A1PeuBAntm4LNk9PVB`
)|
If
`ZOOM_API_KEY`
and
`ZOOM_API_SECRET`
are not available, the script
will attempt to load
`zoom_sync.yml`
:
...
...
zoom-sync.rb
View file @
5b36d10c
...
...
@@ -106,16 +106,24 @@ end
# Client to access Google Drive
class
GoogleDriveClient
GOOGLE_BASE_FOLDER
=
'GitLab Videos Recorded'
.
freeze
attr_reader
:session
,
:gdrive_id
attr_reader
:session
def
initialize
(
config
)
def
initialize
(
config
,
gdrive_id
)
@session
=
GoogleDrive
::
Session
.
from_service_account_key
(
config
)
@gdrive_id
=
gdrive_id
end
def
base_collection
@base_collection
||=
session
.
collection_by_id
(
gdrive_id
)
end
# If you want to store videos in a folder, change this
def
base_folder
[]
end
def
valid_file?
(
folders
,
filename
,
file_size
)
dest_folder
=
session
.
file_by_title
([
GOOGLE_BASE_FOLDER
]
+
folders
)
dest_folder
=
base_collection
.
file_by_title
(
folders
)
return
unless
dest_folder
...
...
@@ -134,13 +142,13 @@ class GoogleDriveClient
end
def
mkdir
(
sub_directories
)
current_path
=
[
GOOGLE_BASE_FOLDER
]
current_path
=
base_folder
dest_folder
=
nil
sub_directories
.
each
do
|
dir
|
current_folder
=
sess
ion
.
file_by_title
(
current_path
)
current_folder
=
base_collect
ion
.
file_by_title
(
current_path
)
current_path
+=
[
dir
]
dest_folder
=
sess
ion
.
file_by_title
(
current_path
)
dest_folder
=
base_collect
ion
.
file_by_title
(
current_path
)
unless
dest_folder
puts
"Creating destination folder
#{
current_path
}
"
...
...
@@ -187,7 +195,7 @@ class ZoomSyncher
def
initialize
@client
=
ZoomClient
.
new
(
load_zoom_config
)
@gdrive_client
=
GoogleDriveClient
.
new
(
load_gdrive_config
)
@gdrive_client
=
GoogleDriveClient
.
new
(
load_gdrive_config
,
load_gdrive_id
)
end
def
sync
...
...
@@ -294,6 +302,12 @@ class ZoomSyncher
StringIO
.
new
(
data
)
end
def
load_gdrive_id
ENV
[
'GOOGLE_DRIVE_ID'
].
tap
do
|
gdrive_id
|
raise
'GOOGLE_DRIVE_ID not set'
unless
gdrive_id
end
end
# Discard any audio or videos that aren't longer than 30 seconds
def
should_upload?
(
filename
,
file_type
)
return
true
if
file_type
.
downcase
==
'chat'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment