Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ For example, if the archive is called "My Awesome Archive of Fandom Awesomeness"
```
1. Run
```bash
python start.py CODENAME PATH-TO-WORKING-DIRECTORY
python3 start.py CODENAME PATH-TO-WORKING-DIRECTORY
```
where:

Expand All @@ -40,7 +40,7 @@ Note that the process will create databases and tables in MySQL as well as files

1. Run
```bash
python start.py CODENAME PATH-TO-WORKING-DIRECTORY
python3 start.py CODENAME PATH-TO-WORKING-DIRECTORY
```
where:

Expand Down
4 changes: 3 additions & 1 deletion efiction/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
key_find,
normalize,
print_progress,
prep_db_name,
)


Expand Down Expand Up @@ -59,9 +60,10 @@ def create_open_doors_db(self, step_path):
:return: True if successful
"""
od_table_sql_file = get_full_path("opendoors/open-doors-tables-working.sql")

self.config["Processing"][
"open_doors_working_db"
] = f"{self.config['Archive']['code_name']}_working_open_doors"
] = f"{prep_db_name(self.config['Archive']['code_name'])}_working_open_doors"
self.config["Processing"]["open_doors_working_db_file"] = get_prefixed_path(
"03", step_path, f"{self.config['Processing']['open_doors_working_db']}.sql"
)
Expand Down
8 changes: 5 additions & 3 deletions efiction/original.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
copy_to_dir,
get_full_path,
get_prefixed_path,
prep_db_name,
)


Expand All @@ -31,8 +32,7 @@ def __init__(self, config: ConfigParser, logger: Logger, sql: SqlDb):
self.config = config
self.logger = logger
self.code_name = config["Archive"]["code_name"]
self.edited_db_name = f"{self.code_name}_efiction_original"
self.edited_file_name = f"{self.code_name}_efiction_original_edited.sql"
self.edited_db_name = f"{prep_db_name(self.code_name)}_efiction_original"

@staticmethod
def _contains_table_defs(grouped_statements):
Expand Down Expand Up @@ -120,7 +120,9 @@ def __load_into_database(self, step_path, statements):
:return:
"""
self.logger.info("...writing edited SQL statements to a backup file...")
edited_file_path = get_prefixed_path("01", step_path, self.edited_file_name)
edited_file_path = get_prefixed_path(
"01", step_path, f"{self.edited_db_name}.sql"
)
self.config["Processing"]["original_edited_file"] = edited_file_path
edited_file = write_statements_to_file(
self.config["Processing"]["original_edited_file"], statements
Expand Down
6 changes: 4 additions & 2 deletions efiction/simplified.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
parse_remove_comments,
write_statements_to_file,
)
from opendoors.utils import get_full_path, get_prefixed_path
from opendoors.utils import get_full_path, get_prefixed_path, prep_db_name


class EFictionSimplified:
Expand Down Expand Up @@ -40,7 +40,9 @@ def __init__(self, config: ConfigParser, logger: Logger, sql: SqlDb):
self.config = config
self.logger = logger
self.code_name = config["Archive"]["code_name"]
self.simplified_db_name = f"{self.code_name}_efiction_original_simplified"
self.simplified_db_name = (
f"{prep_db_name(self.code_name)}_efiction_original_simplified"
)
self.simplified_file_name = f"{self.code_name}_efiction_original_simplified.sql"

def __is_table_to_keep(self, table_name: str):
Expand Down
5 changes: 5 additions & 0 deletions opendoors/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ def get_full_path(path):
return str(full_path)


def prep_db_name(config_name):
config_split = str(config_name).split("/")
return config_split[-1]


def copy_to_dir(old_file_path, new_file_dir, new_file_name):
"""
Copy the source file to the destination path and filename
Expand Down
Loading