Skip to main content

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 PROJECT_DB_PATH
from mega_pack_pbf_parser import create_db, insert
from mega_pack_pbf_parser import insert_songs_query


def build_db():
"""
Demonstrates how to build the project database.
WARNING: the script DROPS all existing tables and builds new versions.
Be sure to add the full path to the project db to the constants.py file (PROJECT_DB_PATH)
"""
db_path = PROJECT_DB_PATH
script_path = r"D:\Python\scripts\rc\mega_pack_pbf_parser\mega_pack_pbf_parser\create_database.sql"
with open(script_path) as f:
script = f.read()
create_db(db_path=db_path, script=script)


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_DB_PATH
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"
build_db()
parser = Project_Parser(project_folder=bb_project_folder)
song_list = parser.run()
insert_song_data(song_list)


if __name__ == '__main__':
main()
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mega_pack_pbf_parser-0.1.4.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mega_pack_pbf_parser-0.1.4-py3-none-any.whl (30.9 kB view details)

Uploaded Python 3

File details

Details for the file mega_pack_pbf_parser-0.1.4.tar.gz.

File metadata

  • Download URL: mega_pack_pbf_parser-0.1.4.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for mega_pack_pbf_parser-0.1.4.tar.gz
Algorithm Hash digest
SHA256 767219f1d540a1146e44d1b502cc864cab54a3c1d2b6663397c353a3316d9409
MD5 a564e582ebfe9cf1b16005d0b96dcf3c
BLAKE2b-256 5b4e9797de84933d82db4900044bf0bdfb362aab267fa486113b8765a318f3db

See more details on using hashes here.

File details

Details for the file mega_pack_pbf_parser-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for mega_pack_pbf_parser-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5734a1334ac8056b46e797f08f9b6e1657f095b6cd49c261c97e01f7c6bdeb76
MD5 08f1e8959a45e111c88c4274eb5f3945
BLAKE2b-256 2d81d2109048aef5c395c9f6e7842777227ff1b04415b44f19e156c2a7775ed9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page