All Projects → cvzi → Itunes_smartplaylist

cvzi / Itunes_smartplaylist

Licence: mit
iTunes Smart playlist parser with Python. Convert to Kodi xsp smart playlists.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Itunes smartplaylist

Freeiptv
FreeIPTV • Watch Free IPTV World Wide
Stars: ✭ 68 (+580%)
Mutual labels:  kodi, playlist
Teslatunes
Copy your iTunes library, automatically converting Apple Lossless to flac, to a destination for use with your Tesla Model S
Stars: ✭ 37 (+270%)
Mutual labels:  itunes, playlist
Atldotnet
Fully managed, portable and easy-to-use C# library to read and edit audio data and metadata (tags) from various audio formats, playlists and CUE sheets
Stars: ✭ 180 (+1700%)
Mutual labels:  parser, playlist
Alltomp3
Node module to download and convert in MP3 with tags an online video
Stars: ✭ 120 (+1100%)
Mutual labels:  itunes, playlist
Countries
Free legally receivable IPTV channels as .m3u for Kodi. :-)
Stars: ✭ 657 (+6470%)
Mutual labels:  kodi, playlist
Jkt
Simple helper to parse JSON based on independent schema
Stars: ✭ 22 (+120%)
Mutual labels:  parser
Nakamori
Nakamori is Kodi addon that use Shoko (known as Japanese Media Manager (JMM)) Server as back-end for metadata information.
Stars: ✭ 24 (+140%)
Mutual labels:  kodi
Combine
A parser combinator library for Rust
Stars: ✭ 906 (+8960%)
Mutual labels:  parser
Mico
Mico ("Monkey" in catalan). Monkey language implementation done with C++. https://interpreterbook.com/
Stars: ✭ 19 (+90%)
Mutual labels:  parser
Html React Parser
📝 HTML to React parser.
Stars: ✭ 846 (+8360%)
Mutual labels:  parser
Metric Parser
📜 AST-based advanced mathematical parser written by Typescript.
Stars: ✭ 26 (+160%)
Mutual labels:  parser
Taro scaffold
基于 Taro / dva / redux-saga / react 的微信小程序脚手架,同时集成了 sprite 。
Stars: ✭ 24 (+140%)
Mutual labels:  base64
Radon
A scripting language.
Stars: ✭ 22 (+120%)
Mutual labels:  parser
Badx12
A Python Library for parsing ANSI ASC X12 files.
Stars: ✭ 25 (+150%)
Mutual labels:  parser
Graphql Mst
Convert GraphQL to mobx-state-tree models
Stars: ✭ 22 (+120%)
Mutual labels:  parser
Parse Code Context
Parse code context in a single line of javascript, for functions, variable declarations, methods, prototype properties, prototype methods etc.
Stars: ✭ 7 (-30%)
Mutual labels:  parser
Allthefeels
Alexa prompts the user how his/her day is going, then depending on the sentiment expressed by the user, it produces a list of regularly-updated Spotify playlists tailored to his/her mood
Stars: ✭ 19 (+90%)
Mutual labels:  playlist
Hxd Plugin
Handy HxD plugin for various conversions like base64
Stars: ✭ 24 (+140%)
Mutual labels:  base64
Kodi Rc6 Mce Nolirc
Files required to use most RC6 MCE remotes with Kodi and Ubuntu 17, without LIRC
Stars: ✭ 26 (+160%)
Mutual labels:  kodi
Itunescontrol
[Unmaintained] Global Hotkeys for iTunes
Stars: ✭ 23 (+130%)
Mutual labels:  itunes

iTunes Smartplaylist parser

itunessmart on PyPI Python Versions Coverage Status Codacy Badge Build Status

Convert smart playlist information to a readable form.

This module is a Python 3 implementation, based on banshee-itunes-import-plugin by Scott Peterson.

It was tested on Windows 10 with iTunes 12.9.6.3 (64bit) and Python 3.6.

