diff options
author | Mageas <web.mageas@protonmail.com> | 2021-09-09 09:56:46 +0200 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2021-09-10 17:58:21 -0500 |
commit | 66f396ce32bf2b5c869e63ceb649bbcf510d7034 (patch) | |
tree | c1ba1c006d3e4497041e8e4d8f72559d3d57c8ec /youtube/local_playlist.py | |
parent | 88803ced44ff7347df83c3d342e17916e242ca67 (diff) | |
download | yt-local-66f396ce32bf2b5c869e63ceb649bbcf510d7034.tar.lz yt-local-66f396ce32bf2b5c869e63ceb649bbcf510d7034.tar.xz yt-local-66f396ce32bf2b5c869e63ceb649bbcf510d7034.zip |
Add a button to remove playlist
Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'youtube/local_playlist.py')
-rw-r--r-- | youtube/local_playlist.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/youtube/local_playlist.py b/youtube/local_playlist.py index 40ff035..aa3ac27 100644 --- a/youtube/local_playlist.py +++ b/youtube/local_playlist.py @@ -153,6 +153,12 @@ def path_edit_playlist(playlist_name): number_of_videos_remaining = remove_from_playlist(playlist_name, videos_to_remove) redirect_page_number = min(int(request.values.get('page', 1)), math.ceil(number_of_videos_remaining/50)) return flask.redirect(util.URL_ORIGIN + request.path + '?page=' + str(redirect_page_number)) + elif request.values['action'] == 'remove_playlist': + try: + os.remove(os.path.join(playlists_directory, playlist_name + ".txt")) + except OSError: + pass + return flask.redirect(util.URL_ORIGIN + '/playlists') elif request.values['action'] == 'export': videos = read_playlist(playlist_name) fmt = request.values['export_format'] |