Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rescheduled 🗓️
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
c3lingo
rescheduled 🗓️
Commits
38931205
Verified
Commit
38931205
authored
4 months ago
by
tribut
Browse files
Options
Downloads
Patches
Plain Diff
Switch back to a simple config for filedrop
Also account for absolute/relative paths
parent
271a22f4
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/jobs/pretalx/import_job.rb
+10
-10
10 additions, 10 deletions
app/jobs/pretalx/import_job.rb
db/seeds.rb
+2
-8
2 additions, 8 deletions
db/seeds.rb
with
12 additions
and
18 deletions
app/jobs/pretalx/import_job.rb
+
10
−
10
View file @
38931205
...
@@ -8,7 +8,7 @@ module Pretalx
...
@@ -8,7 +8,7 @@ module Pretalx
queue_as
:default
queue_as
:default
include
ActionView
::
Helpers
include
ActionView
::
Helpers
def
import_schedule
(
conference
,
url
,
filedrop_
config
)
def
import_schedule
(
conference
,
url
,
filedrop_
url
)
response
=
HTTParty
.
get
(
url
)
response
=
HTTParty
.
get
(
url
)
response
.
success?
or
return
Rails
.
logger
.
error
"Failed to fetch schedule from
#{
url
}
"
response
.
success?
or
return
Rails
.
logger
.
error
"Failed to fetch schedule from
#{
url
}
"
...
@@ -17,7 +17,7 @@ module Pretalx
...
@@ -17,7 +17,7 @@ module Pretalx
schedule
.
dig
(
'schedule'
,
'conference'
,
'rooms'
)
&&
schedule
.
dig
(
'schedule'
,
'conference'
,
'rooms'
)
&&
schedule
.
dig
(
'schedule'
,
'conference'
,
'days'
)
schedule
.
dig
(
'schedule'
,
'conference'
,
'days'
)
filedrop_index
=
fetch_filedrop_index
(
filedrop_
config
)
filedrop_index
=
fetch_filedrop_index
(
filedrop_
url
)
# We keep a local hash of the stages, because the sessions reference stages by name instead of id
# We keep a local hash of the stages, because the sessions reference stages by name instead of id
stages
=
{}
stages
=
{}
...
@@ -62,7 +62,7 @@ module Pretalx
...
@@ -62,7 +62,7 @@ module Pretalx
end
end
end
end
session
.
recorded
=
!
session_data
.
fetch
(
'do_not_record'
,
false
)
session
.
recorded
=
!
session_data
.
fetch
(
'do_not_record'
,
false
)
update_filedrop_data
(
session
,
filedrop_index
[
session
.
ref_id
],
filedrop_
config
)
if
filedrop_index
[
session
.
ref_id
]
update_filedrop_data
(
session
,
filedrop_index
[
session
.
ref_id
],
filedrop_
url
)
if
filedrop_index
[
session
.
ref_id
]
session
.
save!
session
.
save!
end
end
end
end
...
@@ -83,14 +83,12 @@ module Pretalx
...
@@ -83,14 +83,12 @@ module Pretalx
private
private
def
fetch_filedrop_index
(
filedrop_config
)
def
fetch_filedrop_index
(
filedrop_url
)
if
!
filedrop_config
||
!
filedrop_config
[
'url'
]
return
{}
unless
filedrop_url
return
{}
end
begin
begin
response
=
HTTParty
.
get
(
response
=
HTTParty
.
get
(
filedrop_
config
[
'url'
]
+
"/"
,
filedrop_
url
,
basic_auth:
{
basic_auth:
{
username:
fetch_credential
(
"filedrop_user"
),
username:
fetch_credential
(
"filedrop_user"
),
password:
fetch_credential
(
"filedrop_password"
)
},
password:
fetch_credential
(
"filedrop_password"
)
},
...
@@ -112,7 +110,7 @@ module Pretalx
...
@@ -112,7 +110,7 @@ module Pretalx
end
end
end
end
def
update_filedrop_data
(
session
,
filedrop_data
,
filedrop_
config
)
def
update_filedrop_data
(
session
,
filedrop_data
,
filedrop_
url
)
existing_comments
=
session
.
filedrop_comments
.
pluck
(
:body
)
existing_comments
=
session
.
filedrop_comments
.
pluck
(
:body
)
new_comments
=
filedrop_data
[
"comments"
]
&
.
pluck
(
"body"
)
||
[]
new_comments
=
filedrop_data
[
"comments"
]
&
.
pluck
(
"body"
)
||
[]
...
@@ -142,7 +140,9 @@ module Pretalx
...
@@ -142,7 +140,9 @@ module Pretalx
session
.
filedrop_files
.
find_or_initialize_by
(
name:
file_data
[
'name'
],
checksum:
file_data
[
'meta'
][
'hash'
]).
tap
do
|
file
|
session
.
filedrop_files
.
find_or_initialize_by
(
name:
file_data
[
'name'
],
checksum:
file_data
[
'meta'
][
'hash'
]).
tap
do
|
file
|
file
.
size
=
file_data
[
'meta'
][
'size'
]
file
.
size
=
file_data
[
'meta'
][
'size'
]
file
.
orig_created
=
parse_datetime_or_nil
(
file_data
[
'meta'
][
'created'
])
file
.
orig_created
=
parse_datetime_or_nil
(
file_data
[
'meta'
][
'created'
])
file
.
download
(
filedrop_config
[
'url'
]
+
file_data
[
'url'
])
unless
filedrop_config
.
fetch
(
'skip_downloads'
,
false
)
uri
=
URI
(
filedrop_url
.
chomp
(
"/"
))
uri
.
path
=
path
.
start_with?
(
"/"
)
?
path
:
[
uri
.
path
,
path
].
join
(
"/"
)
file
.
download
(
uri
)
file
.
save
file
.
save
end
end
end
end
...
...
This diff is collapsed.
Click to expand it.
db/seeds.rb
+
2
−
8
View file @
38931205
...
@@ -56,10 +56,7 @@ Conference.find_or_create_by(slug: "38c3").tap do |c|
...
@@ -56,10 +56,7 @@ Conference.find_or_create_by(slug: "38c3").tap do |c|
c
.
ends_at
=
DateTime
.
parse
(
"30 December 2024 19:00 CET"
)
c
.
ends_at
=
DateTime
.
parse
(
"30 December 2024 19:00 CET"
)
c
.
data
=
{
c
.
data
=
{
"schedule_url"
=>
"https://api.events.ccc.de/congress/2024/assembly/6840c453-af5c-413c-8127-adcbdcd98e9e/schedule.json"
,
"schedule_url"
=>
"https://api.events.ccc.de/congress/2024/assembly/6840c453-af5c-413c-8127-adcbdcd98e9e/schedule.json"
,
"filedrop"
=>
{
"filedrop_url"
=>
"https://speakers.c3lingo.org/"
"url"
=>
"https://speakers.c3lingo.org"
}
}
}
c
.
import_job_class
=
"pretalx"
c
.
import_job_class
=
"pretalx"
c
.
location
=
"Congress Center Hamburg"
c
.
location
=
"Congress Center Hamburg"
...
@@ -73,10 +70,7 @@ Conference.find_or_create_by(slug: "38c3-more").tap do |c|
...
@@ -73,10 +70,7 @@ Conference.find_or_create_by(slug: "38c3-more").tap do |c|
c
.
ends_at
=
DateTime
.
parse
(
"30 December 2024 19:00 CET"
)
c
.
ends_at
=
DateTime
.
parse
(
"30 December 2024 19:00 CET"
)
c
.
data
=
{
c
.
data
=
{
"schedule_url"
=>
"https://api.events.ccc.de/congress/2024/assembly/6840c453-af5c-413c-8127-adcbdcd98e9e/schedule.json"
,
"schedule_url"
=>
"https://api.events.ccc.de/congress/2024/assembly/6840c453-af5c-413c-8127-adcbdcd98e9e/schedule.json"
,
"filedrop"
=>
{
"filedrop_url"
=>
"https://speakers.c3lingo.org/"
"url"
=>
"https://speakers.c3lingo.org"
,
"skip_downloads"
=>
true
}
}
}
c
.
import_job_class
=
"pretalx"
c
.
import_job_class
=
"pretalx"
c
.
location
=
"Congress Center Hamburg"
c
.
location
=
"Congress Center Hamburg"
...
...
This diff is collapsed.
Click to expand it.
tribut
@tribut
mentioned in commit
415f9495
·
4 months ago
mentioned in commit
415f9495
mentioned in commit 415f94956878d02a8d23903defc79be0ee9bd033
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment