Ejemplo n.º 1
0
def clear_movie_files(preview_file_id):
    """
    Remove all files related to given preview file, supposing the original file
    was a movie.
    """
    try:
        file_store.remove_movie("previews", preview_file_id)
    except:
        pass
    for image_type in ["thumbnails", "thumbnails-square", "previews"]:
        try:
            file_store.remove_picture(image_type, preview_file_id)
        except:
            pass
Ejemplo n.º 2
0
def remove_build_job(playlist, build_job_id):
    """
    Remove build job from database and remove related temporary file from
    hard drive.
    """
    job = BuildJob.get(build_job_id)
    movie_file_path = get_playlist_movie_file_path(playlist, job.serialize())
    if os.path.exists(movie_file_path):
        os.remove(movie_file_path)
    file_store.remove_movie("playlists", build_job_id)
    job.delete()
    events.emit("build-job:delete", {
        "build_job_id": build_job_id,
        "playlist_id": playlist["id"]
    })
    return movie_file_path
Ejemplo n.º 3
0
def remove_build_job(playlist, build_job_id):
    """
    Remove build job from database and remove related temporary file from
    hard drive.
    """
    job = BuildJob.get(build_job_id)
    movie_file_path = get_playlist_movie_file_path(playlist, job.serialize())
    if os.path.exists(movie_file_path):
        os.remove(movie_file_path)
    try:
        file_store.remove_movie("playlists", build_job_id)
    except:
        current_app.logger.error("Playlist file can't be deleted: %s" %
                                 build_job_id)
    job.delete()
    events.emit("build-job:delete", {
        "build_job_id": build_job_id,
        "playlist_id": playlist["id"]
    },
                project_id=playlist["project_id"])
    return movie_file_path