Skip to content

Commit

Permalink
add download_ds
Browse files Browse the repository at this point in the history
  • Loading branch information
oscie57 committed Jun 8, 2024
1 parent 4529fed commit 92388d7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
11 changes: 11 additions & 0 deletions templates/movie_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@
<span>Download</span>
</a>
</p>
{% if movie.ds_mov_id is not none %}
<p class="control">
<a href="{{ url_for('save_ds_movie', movie_id=movie.movie_id) }}"
class="button is-info">
<span class="icon is-small">
<i class="fas fa-download"></i>
</span>
<span>Download DS</span>
</a>
</p>
{% endif %}
<p class="control">
<a href="{{ url_for('remove_movie', movie_id=movie.movie_id) }}"
class="button is-danger">
Expand Down
11 changes: 10 additions & 1 deletion theunderground/movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
save_movie_data,
delete_movie_data,
get_movie_path,
get_ds_movie_path
)
from theunderground.forms import MovieUploadForm
from theunderground.operations import manage_delete_item
Expand Down Expand Up @@ -120,10 +121,18 @@ def add_movie():
def save_movie(movie_id):
movie_dir = get_movie_path(movie_id)
if s3:
return redirect(f"{config.url1_cdn_url}/{movie_dir}/{movie_id}-H.mo")
return redirect(f"{config.url1_cdn_url}/{movie_dir}/{movie_id}-H.mov")

return send_from_directory(movie_dir, f"{movie_id}-H.mov")

@app.route("/theunderground/movies/<movie_id>/save_ds", methods=["GET", "POST"])
@login_required
def save_ds_movie(movie_id):
ds_movie_dir = get_ds_movie_path(movie_id)
if s3:
return redirect(f"{config.url1_cdn_url}/{ds_movie_dir}/{movie_id}.enc")

return send_from_directory(ds_movie_dir, f"{movie_id}.enc")

@app.route("/theunderground/movies/<movie_id>/remove", methods=["GET", "POST"])
@login_required
Expand Down

0 comments on commit 92388d7

Please sign in to comment.