Collects song information from BB Projects
Project description
# 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, verify that you have updated the constant PROJECT_DB_PATH (full path to the project db) in constants.py
## Constants
The project uses several constants defined in tools.constants
- PROJECT_DB_PATH - path to the project's database
- BONUS_PBF_FILES - PBFs we don't want to include because they are essentialy duplicates
- OPP_PBF_FILES - PBFs with one press play songs
## 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
```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 get_report_data, write_json
project_database = r"D:\Python\scripts\rc\mega_pack_pbf_parser\db\pbf.db"
def insert_song_data(data: List):
"""
Inserts song data into the project database. Prints the number of rows inserted.
"""
query = insert_songs_query
db_path = project_database
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"
db_path = project_database
initialize_database(db_path=db_path)
parser = Project_Parser(project_folder=bb_project_folder)
song_list = parser.run()
# insert data into the database but note that the database is initialized with data up to October 2024
insert_song_data(song_list)
# write report data as json for later use in html files
output_file_path = r"some/path/to/data/bb_pbf_report_data.py"
result = get_report_data()
write_json(filepath=output_file_path, data=result)
if __name__ == '__main__':
main()
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mega_pack_pbf_parser-0.1.6.tar.gz.
File metadata
- Download URL: mega_pack_pbf_parser-0.1.6.tar.gz
- Upload date:
- Size: 29.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
294ea15f1b24aabdd42df231f673970a6be62269384235aad8201c87730678af
|
|
| MD5 |
08eddc3bc3b0248e374cca25c838d340
|
|
| BLAKE2b-256 |
aad449c91a82c93b7e6f5e1dff775ec588708c97411af7ffe9e3cba7051ea7ee
|
File details
Details for the file mega_pack_pbf_parser-0.1.6-py3-none-any.whl.
File metadata
- Download URL: mega_pack_pbf_parser-0.1.6-py3-none-any.whl
- Upload date:
- Size: 39.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0425cda9e117a87e5bdb79c0392bfff44bba9ccd6f2be63037abfe96b4deefa6
|
|
| MD5 |
7902a3c0c47aff7a1b4f6868e42093df
|
|
| BLAKE2b-256 |
4d738e1c9f1d7f0158873cee3e28b088f0a1fabc9dd33bc6d52ee42182aa435b
|