@tyleretters/discography 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/convert.py CHANGED
@@ -6,22 +6,27 @@ convert the yml to json.
6
6
  see README.md for more information.
7
7
  '''
8
8
 
9
+ import os
9
10
  import yaml
10
11
  import json
11
12
  import re
12
13
  import hashlib
13
14
  from datetime import datetime
14
15
 
15
- def make_id(str):
16
- md5_hash = hashlib.md5()
17
- md5_hash.update(str.encode("utf-8"))
18
- return md5_hash.hexdigest()
16
+ dir_path = os.path.dirname(os.path.realpath(__file__))
17
+ yml_path = dir_path + "/" + "discography.yml"
18
+ ts_path = dir_path + "/" + "discography.ts"
19
19
 
20
20
  special_maps = {
21
21
  "ΑΙΓΑΙΙΣ": "AIGAIIS",
22
22
  "nausicaä": "nausicaa"
23
23
  }
24
24
 
25
+ def make_id(str):
26
+ md5_hash = hashlib.md5()
27
+ md5_hash.update(str.encode("utf-8"))
28
+ return md5_hash.hexdigest()
29
+
25
30
  def make_slug(str):
26
31
  if str in special_maps:
27
32
  str = special_maps[str]
@@ -35,7 +40,7 @@ def make_slug(str):
35
40
  return str
36
41
 
37
42
  # load data
38
- with open("./data.yml", "r") as yml_file:
43
+ with open(yml_path, "r") as yml_file:
39
44
  data = yaml.safe_load(yml_file)
40
45
 
41
46
  # enrich data
@@ -59,6 +64,15 @@ for release in data:
59
64
  # generate an id (ARTIST + RELEASE + NUMBER + TITLE + LENGTH)
60
65
  track["id"] = make_id(release["project"] + release["title"] + str(track["number"]) + track["title"] + track["length"])
61
66
 
62
- # write data
63
- with open("../dist/data.json", "w") as json_file:
64
- json.dump(data, json_file, indent=2)
67
+ # write discography data
68
+ with open(ts_path, "w") as json_file:
69
+ json.dump(data, json_file, indent=2)
70
+
71
+ # make it a js export
72
+ with open(ts_path, "r") as file:
73
+ existing_contents = file.read()
74
+
75
+ with open(ts_path, "w") as file:
76
+ new_string = "export const discography = "
77
+ file.write(new_string)
78
+ file.write(existing_contents)
@@ -1,4 +1,4 @@
1
- [
1
+ export const discography = [
2
2
  {
3
3
  "title": "IN DARKNESS RADIANT",
4
4
  "project": "STUXNET",
@@ -162,7 +162,7 @@
162
162
  "id": "02cd98a73d97e2e915afc5da5d4eb7f3"
163
163
  },
164
164
  {
165
- "title": "FCV",
165
+ "title": "FCIV",
166
166
  "project": "Sidereal Lobby",
167
167
  "released": "02021-09-04",
168
168
  "type": "Triple LP",
@@ -175,28 +175,28 @@
175
175
  "title": "Mental Dub (Lisbon)",
176
176
  "length": "00:04:18",
177
177
  "track_slug": "mental-dub-lisbon",
178
- "id": "1571a6c372a8858410e2524488ad5c59"
178
+ "id": "3bf748959775ac0693551fafb0b0c5f4"
179
179
  },
180
180
  {
181
181
  "number": 2,
182
182
  "title": "Mental Dub (Des Moines)",
183
183
  "length": "00:04:10",
184
184
  "track_slug": "mental-dub-des-moines",
185
- "id": "7d5dc890e378614d331ac496229c5018"
185
+ "id": "7beb9360e3ece1b46c64ccd5200a6d48"
186
186
  },
187
187
  {
188
188
  "number": 3,
189
189
  "title": "Mental Dub (Null Lake)",
190
190
  "length": "00:04:20",
191
191
  "track_slug": "mental-dub-null-lake",
192
- "id": "4b3bd99c1714cb8d55166b7d184086c4"
192
+ "id": "787697adcb5356df5c68c444d3a8b49e"
193
193
  }
194
194
  ],
195
195
  "notes": "Dub is a refraction of alien consciousness\nFlash Crash was approaching. The folks running the event wanted dub in their interstitial program. I complied.\nIt began with Mental Dub, constructed entirely in Ableton Live with stock samples and soft synths. The other human loaded its stems into his Octatrack for further mutation, which became Des Moines. The first human further mutated Des Moines within Ableton to create Null Lake. The humans had little hesitation about mix or levels.\nOne (and only one) of the humans does have a bit of regret that Mental Dub Lisbon was 100% created by them and not the other. In other words, the other did not have any samples, or audio, or melody at all, but both humans concurred it was OK because it all took place in the Sidereal Lobby.\nMost of the above thoughts were originally transcribed via text-to-speech processing in a Taco Bell parking lot. The allure of Baja Blast is known to be irresistible to sidereal lobbyists.\n",
196
196
  "credits": "Laws & Etters, mmxxi\n",
197
- "release_slug": "fcv",
197
+ "release_slug": "fciv",
198
198
  "project_slug": "sidereal-lobby",
199
- "id": "85816db77f837fdb55aa5bd1ac983273"
199
+ "id": "059fb2cd3faa8fa9af2b1364c1190abe"
200
200
  },
201
201
  {
202
202
  "title": "Beaches",
@@ -125,7 +125,7 @@
125
125
  credits: |
126
126
  Laws & Etters, mmxxi
127
127
 
128
- - title: FCV
128
+ - title: FCIV
129
129
  project: Sidereal Lobby
130
130
  released: 02021-09-04
131
131
  type: Triple LP
package/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { Release, Track } from './types'
2
+ import { discography } from './discography'
3
+
4
+ export default discography
5
+ export type { Release, Track }
package/src/types.ts ADDED
@@ -0,0 +1,23 @@
1
+ export interface Release {
2
+ title: string
3
+ project: string
4
+ released: string
5
+ type: string
6
+ format: string
7
+ role: string
8
+ label: string
9
+ tracks: Array<Track>
10
+ notes: string
11
+ credits: string
12
+ release_slug: string
13
+ project_slug: string
14
+ id: string
15
+ }
16
+
17
+ export interface Track {
18
+ number: number
19
+ title: string
20
+ length: string
21
+ track_slug: string
22
+ id: string
23
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "outDir": "dist",
4
+ "module": "esnext",
5
+ "target": "es5",
6
+ "lib": ["es6", "dom", "es2016", "es2017"],
7
+ "sourceMap": true,
8
+ "allowJs": false,
9
+ "declaration": true,
10
+ "moduleResolution": "node",
11
+ "forceConsistentCasingInFileNames": true
12
+ },
13
+ "include": ["src/**/*.ts"],
14
+ "exclude": ["node_modules", "dist", "rollup.config.js"]
15
+ }