Initial work for import from panopto

This commit is contained in:
Joshua Coles 2023-09-29 19:19:03 +01:00
parent 34c5f771ad
commit 0e0c6694ac
6 changed files with 24 additions and 2 deletions

View File

@ -73,3 +73,4 @@ end
gem "tailwindcss-rails", "~> 2.0"
gem "font-awesome-sass"
gem "httparty"

View File

@ -93,6 +93,9 @@ GEM
sassc (~> 2.0)
globalid (1.2.1)
activesupport (>= 6.1)
httparty (0.21.0)
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
importmap-rails (1.2.1)
@ -119,6 +122,7 @@ GEM
mini_mime (1.1.5)
minitest (5.20.0)
msgpack (1.7.2)
multi_xml (0.6.0)
net-imap (0.3.7)
date
net-protocol
@ -229,6 +233,7 @@ DEPENDENCIES
capybara
debug
font-awesome-sass
httparty
importmap-rails
jbuilder
pg (~> 1.1)

8
app/lib/Panopto.rb Normal file
View File

@ -0,0 +1,8 @@
module Panopto
# @param [String] folder_id
def self.list_folder(folder_id)
HTTParty.get("https://lectures.joshuacoles.me/list", query: {
folderId: folder_id
})
end
end

View File

@ -18,6 +18,8 @@ class Lecture < ApplicationRecord
end
def recording_url
"https://google.com"
return nil if recording_id.nil?
"https://uniofbath.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=#{recording_id}"
end
end

View File

@ -0,0 +1,5 @@
class MakeLectureRecordingIdUnique < ActiveRecord::Migration[7.0]
def change
add_index :lectures, :recording_id, unique: true
end
end

3
db/schema.rb generated
View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_09_29_171856) do
ActiveRecord::Schema[7.0].define(version: 2023_09_29_181725) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -32,6 +32,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_09_29_171856) do
t.datetime "updated_at", null: false
t.bigint "course_id"
t.index ["course_id"], name: "index_lectures_on_course_id"
t.index ["recording_id"], name: "index_lectures_on_recording_id", unique: true
end
end