[PR #101] [MERGED] updated "script_sentence_length" in config. Fixes #95 #112

Closed
opened 2026-03-02 04:06:51 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/FujiwaraChoki/MoneyPrinterV2/pull/101
Author: @taehwann
Created: 2/16/2025
Status: Merged
Merged: 2/19/2025
Merged by: @FujiwaraChoki

Base: mainHead: main


📝 Commits (6)

  • ae3ca4d Update to Cloudflare worker for image gen, updated G4F references to use 4o mini, and fixed Firefox profile handling to account for spaces in pathname (#94)
  • f717aed Add Link to X
  • 30c7a77 Ambrogio: Code improvements (#98)
  • 3b51aa3 updated variable "script_sentence_length" in config
  • f425b12 handled sentence length none exception
  • 2455351 refactored script length function call logic

📊 Changes

11 files changed (+269 additions, -52 deletions)

View changed files

📝 .gitignore (+2 -1)
📝 .python-version (+1 -1)
📝 README.md (+2 -0)
📝 config.example.json (+2 -1)
📝 src/classes/Outreach.py (+11 -0)
📝 src/classes/Tts.py (+16 -4)
📝 src/classes/YouTube.py (+129 -39)
📝 src/config.py (+15 -0)
📝 src/constants.py (+11 -2)
📝 src/cron.py (+17 -0)
📝 src/main.py (+63 -4)

📄 Description

What this PR do?

this pr updates config to able to make users change their youtube shorts script sentence length.

What is important?

def get_script_sentence_length() -> int:
    """
    Gets the forced script's sentence length.
    In case there is no sentence length in config, returns 4 when none

    Returns:
        length (int): Length of script's sentence
    """
    with open(os.path.join(ROOT_DIR, "config.json"), "r") as file:
        config_json = json.load(file)
        if (config_json.get("script_sentence_length") is not None):
            return config_json["script_sentence_length"]
        else:
            return 4

getter function handles exception for previous users who doesn't have script_sentence_length inside config. The main reason was I didn't want to force users to update because of this minor update.

What changed?

config.example.json - for new future users
YouTube.py - for forcing script sentence length inside prompt
config.py - for getter function


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/FujiwaraChoki/MoneyPrinterV2/pull/101 **Author:** [@taehwann](https://github.com/taehwann) **Created:** 2/16/2025 **Status:** ✅ Merged **Merged:** 2/19/2025 **Merged by:** [@FujiwaraChoki](https://github.com/FujiwaraChoki) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (6) - [`ae3ca4d`](https://github.com/FujiwaraChoki/MoneyPrinterV2/commit/ae3ca4d3685845dfdafbd0760e366cfc369fd59c) Update to Cloudflare worker for image gen, updated G4F references to use 4o mini, and fixed Firefox profile handling to account for spaces in pathname (#94) - [`f717aed`](https://github.com/FujiwaraChoki/MoneyPrinterV2/commit/f717aed5a282c18ec7cf411554a0e28f889c5f32) Add Link to X - [`30c7a77`](https://github.com/FujiwaraChoki/MoneyPrinterV2/commit/30c7a770e74ed930626f3d60a84a73ab71678184) Ambrogio: Code improvements (#98) - [`3b51aa3`](https://github.com/FujiwaraChoki/MoneyPrinterV2/commit/3b51aa3b6563a42b32ab3b9865d3133a424edda1) updated variable "script_sentence_length" in config - [`f425b12`](https://github.com/FujiwaraChoki/MoneyPrinterV2/commit/f425b12154a91545c0aeef034daa6b66ed20b3b2) handled sentence length none exception - [`2455351`](https://github.com/FujiwaraChoki/MoneyPrinterV2/commit/24553511fe101a0c21e719c3c6b5a06dbdcf6a63) refactored script length function call logic ### 📊 Changes **11 files changed** (+269 additions, -52 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+2 -1) 📝 `.python-version` (+1 -1) 📝 `README.md` (+2 -0) 📝 `config.example.json` (+2 -1) 📝 `src/classes/Outreach.py` (+11 -0) 📝 `src/classes/Tts.py` (+16 -4) 📝 `src/classes/YouTube.py` (+129 -39) 📝 `src/config.py` (+15 -0) 📝 `src/constants.py` (+11 -2) 📝 `src/cron.py` (+17 -0) 📝 `src/main.py` (+63 -4) </details> ### 📄 Description ### What this PR do? this pr updates config to able to make users change their youtube shorts script sentence length. ### What is important? ``` def get_script_sentence_length() -> int: """ Gets the forced script's sentence length. In case there is no sentence length in config, returns 4 when none Returns: length (int): Length of script's sentence """ with open(os.path.join(ROOT_DIR, "config.json"), "r") as file: config_json = json.load(file) if (config_json.get("script_sentence_length") is not None): return config_json["script_sentence_length"] else: return 4 ``` getter function handles exception for previous users who doesn't have `script_sentence_length` inside config. The main reason was I didn't want to force users to update because of this minor update. ### What changed? `config.example.json` - for new future users `YouTube.py` - for forcing script sentence length inside prompt `config.py` - for getter function --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 04:06:51 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/MoneyPrinterV2#112
No description provided.