beets icon indicating copy to clipboard operation
beets copied to clipboard

Allow user to use m3u in relative_to to create playlists relative to m3u_path

Open fbievan opened this issue 1 year ago • 4 comments

Allow user to use m3u in relative_to to create playlists relative to

Description

Allows the user to use "m3u" in relative_to to create playlists which use paths relative to where the playlists are located, even if they are in subdirectories, for example, this allows users to have a working playlist config like

smartplaylist:
    target_dir: ~/Music
    relative_to: m3u
    #relative_to: ~/Music/Playlists
    playlist_dir: ~/Music/Playlists
    forward_slash: no
    playlists:
        - name: 'Genres/$genre/$genre.m3u'
          query: ''

And have it actually work

This is something that Still needs some work, and I haven't tested everything, but it works for my purposes, but I haven't tested everything. This is my first attempt at this, so it's rough, and needs alot of work... I want to see if anyone else is interested in this, so I can work on it more, or not

I haven't contributed to a python project before, so sorry if im a little disorganized... this is my first time doing stuff in python, so hope it's fine :)

To Do

  • [ ] Documentation. (If you've added a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • [x] Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • [ ] Tests. (Very much encouraged but not strictly required.)

fbievan avatar Jul 20 '24 22:07 fbievan

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

github-actions[bot] avatar Jul 20 '24 22:07 github-actions[bot]

A more proper solution would be to process m3u_paths before processing the relative_to paths, but I didn't really want to make major changes to the codebase.

I couldn't find any related issues, and was kinda scared to make my own, so I just made my own solution to this...

Testing on windows, and the other options, would be nice :)

I just found poe

fbievan avatar Jul 20 '24 22:07 fbievan

I linted and fixed the formatting, and also adding something in the changelog, I am not really good at writing docs, hope someone finds use out of this, atleast other than me :)

I'm fixing other things currently

fbievan avatar Jul 20 '24 22:07 fbievan

A cleaner solution would be nice, but this works for me

Plus, this stores the filepath as 'm3u' in the database, but I think that otherwise, it would require a restructuring of the codebase to do otherwise

fbievan avatar Jul 21 '24 01:07 fbievan