andrewilley Posted July 8, 2022 Share Posted July 8, 2022 @xeon927 Currently PA's matching process is fully automatic, there is no way to adjust from the default method of matching the filename and containing folder, which at the time of implementation was considered pretty-much foolproof. However there have been a couple of very rare cases in the wild which cause mis-matches, such as yours and the instance in this thread: In both cases, the workaround is pretty simple, just make sure the filenames unique. For example, add the band name to the ambiguous song titles (or the whole album if you want it to look consistent) and then use a plain text editor to adjust the playlist file to match with the one you want: Music\Imagine Dragons\Thunder\1-01 - Thunder (Imagine Dragons).flac Music\Gabry Ponte\Thunder\1-01 - Thunder (Gabry Ponte).flac @maxmp Although this issue is very rare, it has happened more than once now. Perhaps it might be worth adjusting the resolving process so if the search returns two or more identical matches in the library, the next folder level up is checked too? Andre Link to comment Share on other sites More sharing options...
Lyt WorkShift Posted April 9, 2023 Share Posted April 9, 2023 make this script below and wala import os # EDIT THESE # EDIT THESE # EDIT THESE # EDIT THESE # EDIT THESE # path to the M3U8 file m3u8_path = "C:\\Users\\___YOUR USERNAME____\\Desktop\\________THE PLAYLIST.m3u8" # directory to search for files in directory = "M:\\" # EDIT THESE # EDIT THESE # EDIT THESE # EDIT THESE # EDIT THESE # list to store the file paths file_paths = [] # read the file names from the M3U8 file with open(m3u8_path, "r", encoding="utf-8") as f: lines = f.readlines() # loop through the lines of the M3U8 file and search for files for i in range(len(lines)): if not lines[i].startswith("#"): file_name = os.path.basename(lines[i].strip()) for root, dirs, files in os.walk(directory): if file_name in files: file_path = os.path.join(root, file_name) file_paths.append(file_path.replace("M:\\", "")) break # update the lines of the M3U8 file with the file paths for i in range(len(lines)): if not lines[i].startswith("#"): if file_paths: lines[i] = file_paths.pop(0) + "\n" else: break # write the updated M3U8 file back to disk with open(m3u8_path, "w", encoding="utf-8") as f: f.writelines(lines) put this file and your playlist on your desktop import os import pathlib import re # get the user's home directory home_dir = pathlib.Path.home() # Edit here # path to the M3U8 file m3u8_path = os.path.join(home_dir, "Desktop", "Playlist.m3u8") # Edit here # directory to search for files in directory = os.path.join("X:\\") # list to store the file paths file_paths = [] # read the file names from the M3U8 file with open(m3u8_path, "r", encoding="utf-8") as f: lines = f.readlines() # loop through the lines of the M3U8 file and search for files for i in range(len(lines)): if not lines[i].startswith("#"): file_name = os.path.basename(lines[i].strip()) for root, dirs, files in os.walk(directory): if file_name in files: file_path = os.path.join(root, file_name) file_paths.append(file_path.replace(directory, "")) break # update the lines of the M3U8 file with the file paths for i in range(len(lines)): if not lines[i].startswith("#"): if file_paths: lines[i] = file_paths.pop(0) + "\n" else: break # write the updated M3U8 file back to disk with open(m3u8_path, "w", encoding="utf-8") as f: f.writelines(lines) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now