genpdf-butler 0.0.3__tar.gz

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.

Potentially problematic release.


This version of genpdf-butler might be problematic. Click here for more details.

@@ -0,0 +1,7 @@
1
+ GeneratedSongsList.html
2
+ GeneratedNotesList.html
3
+ GeneratedLinksList.html
4
+ GeneratedMLPList.html
5
+ *.ffs_db
6
+ SyncWithMartyOffice/
7
+ *.pyc
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.4
2
+ Name: genpdf_butler
3
+ Version: 0.0.3
4
+ Summary: A package for running chordpro CLI over a folder
5
+ Project-URL: Homepage, https://github.com/gdad78758/bluegrass
6
+ Project-URL: Issues, https://github.com/gdad78758/bluegrass/issues
7
+ Author-email: Paul Butler <c.paul.butler@gmail.com>
8
+ License-Expression: MIT
9
+ Classifier: Operating System :: Microsoft
10
+ Classifier: Programming Language :: Python :: 3
11
+ Requires-Python: >=3.11
File without changes
@@ -0,0 +1,22 @@
1
+ [build-system]
2
+ requires = ["hatchling >= 1.26"]
3
+ build-backend = "hatchling.build"
4
+ [project]
5
+ name = "genpdf_butler"
6
+ version = "0.0.3"
7
+ authors = [
8
+ { name="Paul Butler", email="c.paul.butler@gmail.com" },
9
+ ]
10
+ description = "A package for running chordpro CLI over a folder"
11
+ readme = "README.md"
12
+ requires-python = ">=3.11"
13
+ classifiers = [
14
+ "Programming Language :: Python :: 3",
15
+ "Operating System :: Microsoft",
16
+ ]
17
+ license = "MIT"
18
+ license-files = ["LICEN[CS]E*"]
19
+
20
+ [project.urls]
21
+ Homepage = "https://github.com/gdad78758/bluegrass"
22
+ Issues = "https://github.com/gdad78758/bluegrass/issues"
@@ -0,0 +1,56 @@
1
+ from genpdf_butler import PatchTextColor
2
+ from git import Repo
3
+
4
+ import subprocess
5
+ from pathlib import Path
6
+ from posixpath import basename, splitext
7
+ import sys
8
+ import os
9
+ import argparse
10
+
11
+
12
+ parser = argparse.ArgumentParser()
13
+ parser.add_argument("--musicFolder", type=str, default='.')
14
+ args = parser.parse_args()
15
+
16
+ print("Generating Music List (this takes a few seconds)", file=sys.stderr)
17
+
18
+ musicFolder = args.musicFolder
19
+
20
+ def createPDFs():
21
+ chordproSettings=[
22
+ "chordpro",
23
+ "--config=Ukulele",
24
+ "--config=Ukulele-ly",
25
+ "--define=pdf:diagrams:show=none",
26
+ "--define=settings:inline-chords=true",
27
+ "--define=pdf:margintop=70",
28
+ "--define=pdf:marginbottom=0",
29
+ "--define=pdf:marginleft=20",
30
+ "--define=pdf:marginright=20",
31
+ "--define=pdf:headspace=50",
32
+ "--define=pdf:footspace=10",
33
+ "--define=pdf:head-first-only=true",
34
+ "--define=pdf:fonts:chord:color=red",
35
+ "--text-font=helvetica",
36
+ "--chord-font=helvetica"
37
+ ]
38
+
39
+ # lambda ext is like lambda l, except it returns the file extension
40
+ ext = lambda p: str(os.path.splitext(os.path.basename(p))[1]).lower()
41
+
42
+ extensions = [".chopro", ".cho"]
43
+ for p in Path(musicFolder).rglob('*'):
44
+ if ext(p) in (extension.lower() for extension in extensions):
45
+ subprocess.run(chordproSettings + [str(p)])
46
+
47
+ repo = Repo('.')
48
+ if repo.is_dirty():
49
+ print("Cannot operate on a repo with changes -- " +
50
+ "commit, discard, or stash your changes and try again")
51
+ else:
52
+ PatchTextColor.PatchColors()
53
+ createPDFs()
54
+ repo.git.restore('*.chopro')
55
+ repo.git.restore('*.cho')
56
+
@@ -0,0 +1,43 @@
1
+ from pathlib import Path
2
+ from posixpath import basename, splitext
3
+ import re
4
+ import os
5
+
6
+ def PatchColors():
7
+ allFiles = []
8
+ for p in Path("./").rglob('*.chopro'):
9
+ allFiles.append(p)
10
+ for p in Path("./").rglob('*.cho'):
11
+ allFiles.append(p)
12
+
13
+ startColor = re.compile('textcolour: *\w+')
14
+ endColor = re.compile('textcolour *}')
15
+ onsongColor = re.compile('&blue:')
16
+
17
+ for p in allFiles:
18
+ try:
19
+ with open(p, mode="r", encoding="utf-8") as f:
20
+ srcLines = f.readlines()
21
+
22
+ addColor = False
23
+ with open(p, mode="w", encoding="utf-8") as f:
24
+ for l in srcLines:
25
+ if not addColor and onsongColor.search(l):
26
+ addColor = True
27
+ f.write("{textcolour: blue}\n")
28
+ elif addColor and not onsongColor.search(l):
29
+ addColor = False
30
+ f.write("{textcolour}\n")
31
+
32
+ if addColor:
33
+ newL = re.sub('.?&blue: *','',l)
34
+ f.write(newL)
35
+ else:
36
+ f.write(l)
37
+
38
+ if addColor:
39
+ f.write("{textcolour}\n")
40
+
41
+
42
+ except:
43
+ print(f"failed on file {str(p)}")
File without changes