Skip to content

Commit

Permalink
+
Browse files Browse the repository at this point in the history
  • Loading branch information
Ixiko committed Jan 27, 2020
1 parent b7b1a3a commit fc828aa
Show file tree
Hide file tree
Showing 71 changed files with 17,215 additions and 2 deletions.
28 changes: 28 additions & 0 deletions classes/_docs/class_BSON_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# BSON.ahk
BSON.ahk is a small(-ish) AHK library for loading/dumping objects in the [BSON](http://bsonspec.org/) format.

## How to use
Just copy the the `\lib` folder into the same folder as your script, and add `#Include <BSON>` to your script, then you can call the various methods of the `BSON` class.

## Methods

### Dumping
`BSON.Dump(Object)` will dump the object into BSON, and then return an array of bytes containing the BSON representation of the object.

`BSON.Dump.ToFile(FilePath, Object)` will do the same as `BSON.Dump()`, but will write the bytes directly into a file.

`BSON.Dump.ToHexString(Object)` also does the same as `BSON.Dump()`, but converts the array of bytes into hex, builds a string out of each byte, seperated by a space.

### Loading
`BSON.Load(Bytes)` expects an array of bytes (Like the one `BSON.Dump(Object)` returns), and will return the decoded BSON as an AHK object.

`BSON.Load.FromFile(FilePath)` will read the BSON data from the given file, and then return the decoded BSON as an AHK object.

`BSON.Load.FromHexString(String)` will convert the hex data back into binary, load it, and then return the decoded BSON as (you guessed it) an AHK object.

## Dependencies
All dependencies are included in `\lib`, and are also written by me; however, they are not on github since they are just quick helpers.

`Conversions.ahk` is required to load/dump hex encoded BSON.

`ScanningBuffer.ahk` is required to reuse the same code for loading from a file to load from any buffer in memory. By implementing (almost) all File Object methods, the `ScanningBuffer` class can be swapped in/out for File Objects inside of the internal BSON parsing methods.
72 changes: 72 additions & 0 deletions classes/_docs/class_DSVParser_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# DSVParser-AHK

A simple utility for parsing delimiter-separated values (i.e., DSV) in
AutoHotkey scripts, whether that be comma-separated (i.e., CSV), tab-separated
(i.e., TSV), or something else, possibly even exotic ones.

## Features

- [RFC 4180](https://tools.ietf.org/html/rfc4180) compliant.
- Supports newlines and other weird characters in cells enclosed in [text
qualifiers](https://www.quora.com/What-is-a-text-qualifier).
- Allows custom delimiters and text qualifiers.
- Supports multiple delimiters (like Microsoft Excel).
- Supports multiple qualifiers (unlike Microsoft Excel).
- Proper support for malformed inputs (e.g., `"hello" world "foo bar"` will be
parsed as `hello world "foo bar"`).
- Achieved by treating cells as composed of two components: a
text-qualified part (i.e., any raw string, excluding unescaped qualifier
characters), and a delimited text part (i.e., any raw string, including
qualifier characters, except newlines and delimiter characters).
- The behavior for ill-formed cells are therefore not undefined.
- The above treatment is also similar to that of Microsoft Excel.
- Recognizes many ASCII and Unicode line break representations:
- i.e., `CR`, `LF`, `CR+LF`, `LF+CR`, `VT`, `FF`, `NEL`, `RS`, `GS`,
`FS`, `LS`, `PS`
- References:
- [Newline - Wikipedia](https://en.wikipedia.org/wiki/Newline)
- [Field separators | C0 and C1 control codes -
Wikipedia](https://en.wikipedia.org/wiki/C0_and_C1_control_codes#Field_separators)
- [`str.splitlines([keepends])` | Built-in Types — Python 3.8.0
documentation](https://docs.python.org/3/library/stdtypes.html#str.splitlines)

## Example

### Basic usage

```AutoHotkey
; Load a TSV data string
FileRead tsvStr, data.tsv
; Parse the TSV data string
MyTable := TSVParser.ToArray(tsvStr)
; Do something with `MyTable`
MsgBox % MyTable[2][1] ; Access 1st cell of 2nd row
; ... do something else with `MyTable` ...
; Convert into a CSV, with custom line break settings
csvStr := CSVParser.FromArray(MyTable, "`n", false)
FileDelete new-data.csv
FileAppend %csvStr%, *new-data.csv
```

### And there's more!

Both `TSVParser` and `CSVParser` are premade instances of the class `DSVParser`.
To read and write in other formats, create a new instance of `DSVParser` and
specify your desired configuration.

Here's a `DSVParser` for pipe-separated values (aka., bar-separated):

```AutoHotkey
global BSVParser := new DSVParser("|")
```

Many more utility functions are provided for parsing and formatting DSV strings,
including parsing just a single DSV cell.

Check out the source code! It's really just a tiny file.
21 changes: 21 additions & 0 deletions classes/_docs/class_Spotify_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Spotify.ahk

Disclaimer: Some features of Spotify.ahk will not work for non-premium users, this is not a limition of Spotify.ahk, but a limit in Spotify's Connect Web API as stated in its documentation.
```
Note:
With Connect Web API you can only control Spotify Premium users’ playback.
```

An AutoHotkey wrapper for the Spotify web API designed to allow control over Spotify's internal volume slider and provide various other functionality.

Uses a slightly modified version of the [AHKhttp library by zhamlin](https://github.com/zhamlin/AHKhttp), the [AHKsock library by jleb](https://github.com/jleb/AHKsock) and the [Cyrpt library by Deo](https://autohotkey.com/board/topic/67155-ahk-l-crypt-ahk-cryptography-class-encryption-hashing/)

### Documentation can now be found [here](https://cloakersmoker.github.io/Spotify.ahk/index.html), however it is not complete.

#### How to use
Create a new Spotify object, and call methods from the various nested classes. Examples can been seen in the Example Hotkeys file and throughout the documentation.

When you create a new Spotify object for the first time, a Spotify app authorization page will open in your default browser, and you will be prompted to authorize `Spotify.ahk`.
While you can choose not to authorize Spotify.ahk, all functionality will be lost without valid authorization.

You will only rarely need to do web authorization thanks to Spotify's refreshable user authorization.
6 changes: 6 additions & 0 deletions classes/_examples/class_BSON_Example.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Include <BSON>

S := BSON.Dump.ToHexString({"Abc": "efg", "Hi": {"bye": 10}})
MsgBox, % S
O := BSON.Load.FromHexString(S)
MsgBox, % O.Abc "`n" O.Hi.bye
Loading

0 comments on commit fc828aa

Please sign in to comment.