Skip to content

Commit

Permalink
fix #245 part 1 default save location to common path between all files
Browse files Browse the repository at this point in the history
  • Loading branch information
xjiro authored and phw committed Jan 5, 2024
1 parent e9a1a23 commit 72d7753
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions plugins/playlist/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# GNU General Public License for more details.

PLUGIN_NAME = "Generate M3U playlist"
PLUGIN_AUTHOR = "Francis Chin, Sambhav Kothari"
PLUGIN_AUTHOR = "Francis Chin, Sambhav Kothari, Chris Hylen"
PLUGIN_DESCRIPTION = """Generate an Extended M3U playlist (.m3u8 file, UTF8
encoded text). Relative pathnames are used where audio files are in the same
directory as the playlist, otherwise absolute (full) pathnames are used."""
Expand Down Expand Up @@ -76,9 +76,15 @@ class GeneratePlaylist(BaseAction):
NAME = "Generate &Playlist..."

def callback(self, objs):
current_directory = (self.config.persist["current_directory"]
or QtCore.QDir.homePath())
current_directory = find_existing_path(current_directory)
# Find common path of all files to default where to save playlist
files = []
for album in objs:
for track in album.tracks:
if track.linked_files:
files.append(track.linked_files[0].filename)

current_directory = os.path.commonpath(files)

# Default playlist filename set as "%albumartist% - %album%.m3u8",
# except where "Various Artists" is suppressed
if _debug_level > 1:
Expand Down

0 comments on commit 72d7753

Please sign in to comment.