It does not work with Python 2.x.

Kodi smart playlists

You can convert all your iTunes smart playlists to Kodi smart playlists with this interactive script:

python3 utils/export_xsp.py or python3 -m itunessmart

Then place the resulting .xsp files from out/ in your userdata folder.

Most of the common functions and rules are available in both formats and often iTunes playlists are fully convertible to Kodi.
The biggest difference are nested rules in iTunes which are not available in Kodi. However, nested rules can be simulated with sub-playlists. These "helper"-playlists are named with the prefix "zzzsub_" and a MD5 hash of its rules. When you run utils/export_xsp.py, you can disable generation of subplaylists.

More information on Kodie smart playlists:
http://kodi.wiki/view/smart_playlists#Format_of_a_smart_playlist_file

Text export

To export all playlists to text files, use python3 utils/export.py

The format

Smart playlist data in iTunes is saved in the iTunes Music Library.xml file.

The data in the playlist entry in the xml file is base64 encoded binary data:

<dict>
	<key>Name</key><string>Example</string>
	<key>Playlist ID</key><integer>123456</integer>
	<key>Playlist Persistent ID</key><string>49C97D85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AAAAAAAAAAAAAAAAAFgAAABAAAAAAAAAAAAAAAAAAAAAAAAA
	AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAEQAAAAAAAAAAAAAAAAAAAAEA
	AAAAAAAAEQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABYAAAAQAAAAA
	AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEAAAAAAAAABIAAA
	AAAAAAAAAAAAAAAAABAAAAAAAAABIAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAA
	AAAAAAAAZAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
	AAAARAAAAAAAAABZAAAAAAAAAAAAAAAAAAAAAQAAAAAAAABZAAAAAAAAAAAAAAAAAAAAAQAAA
	AAAAAAAAAAAAAAAAAAAAAAA
	</data>
	<key>Playlist Items</key>
	<array>
		<dict>
			<key>Track ID</key><integer>123</integer>
		</dict>
		<dict>
			<key>Track ID</key><integer>124</integer>
		</dict>
		<dict>
		...
		<dict>
	</array>
</dict>

It can be converted into three different output formats:

import itunessmart
info = "AQEAAwAAAAIAAAAZ..."
criteria = "U0xzdAABAAEAAAAD..."
parser = itunessmart.Parser(info, criteria)
result = parser.result
print(result.output)
print(result.query)
print(json.dumps(result.queryTree, indent=2))

A text format:

Plays is greater than 15 and
[
	Plays is greater than 16 or
	Plays is greater than 17 or
	Plays is greater than 18
] and
Rating is greater than 4

A sql-like format:

(Plays > 15) AND ( (Plays > 16) OR (Plays > 17) OR (Plays > 18) ) AND (Rating > 4)

And two tree structures

{
  "tree": {
    "and": [
      [
        "Plays",
        "(Plays > 15)"
      ],
      {
        "or": [
          [
            "Plays",
            "(Plays > 16)"
          ],
          [
            "Plays",
            "(Plays > 17)"
          ],
          [
            "Plays",
            "(Plays > 18)"
          ]
        ]
      },
      [
        "Rating",
        "(Rating > 4)"
      ]
    ]
  },
  "liveupdate": true,
  "onlychecked": false
}
{
  "fulltree": {
    "and": [
      {
        "field": "Plays",
        "type": "int",
        "operator": "greater than",
        "value": 15
      },
      {
        "or": [
          {
            "field": "Plays",
            "type": "int",
            "operator": "greater than",
            "value": 16
          },
          {
            "field": "Plays",
            "type": "int",
            "operator": "greater than",
            "value": 17
          },
          {
            "field": "Plays",
            "type": "int",
            "operator": "greater than",
            "value": 18
          }
        ]
      },
      {
        "field": "Rating",
        "type": "int",
        "operator": "greater than",
        "value": 4
      }
    ]
  }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].