@tyleretters/discography 0.0.19 → 0.0.21
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/dist/discography.d.ts +35 -1
- package/dist/discography.js +147 -18
- package/dist/discography.js.map +1 -1
- package/dist/index.js +147 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/convert.py +16 -3
- package/src/discography.ts +147 -18
- package/src/discography.yml +17 -17
package/package.json
CHANGED
package/src/convert.py
CHANGED
|
@@ -18,19 +18,24 @@ dir_path = os.path.dirname(os.path.realpath(__file__))
|
|
|
18
18
|
yml_path = dir_path + "/" + "discography.yml"
|
|
19
19
|
ts_path = dir_path + "/" + "discography.ts"
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
special_slug_maps = {
|
|
22
22
|
"ΑΙΓΑΙΙΣ": "AIGAIIS",
|
|
23
23
|
"nausicaä": "nausicaa"
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
# there are some encoding issues with the # character
|
|
27
|
+
special_title_maps = {
|
|
28
|
+
'A White USB Drive With "HEXAGON" iStock Logo \#1135496271': 'A White USB Drive With "HEXAGON" iStock Logo #1135496271'
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
def make_id(str):
|
|
27
32
|
md5_hash = hashlib.md5()
|
|
28
33
|
md5_hash.update(str.encode("utf-8"))
|
|
29
34
|
return md5_hash.hexdigest()
|
|
30
35
|
|
|
31
36
|
def make_slug(str):
|
|
32
|
-
if str in
|
|
33
|
-
str =
|
|
37
|
+
if str in special_slug_maps:
|
|
38
|
+
str = special_slug_maps[str]
|
|
34
39
|
str = str.lower()
|
|
35
40
|
# convert & to and
|
|
36
41
|
str = re.sub(r'&', 'and', str)
|
|
@@ -42,6 +47,11 @@ def make_slug(str):
|
|
|
42
47
|
str = re.sub(r'--+', '-', str)
|
|
43
48
|
return str
|
|
44
49
|
|
|
50
|
+
def make_track_title(str):
|
|
51
|
+
if str in special_title_maps:
|
|
52
|
+
return special_title_maps[str]
|
|
53
|
+
return str
|
|
54
|
+
|
|
45
55
|
def make_html_paragraphs(str):
|
|
46
56
|
str = str.rstrip("\n")
|
|
47
57
|
str = "<p>" + str + "</p>"
|
|
@@ -104,6 +114,9 @@ for release in data:
|
|
|
104
114
|
# generate an id (ARTIST + RELEASE + NUMBER + TITLE + LENGTH)
|
|
105
115
|
track["id"] = make_id(release["project"] + release["title"] + str(track["number"]) + track["title"] + track["length"])
|
|
106
116
|
|
|
117
|
+
# generate a track title
|
|
118
|
+
track["title"] = make_track_title(track["title"])
|
|
119
|
+
|
|
107
120
|
# generate an id for each stream
|
|
108
121
|
if "streams" in release:
|
|
109
122
|
for stream in release["streams"]:
|