Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aura-engine
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Kruse
aura-engine
Commits
fa418651
Commit
fa418651
authored
5 years ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
More fixes for playlist response handling.
parent
8d04a182
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/scheduling/calender_fetcher.py
+5
-18
5 additions, 18 deletions
modules/scheduling/calender_fetcher.py
with
5 additions
and
18 deletions
modules/scheduling/calender_fetcher.py
+
5
−
18
View file @
fa418651
...
@@ -161,16 +161,6 @@ class CalendarFetcher:
...
@@ -161,16 +161,6 @@ class CalendarFetcher:
def
__fetch_schedule_playlist__
(
self
,
schedule
,
id_name
,
fetched_schedule_entries
):
def
__fetch_schedule_playlist__
(
self
,
schedule
,
id_name
,
fetched_schedule_entries
):
servicetype
=
"
importer
"
servicetype
=
"
importer
"
# set playlist_id (in testenvironment always null => no idea)
if
id_name
not
in
schedule
or
schedule
[
id_name
]
is
None
:
playlist_id
=
1
else
:
playlist_id
=
schedule
[
id_name
]
# set url
#url = self.url["importer"] + schedule["show_name"] + "/playlists/" + str(playlist_id)
#url = self.url["importer"] + "public" + "/playlists/" + str(playlist_id)
# fetch playlists from TANK
# fetch playlists from TANK
if
not
"
show_slug
"
in
schedule
:
if
not
"
show_slug
"
in
schedule
:
raise
ValueError
(
"
Missing
'
show_slug
'
for schedule
"
,
schedule
)
raise
ValueError
(
"
Missing
'
show_slug
'
for schedule
"
,
schedule
)
...
@@ -178,25 +168,22 @@ class CalendarFetcher:
...
@@ -178,25 +168,22 @@ class CalendarFetcher:
slug
=
str
(
schedule
[
"
show_slug
"
])
slug
=
str
(
schedule
[
"
show_slug
"
])
json_response
=
self
.
__fetch_data__
(
servicetype
,
"
${SLUG}
"
,
slug
)
json_response
=
self
.
__fetch_data__
(
servicetype
,
"
${SLUG}
"
,
slug
)
# use testdata if wanted
if
not
json_response
and
self
.
config
.
get
(
"
use_test_data
"
):
self
.
logger
.
warn
(
"
Using test-data for fetch-schedule-playlist
"
)
use_testdata
=
True
# if a playlist is already fetched, do not fetch it again
# if a playlist is already fetched, do not fetch it again
for
entry
in
fetched_schedule_entries
:
for
entry
in
fetched_schedule_entries
:
if
entry
[
"
playlist_id
"
]
==
schedule
[
id_name
]:
if
entry
[
"
playlist_id
"
]
==
schedule
[
id_name
]:
self
.
logger
.
debug
(
"
playlist #
"
+
str
(
schedule
[
id_name
])
+
"
already fetched
"
)
self
.
logger
.
debug
(
"
playlist #
"
+
str
(
schedule
[
id_name
])
+
"
already fetched
"
)
return
entry
return
entry
if
use_testdata
:
if
self
.
config
.
get
(
"
use_test
_
data
"
)
:
# FIXME move hardcoded test-data to separate testing logic.
# FIXME move hardcoded test-data to separate testing logic.
self
.
logger
.
warn
(
"
Using test-data for fetch-schedule-playlist
"
)
json_response
=
self
.
create_test_data
(
id_name
,
schedule
)
json_response
=
self
.
create_test_data
(
id_name
,
schedule
)
# convert to list
# convert to list
schedule_entries
=
simplejson
.
loads
(
json_response
)
schedule_entries
=
simplejson
.
loads
(
json_response
)
if
"
results
"
in
schedule_entries
:
schedule_entries
=
schedule_entries
[
"
results
"
][
0
]
if
"
entries
"
in
schedule_entries
:
for
entry
in
schedule_entries
[
"
entries
"
]:
for
entry
in
schedule_entries
[
"
entries
"
]:
if
entry
[
"
uri
"
].
startswith
(
"
file
"
):
if
entry
[
"
uri
"
].
startswith
(
"
file
"
):
entry
[
"
filename
"
]
=
self
.
convert_to_filename
(
entry
[
"
uri
"
])
entry
[
"
filename
"
]
=
self
.
convert_to_filename
(
entry
[
"
uri
"
])
...
@@ -209,7 +196,7 @@ class CalendarFetcher:
...
@@ -209,7 +196,7 @@ class CalendarFetcher:
# convert to normal filename
# convert to normal filename
e
=
self
.
config
.
get
(
"
audiofolder
"
)
+
"
/
"
+
uri
[
7
:]
+
"
.flac
"
e
=
self
.
config
.
get
(
"
audiofolder
"
)
+
"
/
"
+
uri
[
7
:]
+
"
.flac
"
if
not
os
.
path
.
isfile
(
e
):
if
not
os
.
path
.
isfile
(
e
):
self
.
logger
.
warning
(
"
File
"
,
e
,
"
does not exist!
"
)
self
.
logger
.
warning
(
"
File
%s
does not exist!
"
%
e
)
return
e
return
e
# ------------------------------------------------------------------------------------------ #
# ------------------------------------------------------------------------------------------ #
...
...
This diff is collapsed.
Click to expand it.
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