<commit_before># KKBOX Playlist Library (KBL) Generator

A simple gem to generate KKBOX Playlist Library (KBL) files.

:warning: **[WARNING]** This program is made by reverse-engineering the KBL files. It does not guarantee that the generated KBL files is fully-compatible with KKBOX client. Use it AT YOUR OWN RISK!.

## Installation

Add this line to your application's Gemfile:

    gem 'kbl'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install kbl

## Usage

**Important**: Read **Required Song Meta Data** section before you start generating a KBL file.

```rb
kbl = KBL::Package.new do |package|
  package.add_playlist do |playlist|
    playlist.name = "Playlist A"
    playlist.description = "A Sample Playlist"

    playlist.add_song do |song|
      song.name     = ""
      song.pathname = entry.song_id
      song.artist   = entry.artist
      song.album    = entry.album_name
      song.album_id = entry.album_id
    end
  end
end

puts kbl.to_kbl #=> the KBL source code (in XML)
```

## Required Song Meta Data

To generate a working KBL file, the following data for every song must be provided.

* **pathname** - The Song ID
* **album_id** - The Album ID
* **artist_id** - The Artist ID

If there is only `pathname`, the User Interface will work in strange behavior, if these songs has never been played in your KKBOX client, or was removed from your KKBOX client library before.

Additionally, add these data to avoid blank name, album and artist names, when importing unknown songs to the KKBOX client:

* **name** - The name of that song.
* **album** - The album name.
* **artist** - The artist name.

## Glossary

### Package

A package of KBL.

Can contain multiple playlists, which will be imported as individual playlists when the KBL file is imported to KKBOX client.

### Playlist

A playlist entry containing one or more songs.

It is recommended to assign name for it so that when importing, it will be showed up in the playlists sidebar.

### Song

A song entry.

Can exist multiple times across multiple playlists.

## Contributing

1. Fork it ( http://github.com/<my-github-username>/kbl/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## TODO

* Make a CLI tool for generating KBL files.
* Scraping meta data from KKBOX client database from given Song IDs.<commit_msg>correct README.md<commit_after># KKBOX Playlist Library (KBL) Generator

A simple gem to generate KKBOX Playlist Library (KBL) files.

:warning: **[WARNING]** This program is made by reverse-engineering the KBL files. It does not guarantee that the generated KBL files is fully-compatible with KKBOX client. Use it AT YOUR OWN RISK!.

## Installation

Add this line to your application's Gemfile:

    gem 'kbl'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install kbl

## Usage

**Important**: Read **Required Song Meta Data** section before you start generating a KBL file.

```rb
kbl = KBL::Package.new do |package|
  package.add_playlist do |playlist|
    playlist.name = "Playlist A"
    playlist.description = "A Sample Playlist"

    playlist.add_song do |song|
      song.name      = "君の知らない物語"
      song.pathname  = "3665602"
      song.artist    = "Supercell"
      song.artist_id = "197227"
      song.album     = "Today Is A Beautiful Day"
      song.album_id  = "314546"
    end
  end
end

puts kbl.to_kbl #=> the KBL source code (in XML)
```

## Required Song Meta Data

To generate a working KBL file, the following data for every song must be provided.

* **pathname** - The Song ID
* **album_id** - The Album ID
* **artist_id** - The Artist ID

If there is only `pathname`, the User Interface will work in strange behavior, if these songs has never been played in your KKBOX client, or was removed from your KKBOX client library before.

Additionally, add these data to avoid blank name, album and artist names, when importing unknown songs to the KKBOX client:

* **name** - The name of that song.
* **album** - The album name.
* **artist** - The artist name.

## Glossary

### Package

A package of KBL.

Can contain multiple playlists, which will be imported as individual playlists when the KBL file is imported to KKBOX client.

### Playlist

A playlist entry containing one or more songs.

It is recommended to assign name for it so that when importing, it will be showed up in the playlists sidebar.

### Song

A song entry.

Can exist multiple times across multiple playlists.

## Contributing

1. Fork it ( http://github.com/chitsaou/kbl-generator/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## TODO

* Make a CLI tool for generating KBL files.
* Scraping meta data from KKBOX client database from given Song IDs.
{'fraction_non_alphanumeric': 0.08498808578236695, 'fraction_numerical': 0.005758538522637013, 'mean_word_length': 3.533753375337534, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2585871', 'n_tokens_mistral': 1553, 'n_tokens_neox': 1474, 'n_words': 697}