Skip to content

Commit

Permalink
Append playlist absolute patch if the path to the file is not absolute
Browse files Browse the repository at this point in the history
  • Loading branch information
son-link committed Dec 24, 2023
1 parent 26e10fb commit ca7448a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion PQMusic/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
remove,
environ,
)
from os.path import isfile
from os.path import isfile, dirname
from PyQt5 import QtDBus, QtCore
import psutil
from random import randint
Expand Down Expand Up @@ -110,6 +110,7 @@ def openM3U(file):

tracks = []
if Path(file).is_file() and access(file, R_OK):
folder = dirname(file)
with open(file, encoding='utf-8', errors="ignore") as m3u:
have_info = False
track_info = {
Expand Down Expand Up @@ -143,6 +144,7 @@ def openM3U(file):
track_info['notags'] = trackname
have_info = True
else:
line = line if line.startswith('/') else f'{folder}/{line}'
have_info = False
if Path(line).is_file():
track_info['notags'] = Path(line).stem
Expand All @@ -151,6 +153,7 @@ def openM3U(file):
track_info = {}
else:
have_info = False
line = line if line.startswith('/') else f'{folder}/{line}'
if Path(line).is_file():
track_info['file'] = line
tracks.append(track_info)
Expand Down

0 comments on commit ca7448a

Please sign in to comment.