auto-reference-generator 1.0.0__tar.gz → 1.3.4__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.
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/.github/workflows/pypi-publish.yml +1 -1
- auto_reference_generator-1.3.4/PKG-INFO +295 -0
- auto_reference_generator-1.3.4/auto_reference_generator.egg-info/PKG-INFO +295 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/auto_reference_generator.egg-info/SOURCES.txt +1 -1
- auto_reference_generator-1.3.4/auto_reference_generator.egg-info/requires.txt +6 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/pyproject.toml +11 -3
- auto_reference_generator-1.0.0/PKG-INFO +0 -15
- auto_reference_generator-1.0.0/auto_reference_generator.egg-info/PKG-INFO +0 -15
- auto_reference_generator-1.0.0/auto_reference_generator.egg-info/requires.txt +0 -2
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/.github/workflows/codeql.yml +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/.gitignore +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/LICENSE.md +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/README.md +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/assets/AccessionPreview.png +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/assets/HashPreview.png +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/assets/ReferencesPreview.png +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/assets/SpreadGen.png +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/assets/SpreadPreview.png +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/assets/metaFolder.png +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/assets/sample_from_dict.json +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/auto_reference_generator/__init__.py +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/auto_reference_generator/cli.py +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/auto_reference_generator/common.py +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/auto_reference_generator/hash.py +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/auto_reference_generator/options/options.properties +0 -0
- /auto_reference_generator-1.0.0/auto_reference_generator/classification_generator.py → /auto_reference_generator-1.3.4/auto_reference_generator/reference_generator.py +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/auto_reference_generator.egg-info/dependency_links.txt +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/auto_reference_generator.egg-info/entry_points.txt +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/auto_reference_generator.egg-info/top_level.txt +0 -0
- {auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/setup.cfg +0 -0
{auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/.github/workflows/pypi-publish.yml
RENAMED
|
@@ -37,7 +37,7 @@ jobs:
|
|
|
37
37
|
runs-on: ubuntu-latest
|
|
38
38
|
environment:
|
|
39
39
|
name: pypi
|
|
40
|
-
url: https://pypi.org/p/
|
|
40
|
+
url: https://pypi.org/p/auto-reference-generator # Replace <package-name> with your PyPI project name
|
|
41
41
|
permissions:
|
|
42
42
|
id-token: write # IMPORTANT: mandatory for trusted publishing
|
|
43
43
|
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: auto_reference_generator
|
|
3
|
+
Version: 1.3.4
|
|
4
|
+
Summary: A tool for archivist's to automate the generation of references for digital files
|
|
5
|
+
Author-email: Christopher Prince <c.pj.prince@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/CPJPRINCE/auto_reference_generator
|
|
8
|
+
Project-URL: Issues, https://github.com/CPJPRINCE/auto_reference_generator/issues
|
|
9
|
+
Keywords: archiving,archives,digital archiving,references,automatic archival reference generator
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Topic :: System :: Archiving
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE.md
|
|
15
|
+
Requires-Dist: pandas
|
|
16
|
+
Requires-Dist: openpyxl
|
|
17
|
+
Provides-Extra: addex
|
|
18
|
+
Requires-Dist: lxml; extra == "addex"
|
|
19
|
+
Requires-Dist: odfpy; extra == "addex"
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# Auto Reference Generator Tool
|
|
23
|
+
|
|
24
|
+
The Auto Reference Generator tool is small python programme to help Digital archivists reference and catalogue Digital Items. It recursively acts through a given directory to create generating reference codes for each directory and file, then exporting the results to an Excel or CSV spreadsheet.
|
|
25
|
+
|
|
26
|
+
It's platform independent tested functioning on Windows, MacOS and Linux.
|
|
27
|
+
|
|
28
|
+
## Why use this tool?
|
|
29
|
+
|
|
30
|
+
If you're an archivist dealing with Digital Records, this provides a means of undertaking a referencing of a large amount of digital records at a time, saving a significant amount of time in assigning reference codes to individual records.
|
|
31
|
+
|
|
32
|
+
The generated spreadsheet also serves as the basis for spreadsheet inputs for the Opex Manifest Generator tool [*\*Shameless Self promotion\**.](https://github.com/CPJPRINCE/opex_manifest_generator/)
|
|
33
|
+
|
|
34
|
+
## A Quick Note
|
|
35
|
+
|
|
36
|
+
If you need to conduct an arrangement of the files; this must be done beforehand for the references to be accurate; though a temporary spreadsheet can be generated to provide assistance in this.
|
|
37
|
+
|
|
38
|
+
## Additional features:
|
|
39
|
+
|
|
40
|
+
Some additional features include.
|
|
41
|
+
|
|
42
|
+
- Append prefixes to the Archival Reference.
|
|
43
|
+
- Identifying the depth / level of each folder.
|
|
44
|
+
- Gathering standard set of Metadata.
|
|
45
|
+
- Changeable starting reference.
|
|
46
|
+
- Logged removal of empty directories.
|
|
47
|
+
- An alternative "Accession Reference" mode.
|
|
48
|
+
- Compatibility with Win32 / Window's 256 Character limit.
|
|
49
|
+
|
|
50
|
+
## Structure of References
|
|
51
|
+
```
|
|
52
|
+
Folder Reference
|
|
53
|
+
-->Root 0
|
|
54
|
+
---->Folder 1 1
|
|
55
|
+
------>Sub Folder 1 1/1
|
|
56
|
+
-------->File 1 1/1/1
|
|
57
|
+
-------->File 2 1/1/2
|
|
58
|
+
------>Sub Folder 2 1/2
|
|
59
|
+
-------->File 3 1/2/1
|
|
60
|
+
-------->File 4 1/2/2
|
|
61
|
+
---->Folder 2 2
|
|
62
|
+
------>Sub Folder 3 2/1
|
|
63
|
+
------>File 5 2/2
|
|
64
|
+
---->File 6 3
|
|
65
|
+
```
|
|
66
|
+
The root reference defaults to 0, however this the Prefix option can be utilized to change 0 to the desired prefix / archival reference, changing the structure to:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
-->Root Folder ARC
|
|
70
|
+
---->Folder ARC/1
|
|
71
|
+
------>Sub Folder ARC/1/1
|
|
72
|
+
------>File ARC/1/2
|
|
73
|
+
etc
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Prerequisites
|
|
77
|
+
|
|
78
|
+
The following modules are utilized and installed with the package:
|
|
79
|
+
|
|
80
|
+
- pandas
|
|
81
|
+
- openpyxl
|
|
82
|
+
|
|
83
|
+
Optional Modules also include:
|
|
84
|
+
- lxml (for XML Export)
|
|
85
|
+
- odfpy (for ODS Export)
|
|
86
|
+
|
|
87
|
+
Python Version 3.8+ is also recommended. It may work on earlier versions, but this has not been tested.
|
|
88
|
+
|
|
89
|
+
## Installation
|
|
90
|
+
|
|
91
|
+
To install, simply run:
|
|
92
|
+
|
|
93
|
+
`pip install -U auto_Reference_generator`
|
|
94
|
+
|
|
95
|
+
## Usage
|
|
96
|
+
|
|
97
|
+
To run the basic program, run from the terminal:
|
|
98
|
+
|
|
99
|
+
`auto_ref {path/to/your/folder}`
|
|
100
|
+
|
|
101
|
+
Replacing the path with your folder. If a space is in the path enclose in quotations. On Windows this may look like:
|
|
102
|
+
|
|
103
|
+
`auto_ref "C:\Users\Christopher\Downloads\"`
|
|
104
|
+
|
|
105
|
+
Additional options can be appended before or after the root directory.
|
|
106
|
+
|
|
107
|
+
To run the program with the Prefix option, add the `-p` option and type in your prefix:
|
|
108
|
+
|
|
109
|
+
`auto_ref "C:\Users\Christopher\Downloads\" -p "ARCH"`
|
|
110
|
+
|
|
111
|
+
This will generate a spreadsheet in a folder called 'meta' within the 'root' directory.
|
|
112
|
+
|
|
113
|
+

|
|
114
|
+
|
|
115
|
+
The spreadsheet will be named after the 'root' folder and appended with "_Autoref".
|
|
116
|
+
|
|
117
|
+

|
|
118
|
+
|
|
119
|
+
Within the spreadsheet you will have information on the paths of the files as well as some additional metadata: size, extensions and dates.
|
|
120
|
+
|
|
121
|
+

|
|
122
|
+
|
|
123
|
+
At the end of the spreadsheet an `Archive_Reference` column with the generated reference.
|
|
124
|
+
|
|
125
|
+

|
|
126
|
+
|
|
127
|
+
(If ran without Prefix Option this will simply be the numerals)
|
|
128
|
+
|
|
129
|
+
## Accession mode
|
|
130
|
+
|
|
131
|
+
There is an alternative method of generating a reference number; having create a code based on the directory hierarchy you can simply create one that follows an 'accession number' pattern. IE each file or folder regardless of depth will be given a running number; depending on the 'mode' the running number will only apply to Directories, Files or Both!
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
Example running Accession in "File" Mode
|
|
136
|
+
|
|
137
|
+
----> Root ACC-Dir
|
|
138
|
+
------> Folder 1 ACC-Dir
|
|
139
|
+
--------> File 1 ACC-1
|
|
140
|
+
--------> File 2 ACC-2
|
|
141
|
+
------> File 3 ACC-3
|
|
142
|
+
------> Folder 2 ACC-Dir
|
|
143
|
+
--------> Sub-Folder ACC-Dir
|
|
144
|
+
----------> File 4 ACC-4
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
The available modes are `File, Dir, All`
|
|
148
|
+
|
|
149
|
+
To run in accession mode, use the `-acc` and `-accp` options (A prefix must be set):
|
|
150
|
+
|
|
151
|
+
`auto_ref "C:\Users\Christopher\Downloads\" -acc File -accp "ACC"`
|
|
152
|
+
|
|
153
|
+

|
|
154
|
+
|
|
155
|
+
When you generate an Accession Reference an Archive_Reference code will always also be generated.
|
|
156
|
+
|
|
157
|
+
## Set start reference
|
|
158
|
+
|
|
159
|
+
To set a start reference simply add `-str` followed by (Note this must be numeral)
|
|
160
|
+
|
|
161
|
+
## Clear Empty Directories
|
|
162
|
+
|
|
163
|
+
Adding `--empty` or `-rm` to the will automatically remove any empty directories within the files. It will also generate a simple text log in the meta folder of the empty directories that were removed.
|
|
164
|
+
|
|
165
|
+
## Fixity
|
|
166
|
+
|
|
167
|
+
You can also generate Fixities by simply adding the `-fx` option. This will default to using the SHA-1 algorithm, only MD5, SHA-1, SHA-256 and SHA-512 are supported.
|
|
168
|
+
|
|
169
|
+

|
|
170
|
+
|
|
171
|
+
To run a SHA-512 generation:
|
|
172
|
+
|
|
173
|
+
`auto_ref "C:\Users\Christopher\Downloads\" -fx SHA-512`
|
|
174
|
+
|
|
175
|
+
## Filtering
|
|
176
|
+
|
|
177
|
+
By default hidden folders and folders named 'meta' will be ignored. You can include hidden folders by using the option `--hidden`
|
|
178
|
+
|
|
179
|
+
## Skip
|
|
180
|
+
|
|
181
|
+
If you just want to generate a spreadsheet without a reference code you can add `-skp | --skip`, and it will simply generate a spreadsheet without the Archive_Reference
|
|
182
|
+
|
|
183
|
+
## Options:
|
|
184
|
+
|
|
185
|
+
For up to date options use the `-h` option to show dialog:
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
Options:
|
|
189
|
+
-h, --help Show Help dialog
|
|
190
|
+
|
|
191
|
+
-p, --prefix Replace Root 0 with specified prefix [string]
|
|
192
|
+
Is added to all references
|
|
193
|
+
|
|
194
|
+
-s --suffix Add a suffix to references [string]
|
|
195
|
+
|
|
196
|
+
--suffix-options Set whether to apply to files, {apply_to_files,apply_to_folders,
|
|
197
|
+
folders,or to all apply_to_all}
|
|
198
|
+
default is to apply_to_files.
|
|
199
|
+
|
|
200
|
+
-l --level-limit Set whether to limit generation to [int]
|
|
201
|
+
a specific level.
|
|
202
|
+
Note generated references may have
|
|
203
|
+
extra delimiter.
|
|
204
|
+
|
|
205
|
+
-dlm --delimiter Set to change the default delimiter [string]
|
|
206
|
+
|
|
207
|
+
-acc, --accession Run in "Accession Mode", this will {Dir,File,
|
|
208
|
+
generate a running number of either All}
|
|
209
|
+
Files, directories, or Both
|
|
210
|
+
|
|
211
|
+
-accp, --acc-prefix Set the Prefix to append onto the running [boolean]
|
|
212
|
+
number generated in "Accession Mode"
|
|
213
|
+
|
|
214
|
+
-fx --fixity Generate fixity codes for files {MD5, SHA-1,
|
|
215
|
+
SHA-256, SHA-512}
|
|
216
|
+
|
|
217
|
+
-hid --hidden Include Hidden directories and files in [boolean]
|
|
218
|
+
generation.
|
|
219
|
+
|
|
220
|
+
--rm-empty Will remove all Empty Directories from [boolean]
|
|
221
|
+
within a given folder, not including them
|
|
222
|
+
in the Reference Generation.
|
|
223
|
+
A simply Text list of removed folders is
|
|
224
|
+
then generated to the output directory.
|
|
225
|
+
|
|
226
|
+
-str, --start-ref Set the number to start the Reference [int]
|
|
227
|
+
generation from.
|
|
228
|
+
|
|
229
|
+
-o, --output Set the directory to export the spreadsheet to. [string]
|
|
230
|
+
|
|
231
|
+
--disable-meta-dir Set whether to generate a "meta" directory, [boolean]
|
|
232
|
+
to export CSV / Excel file to.
|
|
233
|
+
Default behavior will be to create a directory,
|
|
234
|
+
using this option will disable it.
|
|
235
|
+
|
|
236
|
+
-skp --skip Skip running the Auto Reference process, [boolean]
|
|
237
|
+
will generate a spreadsheet but not
|
|
238
|
+
an Archival Reference
|
|
239
|
+
|
|
240
|
+
-fmt, --format Set export format. Will require {xlsx,csv,ods,dict,xml,json}
|
|
241
|
+
appropriate modules in Python.
|
|
242
|
+
ods - PyODF
|
|
243
|
+
xlsx - OpenPyXL
|
|
244
|
+
xml - lxml
|
|
245
|
+
Defaults to xlsx.
|
|
246
|
+
|
|
247
|
+
-key --keywords Set keywords to replace numericals with [string|path]
|
|
248
|
+
alphanumerical characters
|
|
249
|
+
Can be single word or
|
|
250
|
+
list: 'written,like,this'
|
|
251
|
+
Or path to a JSON file containing a dict
|
|
252
|
+
|
|
253
|
+
Keywords only currently act upon folders
|
|
254
|
+
and not files.
|
|
255
|
+
|
|
256
|
+
-keym -keywords-mode Set way to replace: {initialise,first_letters,from_json}
|
|
257
|
+
initialise: My New Folder > MNF
|
|
258
|
+
first_letters: My New Folder > MYF
|
|
259
|
+
from_json: Imports
|
|
260
|
+
Requires to have a Json file with a
|
|
261
|
+
dictionary of words to replace:
|
|
262
|
+
{'Word':'Replacement',
|
|
263
|
+
'SecondWord':'2ndReplacement}
|
|
264
|
+
|
|
265
|
+
--keywords-retain- Set whether to continue reference numbering [bool]
|
|
266
|
+
order If not used keywords don't 'count' towards
|
|
267
|
+
additional references.
|
|
268
|
+
IE if the keyword you are replacing is
|
|
269
|
+
be reference number: 2, this is moved
|
|
270
|
+
to what would originally be number 3.
|
|
271
|
+
Retaining the order means, this scheme is
|
|
272
|
+
maintained: IE 3 is still 3, and 2 is skipped
|
|
273
|
+
|
|
274
|
+
--keywords-case- Set to enable case-sensitivity for keyword [bool]
|
|
275
|
+
sensitivity matches. Default is cases are not sensitive.
|
|
276
|
+
|
|
277
|
+
--keywords-abbreviation Set the number of characters to abbreviate to [int]
|
|
278
|
+
-number Only for first_letters mode.
|
|
279
|
+
|
|
280
|
+
--sort-by Set the sorting method: folders_first, sorts [folders_first|alphabetically]
|
|
281
|
+
folders first. Alphabetically, you can guess.
|
|
282
|
+
Ignores folders.
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Future Developments
|
|
289
|
+
|
|
290
|
+
- ~~Level Limitations to allow for "group references"~~ - Added!
|
|
291
|
+
- ~~Generating reference's which use alphabetic characters~~ - Added!
|
|
292
|
+
|
|
293
|
+
## Contributing
|
|
294
|
+
|
|
295
|
+
I welcome further contributions and feedback.
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: auto_reference_generator
|
|
3
|
+
Version: 1.3.4
|
|
4
|
+
Summary: A tool for archivist's to automate the generation of references for digital files
|
|
5
|
+
Author-email: Christopher Prince <c.pj.prince@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/CPJPRINCE/auto_reference_generator
|
|
8
|
+
Project-URL: Issues, https://github.com/CPJPRINCE/auto_reference_generator/issues
|
|
9
|
+
Keywords: archiving,archives,digital archiving,references,automatic archival reference generator
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Topic :: System :: Archiving
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE.md
|
|
15
|
+
Requires-Dist: pandas
|
|
16
|
+
Requires-Dist: openpyxl
|
|
17
|
+
Provides-Extra: addex
|
|
18
|
+
Requires-Dist: lxml; extra == "addex"
|
|
19
|
+
Requires-Dist: odfpy; extra == "addex"
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# Auto Reference Generator Tool
|
|
23
|
+
|
|
24
|
+
The Auto Reference Generator tool is small python programme to help Digital archivists reference and catalogue Digital Items. It recursively acts through a given directory to create generating reference codes for each directory and file, then exporting the results to an Excel or CSV spreadsheet.
|
|
25
|
+
|
|
26
|
+
It's platform independent tested functioning on Windows, MacOS and Linux.
|
|
27
|
+
|
|
28
|
+
## Why use this tool?
|
|
29
|
+
|
|
30
|
+
If you're an archivist dealing with Digital Records, this provides a means of undertaking a referencing of a large amount of digital records at a time, saving a significant amount of time in assigning reference codes to individual records.
|
|
31
|
+
|
|
32
|
+
The generated spreadsheet also serves as the basis for spreadsheet inputs for the Opex Manifest Generator tool [*\*Shameless Self promotion\**.](https://github.com/CPJPRINCE/opex_manifest_generator/)
|
|
33
|
+
|
|
34
|
+
## A Quick Note
|
|
35
|
+
|
|
36
|
+
If you need to conduct an arrangement of the files; this must be done beforehand for the references to be accurate; though a temporary spreadsheet can be generated to provide assistance in this.
|
|
37
|
+
|
|
38
|
+
## Additional features:
|
|
39
|
+
|
|
40
|
+
Some additional features include.
|
|
41
|
+
|
|
42
|
+
- Append prefixes to the Archival Reference.
|
|
43
|
+
- Identifying the depth / level of each folder.
|
|
44
|
+
- Gathering standard set of Metadata.
|
|
45
|
+
- Changeable starting reference.
|
|
46
|
+
- Logged removal of empty directories.
|
|
47
|
+
- An alternative "Accession Reference" mode.
|
|
48
|
+
- Compatibility with Win32 / Window's 256 Character limit.
|
|
49
|
+
|
|
50
|
+
## Structure of References
|
|
51
|
+
```
|
|
52
|
+
Folder Reference
|
|
53
|
+
-->Root 0
|
|
54
|
+
---->Folder 1 1
|
|
55
|
+
------>Sub Folder 1 1/1
|
|
56
|
+
-------->File 1 1/1/1
|
|
57
|
+
-------->File 2 1/1/2
|
|
58
|
+
------>Sub Folder 2 1/2
|
|
59
|
+
-------->File 3 1/2/1
|
|
60
|
+
-------->File 4 1/2/2
|
|
61
|
+
---->Folder 2 2
|
|
62
|
+
------>Sub Folder 3 2/1
|
|
63
|
+
------>File 5 2/2
|
|
64
|
+
---->File 6 3
|
|
65
|
+
```
|
|
66
|
+
The root reference defaults to 0, however this the Prefix option can be utilized to change 0 to the desired prefix / archival reference, changing the structure to:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
-->Root Folder ARC
|
|
70
|
+
---->Folder ARC/1
|
|
71
|
+
------>Sub Folder ARC/1/1
|
|
72
|
+
------>File ARC/1/2
|
|
73
|
+
etc
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Prerequisites
|
|
77
|
+
|
|
78
|
+
The following modules are utilized and installed with the package:
|
|
79
|
+
|
|
80
|
+
- pandas
|
|
81
|
+
- openpyxl
|
|
82
|
+
|
|
83
|
+
Optional Modules also include:
|
|
84
|
+
- lxml (for XML Export)
|
|
85
|
+
- odfpy (for ODS Export)
|
|
86
|
+
|
|
87
|
+
Python Version 3.8+ is also recommended. It may work on earlier versions, but this has not been tested.
|
|
88
|
+
|
|
89
|
+
## Installation
|
|
90
|
+
|
|
91
|
+
To install, simply run:
|
|
92
|
+
|
|
93
|
+
`pip install -U auto_Reference_generator`
|
|
94
|
+
|
|
95
|
+
## Usage
|
|
96
|
+
|
|
97
|
+
To run the basic program, run from the terminal:
|
|
98
|
+
|
|
99
|
+
`auto_ref {path/to/your/folder}`
|
|
100
|
+
|
|
101
|
+
Replacing the path with your folder. If a space is in the path enclose in quotations. On Windows this may look like:
|
|
102
|
+
|
|
103
|
+
`auto_ref "C:\Users\Christopher\Downloads\"`
|
|
104
|
+
|
|
105
|
+
Additional options can be appended before or after the root directory.
|
|
106
|
+
|
|
107
|
+
To run the program with the Prefix option, add the `-p` option and type in your prefix:
|
|
108
|
+
|
|
109
|
+
`auto_ref "C:\Users\Christopher\Downloads\" -p "ARCH"`
|
|
110
|
+
|
|
111
|
+
This will generate a spreadsheet in a folder called 'meta' within the 'root' directory.
|
|
112
|
+
|
|
113
|
+

|
|
114
|
+
|
|
115
|
+
The spreadsheet will be named after the 'root' folder and appended with "_Autoref".
|
|
116
|
+
|
|
117
|
+

|
|
118
|
+
|
|
119
|
+
Within the spreadsheet you will have information on the paths of the files as well as some additional metadata: size, extensions and dates.
|
|
120
|
+
|
|
121
|
+

|
|
122
|
+
|
|
123
|
+
At the end of the spreadsheet an `Archive_Reference` column with the generated reference.
|
|
124
|
+
|
|
125
|
+

|
|
126
|
+
|
|
127
|
+
(If ran without Prefix Option this will simply be the numerals)
|
|
128
|
+
|
|
129
|
+
## Accession mode
|
|
130
|
+
|
|
131
|
+
There is an alternative method of generating a reference number; having create a code based on the directory hierarchy you can simply create one that follows an 'accession number' pattern. IE each file or folder regardless of depth will be given a running number; depending on the 'mode' the running number will only apply to Directories, Files or Both!
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
Example running Accession in "File" Mode
|
|
136
|
+
|
|
137
|
+
----> Root ACC-Dir
|
|
138
|
+
------> Folder 1 ACC-Dir
|
|
139
|
+
--------> File 1 ACC-1
|
|
140
|
+
--------> File 2 ACC-2
|
|
141
|
+
------> File 3 ACC-3
|
|
142
|
+
------> Folder 2 ACC-Dir
|
|
143
|
+
--------> Sub-Folder ACC-Dir
|
|
144
|
+
----------> File 4 ACC-4
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
The available modes are `File, Dir, All`
|
|
148
|
+
|
|
149
|
+
To run in accession mode, use the `-acc` and `-accp` options (A prefix must be set):
|
|
150
|
+
|
|
151
|
+
`auto_ref "C:\Users\Christopher\Downloads\" -acc File -accp "ACC"`
|
|
152
|
+
|
|
153
|
+

|
|
154
|
+
|
|
155
|
+
When you generate an Accession Reference an Archive_Reference code will always also be generated.
|
|
156
|
+
|
|
157
|
+
## Set start reference
|
|
158
|
+
|
|
159
|
+
To set a start reference simply add `-str` followed by (Note this must be numeral)
|
|
160
|
+
|
|
161
|
+
## Clear Empty Directories
|
|
162
|
+
|
|
163
|
+
Adding `--empty` or `-rm` to the will automatically remove any empty directories within the files. It will also generate a simple text log in the meta folder of the empty directories that were removed.
|
|
164
|
+
|
|
165
|
+
## Fixity
|
|
166
|
+
|
|
167
|
+
You can also generate Fixities by simply adding the `-fx` option. This will default to using the SHA-1 algorithm, only MD5, SHA-1, SHA-256 and SHA-512 are supported.
|
|
168
|
+
|
|
169
|
+

|
|
170
|
+
|
|
171
|
+
To run a SHA-512 generation:
|
|
172
|
+
|
|
173
|
+
`auto_ref "C:\Users\Christopher\Downloads\" -fx SHA-512`
|
|
174
|
+
|
|
175
|
+
## Filtering
|
|
176
|
+
|
|
177
|
+
By default hidden folders and folders named 'meta' will be ignored. You can include hidden folders by using the option `--hidden`
|
|
178
|
+
|
|
179
|
+
## Skip
|
|
180
|
+
|
|
181
|
+
If you just want to generate a spreadsheet without a reference code you can add `-skp | --skip`, and it will simply generate a spreadsheet without the Archive_Reference
|
|
182
|
+
|
|
183
|
+
## Options:
|
|
184
|
+
|
|
185
|
+
For up to date options use the `-h` option to show dialog:
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
Options:
|
|
189
|
+
-h, --help Show Help dialog
|
|
190
|
+
|
|
191
|
+
-p, --prefix Replace Root 0 with specified prefix [string]
|
|
192
|
+
Is added to all references
|
|
193
|
+
|
|
194
|
+
-s --suffix Add a suffix to references [string]
|
|
195
|
+
|
|
196
|
+
--suffix-options Set whether to apply to files, {apply_to_files,apply_to_folders,
|
|
197
|
+
folders,or to all apply_to_all}
|
|
198
|
+
default is to apply_to_files.
|
|
199
|
+
|
|
200
|
+
-l --level-limit Set whether to limit generation to [int]
|
|
201
|
+
a specific level.
|
|
202
|
+
Note generated references may have
|
|
203
|
+
extra delimiter.
|
|
204
|
+
|
|
205
|
+
-dlm --delimiter Set to change the default delimiter [string]
|
|
206
|
+
|
|
207
|
+
-acc, --accession Run in "Accession Mode", this will {Dir,File,
|
|
208
|
+
generate a running number of either All}
|
|
209
|
+
Files, directories, or Both
|
|
210
|
+
|
|
211
|
+
-accp, --acc-prefix Set the Prefix to append onto the running [boolean]
|
|
212
|
+
number generated in "Accession Mode"
|
|
213
|
+
|
|
214
|
+
-fx --fixity Generate fixity codes for files {MD5, SHA-1,
|
|
215
|
+
SHA-256, SHA-512}
|
|
216
|
+
|
|
217
|
+
-hid --hidden Include Hidden directories and files in [boolean]
|
|
218
|
+
generation.
|
|
219
|
+
|
|
220
|
+
--rm-empty Will remove all Empty Directories from [boolean]
|
|
221
|
+
within a given folder, not including them
|
|
222
|
+
in the Reference Generation.
|
|
223
|
+
A simply Text list of removed folders is
|
|
224
|
+
then generated to the output directory.
|
|
225
|
+
|
|
226
|
+
-str, --start-ref Set the number to start the Reference [int]
|
|
227
|
+
generation from.
|
|
228
|
+
|
|
229
|
+
-o, --output Set the directory to export the spreadsheet to. [string]
|
|
230
|
+
|
|
231
|
+
--disable-meta-dir Set whether to generate a "meta" directory, [boolean]
|
|
232
|
+
to export CSV / Excel file to.
|
|
233
|
+
Default behavior will be to create a directory,
|
|
234
|
+
using this option will disable it.
|
|
235
|
+
|
|
236
|
+
-skp --skip Skip running the Auto Reference process, [boolean]
|
|
237
|
+
will generate a spreadsheet but not
|
|
238
|
+
an Archival Reference
|
|
239
|
+
|
|
240
|
+
-fmt, --format Set export format. Will require {xlsx,csv,ods,dict,xml,json}
|
|
241
|
+
appropriate modules in Python.
|
|
242
|
+
ods - PyODF
|
|
243
|
+
xlsx - OpenPyXL
|
|
244
|
+
xml - lxml
|
|
245
|
+
Defaults to xlsx.
|
|
246
|
+
|
|
247
|
+
-key --keywords Set keywords to replace numericals with [string|path]
|
|
248
|
+
alphanumerical characters
|
|
249
|
+
Can be single word or
|
|
250
|
+
list: 'written,like,this'
|
|
251
|
+
Or path to a JSON file containing a dict
|
|
252
|
+
|
|
253
|
+
Keywords only currently act upon folders
|
|
254
|
+
and not files.
|
|
255
|
+
|
|
256
|
+
-keym -keywords-mode Set way to replace: {initialise,first_letters,from_json}
|
|
257
|
+
initialise: My New Folder > MNF
|
|
258
|
+
first_letters: My New Folder > MYF
|
|
259
|
+
from_json: Imports
|
|
260
|
+
Requires to have a Json file with a
|
|
261
|
+
dictionary of words to replace:
|
|
262
|
+
{'Word':'Replacement',
|
|
263
|
+
'SecondWord':'2ndReplacement}
|
|
264
|
+
|
|
265
|
+
--keywords-retain- Set whether to continue reference numbering [bool]
|
|
266
|
+
order If not used keywords don't 'count' towards
|
|
267
|
+
additional references.
|
|
268
|
+
IE if the keyword you are replacing is
|
|
269
|
+
be reference number: 2, this is moved
|
|
270
|
+
to what would originally be number 3.
|
|
271
|
+
Retaining the order means, this scheme is
|
|
272
|
+
maintained: IE 3 is still 3, and 2 is skipped
|
|
273
|
+
|
|
274
|
+
--keywords-case- Set to enable case-sensitivity for keyword [bool]
|
|
275
|
+
sensitivity matches. Default is cases are not sensitive.
|
|
276
|
+
|
|
277
|
+
--keywords-abbreviation Set the number of characters to abbreviate to [int]
|
|
278
|
+
-number Only for first_letters mode.
|
|
279
|
+
|
|
280
|
+
--sort-by Set the sorting method: folders_first, sorts [folders_first|alphabetically]
|
|
281
|
+
folders first. Alphabetically, you can guess.
|
|
282
|
+
Ignores folders.
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Future Developments
|
|
289
|
+
|
|
290
|
+
- ~~Level Limitations to allow for "group references"~~ - Added!
|
|
291
|
+
- ~~Generating reference's which use alphabetic characters~~ - Added!
|
|
292
|
+
|
|
293
|
+
## Contributing
|
|
294
|
+
|
|
295
|
+
I welcome further contributions and feedback.
|
|
@@ -12,10 +12,10 @@ assets/SpreadPreview.png
|
|
|
12
12
|
assets/metaFolder.png
|
|
13
13
|
assets/sample_from_dict.json
|
|
14
14
|
auto_reference_generator/__init__.py
|
|
15
|
-
auto_reference_generator/classification_generator.py
|
|
16
15
|
auto_reference_generator/cli.py
|
|
17
16
|
auto_reference_generator/common.py
|
|
18
17
|
auto_reference_generator/hash.py
|
|
18
|
+
auto_reference_generator/reference_generator.py
|
|
19
19
|
auto_reference_generator.egg-info/PKG-INFO
|
|
20
20
|
auto_reference_generator.egg-info/SOURCES.txt
|
|
21
21
|
auto_reference_generator.egg-info/dependency_links.txt
|
|
@@ -4,18 +4,26 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "auto_reference_generator"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.3.4"
|
|
8
8
|
authors = [
|
|
9
9
|
{name="Christopher Prince", email="c.pj.prince@gmail.com"}
|
|
10
10
|
]
|
|
11
|
-
description = "
|
|
11
|
+
description = "A tool for archivist's to automate the generation of references for digital files"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
license = "Apache-2.0"
|
|
14
|
+
license-files = ["LICEN[CS]E*"]
|
|
15
|
+
keywords = ["archiving","archives","digital archiving","references","automatic archival reference generator"]
|
|
16
|
+
|
|
12
17
|
classifiers = [
|
|
13
18
|
"Programming Language :: Python :: 3",
|
|
14
|
-
"License :: OSI Approved :: Apache Software License",
|
|
15
19
|
"Operating System :: OS Independent",
|
|
16
20
|
"Topic :: System :: Archiving"
|
|
17
21
|
]
|
|
18
22
|
dependencies=["pandas","openpyxl"]
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
addex = ["lxml","odfpy"]
|
|
26
|
+
|
|
19
27
|
[project.urls]
|
|
20
28
|
Homepage = "https://github.com/CPJPRINCE/auto_reference_generator"
|
|
21
29
|
Issues = "https://github.com/CPJPRINCE/auto_reference_generator/issues"
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: auto_reference_generator
|
|
3
|
-
Version: 1.0.0
|
|
4
|
-
Summary: Auto Reference Generator Tool for Archivists
|
|
5
|
-
Author-email: Christopher Prince <c.pj.prince@gmail.com>
|
|
6
|
-
Project-URL: Homepage, https://github.com/CPJPRINCE/auto_reference_generator
|
|
7
|
-
Project-URL: Issues, https://github.com/CPJPRINCE/auto_reference_generator/issues
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
-
Classifier: Operating System :: OS Independent
|
|
11
|
-
Classifier: Topic :: System :: Archiving
|
|
12
|
-
License-File: LICENSE.md
|
|
13
|
-
Requires-Dist: pandas
|
|
14
|
-
Requires-Dist: openpyxl
|
|
15
|
-
Dynamic: license-file
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: auto_reference_generator
|
|
3
|
-
Version: 1.0.0
|
|
4
|
-
Summary: Auto Reference Generator Tool for Archivists
|
|
5
|
-
Author-email: Christopher Prince <c.pj.prince@gmail.com>
|
|
6
|
-
Project-URL: Homepage, https://github.com/CPJPRINCE/auto_reference_generator
|
|
7
|
-
Project-URL: Issues, https://github.com/CPJPRINCE/auto_reference_generator/issues
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
-
Classifier: Operating System :: OS Independent
|
|
11
|
-
Classifier: Topic :: System :: Archiving
|
|
12
|
-
License-File: LICENSE.md
|
|
13
|
-
Requires-Dist: pandas
|
|
14
|
-
Requires-Dist: openpyxl
|
|
15
|
-
Dynamic: license-file
|
{auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/.github/workflows/codeql.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/assets/AccessionPreview.png
RENAMED
|
File without changes
|
|
File without changes
|
{auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/assets/ReferencesPreview.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/assets/sample_from_dict.json
RENAMED
|
File without changes
|
|
File without changes
|
{auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/auto_reference_generator/cli.py
RENAMED
|
File without changes
|
{auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/auto_reference_generator/common.py
RENAMED
|
File without changes
|
{auto_reference_generator-1.0.0 → auto_reference_generator-1.3.4}/auto_reference_generator/hash.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|