mps-youtube / yewtube

yewtube, forked from mps-youtube , is a Terminal based YouTube player and downloader. No Youtube API key required.
GNU General Public License v3.0
8.07k stars 648 forks source link

Save playlist without specifying name will always ignore last_opened playlist #1048

Open kz6wk9 opened 4 years ago

kz6wk9 commented 4 years ago

The save command when used without any argument will always save the new playlist name using the artist name in the first position(18 chars), completely ignoring the last_opened playlist, it doesn't matter if it exists or not.

How to reproduce

$ mpsyt   ## Opening

> ls   ## List all local playlits

Local Playlists

      ID  Name                Count   Duration

      1   Alternative-Rock    1       00:04:30
      2   Comedy-Rock         1       00:03:00
      3   Country-Rap         1       00:02:30
      4   Dance-Electronic    4       00:08:00

> open 4   ## Opening playlist of index 4

      Num  Title                    Length
       1   a title                  02:00
       2   another                  02:00
       3   yet another title        02:00
       4   some fourth title        02:00

Loaded playlist Dance-Electronic as current playlist

> rm 4   ## Removing entry of index 4

      Num  Title                    Length
       1   a title                  02:00
       2   another                  02:00
       3   yet another title        02:00

1 tracks removed (4)

> save   ## Saving with no arguments

      Num  Title                    Length
       1   a title                  02:00
       2   another                  02:00
       3   yet another title        02:00

Playlist saved as **a-title**.  Use ls to list playlists

> ls   ## Listing playlits again

      ID  Name                Count   Duration

      1   Alternative-Rock    1       00:04:30
      2   Comedy-Rock         1       00:03:00
      3   Country-Rap         1       00:02:30
      4   Dance-Electronic    4       00:08:00
      5   a-title             3       00:06:00

I don't know if this is the best thing to do or not... from where I see it is not, because when someone is working(removing or moving things) inside a local playlist, the expected behavior would be to save that same playlist, not another one with some other name matching the first 18 characters of the first indexed title, this doesn't make much sense to me in this context. Probably would make sense in other cases like if the list is not a local playlist, but a search list for example, then the save command would be free to use the first 18 chars of index 1 to save the newly created playlist if none is specified.

Let me know if my logic is wrong or not from your point of view guys, thank you !