# mega-pack-pbf-parser
Parse the content (songs and PBFs) of a BB project w/Mega Pack and add that data to the project database.
- To write the required html file install this package: bb-pbf-html-writer
- pip install bb-pbf-html-writer
## Warnings
- Verify that the "packs_pbf_type" table is up-to-date. Be certain that ALL products are included in this table (i.e. check for new product releases)
- BEFORE ANYTHING ELSE the full path to the project db must be set the first time you try to run the code. This is handled by the ConfigManager class.
## ConfigManager
An instance of ConfigManager runs automtically from the package __init__.py file.
The instance is created before any imports are called:
```python
from .config_manager import ConfigManager
config = ConfigManager()
PROJECT_DB_PATH = config.get_variable("PROJECT_DB_PATH")
BONUS_PBF_FILES = config.get_variable("BONUS_PBF_FILES")
OPP_PBF_FILES = config.get_variable("OPP_PBF_FILES")
```
You'll be asked to provide the full path to the project database. Nothing will work without this.
Some project values ("BONUS_PBF_FILES" and "OPP_PBF_FILES") are stored inside the package (default_config.json) but everything will be writen to a LOCAL mega_pack_pbf_parser_config.json file in the USER's HOME directory. This happens the first time you run any of the code. See the package __init__.py file
## Database Tables
- packs_pbf_type: contains a listing of all PBF names, the associated productand the type (OPP, sections)
- songs: lists all songs, the associated PBF and product name and the type (OPP, sections)
## Usage (NEEDS UPDATING)
```python
from typing import List
from mega_pack_pbf_parser import Project_Parser
from mega_pack_pbf_parser import create_db, insert
from mega_pack_pbf_parser import insert_songs_query
from mega_pack_pbf_parser import initialize_database
from mega_pack_pbf_parser import config as config_manager
def insert_song_data(db_path: str, data: List):
"""
Inserts song data into the project database. Prints the number of rows inserted.
Parameters:
data(List): a list of song info: PBF name, song name, product name, song type
"""
query = insert_songs_query
row_count = insert(db_path=db_path, query=query, data=data)
print(f"Inserted {row_count} rows into the database.")
def main():
bb_project_folder = r"C:\Users\RC\Documents\BBWorkspace\GM_Mega_Pack_Project"
project_data = config_manager.config_data
db_path = project_data.get('PROJECT_DB_PATH')
initialize_database(db_path=db_path)
parser = Project_Parser(project_folder=bb_project_folder)
song_list = parser.run()
# example only. The database is initialized with data up to October 2024
insert_song_data(db_path=db_path, data=song_list)
if __name__ == '__main__':
main()
```
Metadata
Release files for mega-pack-pbf-parser 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mega_pack_pbf_parser-0.1.8.tar.gz | 30.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mega_pack_pbf_parser-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 73.1 kB
Release files / mega_pack_pbf_parser-0.1.8.tar.gz
| Download URL | mega_pack_pbf_parser-0.1.8.tar.gz |
|---|---|
| Size | 30.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
633c07b5c6f9476910049ce87d91e5088052a8031496ef3b21c07e7e81fe406a
|
|
BLAKE2b-256 checksum How to use checksums |
e0208e6e969e2d475bb44056edf2d7abedd1158c0d56aa01aeac51363f052923
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.4
|
Release files / mega_pack_pbf_parser-0.1.8-py3-none-any.whl
| Download URL | mega_pack_pbf_parser-0.1.8-py3-none-any.whl |
|---|---|
| Size | 42.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
789cb161a5fc8fdbbcd3f197157ac81b341e94fdda298947f8239075b1eb4abd
|
|
BLAKE2b-256 checksum How to use checksums |
69f794bc14a1aad3987a55b58bacf59a5ea484c5d7ea7abc40ea20f55c2201ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.4
|
Security for mega-pack-pbf-parser 0.1.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.