Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
radiopanik
django-panik-nonstop
Commits
f46d09bc
Commit
f46d09bc
authored
Jun 27, 2019
by
fred
Browse files
misc: don't crash on duplicated tracks with missing files
parent
8e812831
Pipeline
#103
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nonstop/models.py
View file @
f46d09bc
...
...
@@ -74,11 +74,17 @@ class Track(models.Model):
).
exclude
(
on_air
=
False
).
order_by
(
'-play_timestamp'
)
def
file_path
(
self
):
return
self
.
nonstopfile_set
.
all
().
order_by
(
'creation_timestamp'
).
last
().
get_local_filepath
()
nfile
=
None
for
nfile
in
self
.
nonstopfile_set
.
all
().
order_by
(
'creation_timestamp'
):
if
os
.
path
.
exists
(
nfile
.
get_local_filepath
()):
return
nfile
.
get_local_filepath
()
if
nfile
:
return
nfile
.
get_local_filepath
()
return
None
def
file_exists
(
self
):
try
:
return
os
.
path
.
exists
(
self
.
nonstopfile_set
.
order_by
(
'creation_timestamp'
).
last
().
get_local_
filepath
())
return
os
.
path
.
exists
(
self
.
file
_
path
())
except
AttributeError
:
return
False
...
...
Write
Preview
Supports
Markdown
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