INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: How to import iTunes, but ignore playlists?  (Read 455 times)

AllanM

  • Junior Woodchuck
  • **
  • Posts: 80
How to import iTunes, but ignore playlists?
« 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?
Logged
--
Mostly a headphone guy. I use JRiver exclusively for music.

AllanM

  • Junior Woodchuck
  • **
  • Posts: 80
Re: How to import iTunes, but ignore playlists?
« Reply #1 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()
Logged
--
Mostly a headphone guy. I use JRiver exclusively for music.
Pages: [1]   Go Up