Skip to content
This repository has been archived by the owner on Sep 3, 2023. It is now read-only.

Commit

Permalink
Perfect !!!
Browse files Browse the repository at this point in the history
Signed-off-by: Arpan Mahanty <[email protected]>
  • Loading branch information
ShadowXBoss696 committed May 6, 2023
1 parent 069ec92 commit 181ad90
Show file tree
Hide file tree
Showing 7 changed files with 368 additions and 3 deletions.
9 changes: 9 additions & 0 deletions jukebox/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2023 JukeBox Developers - All Rights Reserved
# This file is part of the JukeBox Music App and is released under the "MIT License Agreement"
# Please see the LICENSE file that should have been included as part of this package

from jukebox.globals import logger

if __name__ == '__main__':
logger.warning('This is a warning')
logger.error('This is an error')
9 changes: 9 additions & 0 deletions jukebox/globals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2023 JukeBox Developers - All Rights Reserved
# This file is part of the JukeBox Music App and is released under the "MIT License Agreement"
# Please see the LICENSE file that should have been included as part of this package

from jukebox import utils

logger = utils.build_logger('jukebox.main')

ID_VERSION: str = '0.2.1'
21 changes: 21 additions & 0 deletions jukebox/jobs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) 2023 JukeBox Developers - All Rights Reserved
# This file is part of the JukeBox Music App and is released under the "MIT License Agreement"
# Please see the LICENSE file that should have been included as part of this package

from rocketry import Rocketry

from jukebox import utils

logger = utils.build_logger('jukebox.service')

rocketry = Rocketry()


@rocketry.task('every 1 seconds')
def do_ping():
logger.info('Ping')


if __name__ == '__main__':
logger.info('Starting scheduler service')
rocketry.run()
12 changes: 12 additions & 0 deletions jukebox/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) 2023 JukeBox Developers - All Rights Reserved
# This file is part of the JukeBox Music App and is released under the "MIT License Agreement"
# Please see the LICENSE file that should have been included as part of this package

from fastapi import FastAPI

from .globals import ID_VERSION

app = FastAPI(
title="JukeBox Music App",
version=ID_VERSION,
)
40 changes: 40 additions & 0 deletions jukebox/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright (c) 2023 JukeBox Developers - All Rights Reserved
# This file is part of the JukeBox Music App and is released under the "MIT License Agreement"
# Please see the LICENSE file that should have been included as part of this package

import logging
import logging.config

import yaml

# ------------------------------------------------------------------------------------
# Logging Utilities
# ------------------------------------------------------------------------------------

logging_config: dict = yaml.safe_load("""
version: 1
disable_existing_loggers: true
formatters:
standard:
format: '%(asctime)s %(name)s [%(process)d] %(threadName)s: %(levelname)s - %(message)s'
handlers:
console:
class: logging.StreamHandler
formatter: standard
stream: ext://sys.stdout
loggers:
jukebox:
level: DEBUG
handlers: [console]
propagate: no
""")
logging.config.dictConfig(logging_config)


def build_logger(name: str = None) -> logging.Logger:
"""
Return a logger with the specified name, creating it if necessary.
If no name is specified, return the root logger.
"""
return logging.getLogger(name)
274 changes: 272 additions & 2 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
[tool.poetry]
name = "jukebox"
version = "1.0.0"
version = "0.2.1"
description = "An Open Source Music Streaming App."
authors = ["JukeBox Developers <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"

fastapi = "^0.95.1"
rocketry = "^2.5.1"
pyyaml = "^6.0"


[build-system]
requires = ["poetry-core>=1.1.0"]
Expand Down

0 comments on commit 181ad90

Please sign in to comment.