INTERACT FORUM

More => Old Versions => JRiver Media Center 28 for Windows => Topic started by: AllanM on October 03, 2021, 03:21:22 pm

Title: How to import iTunes, but ignore playlists?
Post by: AllanM on October 03, 2021, 03:21:22 pm
Is there any way to import from iTunes, but not the playlists? I just want the music and ratings.

If not, anyone have a script to import ratings based on file path? Maybe from a CSV file?
Title: Re: How to import iTunes, but ignore playlists?
Post by: AllanM on October 06, 2021, 08:52:17 am
well, I figured there isn't a way, so I wrote a little python script to remove the playlists from the itunes XML file. Someone else might find this useful

Code: [Select]
#!/usr/bin/env python -X utf8
# as per https://docs.python.org/3/using/windows.html
# use UTF-8 mode in Windows

def excise(filename, filenameOut, start, end):
    with open(filename) as infile, open(filenameOut, "w") as outfile:
        for line in infile:
            if line.strip() == start:
                outfile.write(line)
                outfile.write("\t<array>\n")
                outfile.write("\t</array>\n")
                break
            outfile.write(line)
        for line in infile:
            if line.strip().startswith(end):
                outfile.write(line)
                break
        for line in infile:
            outfile.write(line)

def main():
excise(r"F:\Music\ALAC Library\iTunes Library.xml",r"F:\Music\ALAC Library\iTunes Library.out.xml",  "<key>Playlists</key>", "<key>Music Folder</key><string>")

if __name__== "__main__":
    main()